Android programming for erasing a piece of bitmap
Previously to intercept bitmap in the picture used by a piece of stitching, although it can be achieved, but the efficiency is very low. Think for a long time, inadvertently see the online bitmap picture of the RGB information to modify, and then came up with this approach, it feels very comfortable to use. Many error handling is not written, only to achieve basic functions AH
public static Bitmap Settransparentareaforbitmap (Bitmap B,
int width, int height, int paddingleft, int paddingtop) {
if (b = = null) {
return null;
}
int []pix = new int[width * height];
for (int j = 0; j < height; J + +) {
for (int i = 0; i < width; i++) {
int index = J * width + i;
Pix[index] = 0x00000000;
}
}
B.setpixels (pix, 0, Width, paddingleft, paddingtop, width, height);
return b;
}
I hope this article will help you with the Android program.