Bitmap combination
2016-08-23
0 0 0
4.0
Other
Earn points
Translated by maninwest@Codeforge Author:huyletran@ Codeproject
Sometimes we must create a new bitmap by combining many bitmaps. This article will explain about the ways to do that using Canvas.
Using the code
Suppose that we have two bitmaps left, right, and left is bigger than right. To create new bitmap which is combined left and right horizontally, code will as below:
private void horizontalCombine() { int width = left.getWidth() + right.getWidth(); int height = Math.max(left.getHeight(), right.getHeight()); Bitmap leftRight = Bitmap.createBitmap(width, height, Config.ARGB_8888); Canvas canvas = new Canvas(leftRight); canvas.drawBitmap(left, 0, 0, new Paint()); canvas.drawBitmap(right, left.getWidth(), 0, new Paint()); imageView.setImageBitmap(leftRight); }
I will explain more about code above.
int width = left.getWidth() + right.getWidth(); int
java
组合
位图
Related Source Codes
Android AOA Android Open Accessory Development Usi
0
0
no vote
VPN source code accelerator
0
0
no vote
VPN source code
0
0
no vote
Springboot Campus Recruitment System
0
0
no vote
Java intelligent QR code access control management
0
0
no vote
No comment