Android develops two bitmap pictures to synthesize a picture

Source: Internet
Author: User
Tags transparent color

Scene: android4.4 decoding gif (decoded article see previous article) after each frame processing, android4.3 decoded every frame is very complete, But to the android4.4 version is not complete, each frame is on the first frame based on the changed display, so need to synthesize each frame

Effect:

After synthesis:

The code looks directly at:

/*** 2 images to be synthesized *@paramDownbitmap Bottom Picture *@paramupbitmap Top Picture *@return     */     Public StaticBitmap compoundbitmap (Bitmap downbitmap,bitmap upbitmap) {Bitmap Mbitmap= Downbitmap.copy (config.argb_8888,true); //If Black is encountered, the color value inside the Downbitmap is displayed, and if not, the color value inside the Upbitmap is displayed .//loop to get bitmap all pixel points        intMbitmapwidth =mbitmap.getwidth (); intMbitmapheight =mbitmap.getheight (); //first, ensure that Downbitmap and upbitmap are consistent high-width sizes        if(Mbitmapwidth==upbitmap.getwidth () && mbitmapheight==upbitmap.getheight ()) {             for(inti = 0; i < mbitmapheight; i++) {                           for(intj = 0; J < Mbitmapwidth; J + +) {                                  //gets the color value of each point in the bitmap picture//The color value that will be populated if it is not//here's a note. If color is fully transparent or full black returns a value of 0//getPixel () without transparent channel getPixel32 () with transparent part so full transparency is 0x00000000//and the opaque black is 0xff000000, and if you don't calculate the transparent part, it's 0.                    intcolor =Upbitmap.getpixel (J, I); //the color value exists in an array for easy later modification                    if(Color! =color.black) {Mbitmap.setpixel (J, I, Upbitmap.getpixel (J, i)); //Replace white with a transparent color                    }                  }              }        }//downbitmap.recycle ();//upbitmap.recycle ();        returnMbitmap; }


Need to combine the previous article to see: "Android Development replacement bitmap color values " http://www.cnblogs.com/feijian/p/4501322.html

Android develops two bitmap pictures to synthesize a picture

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.