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