Android programming for erasing a piece of bitmap

Source: Internet
Author: User
Tags error handling

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.