On Tue, Jul 31, 2012 at 05:57:47AM -0700, Numair Qadir wrote:
> I want to merge two bitmaps, here is my code

I was just going to point you to the right page in the dev guide, but I
don't remember if there even is one (I learned this from a book, "Pro
Android Media").  Be advised that with larger bitmaps, you can easily
cause an Out Of Memory error and, if that isn't caught, a force close,
so if you need to do this with LARGE bitmaps, you'll have to use the NDK.

   // blend src1 and src2 into dest (must be same size and, I think they
   // have to be the same configuration, too, e.g., both ARGB_8888)

   Bitmap dest = Bitmap.createBitmap(width, height, src1.getConfig());
   Canvas canvas = new Canvas(src2);
   Paint paint = new Paint();

   canvas = new Canvas(src2);
   paint = new Paint();
   canvas.drawBitmap(src1, 0, 0, paint);
   paint.setXfermode(new 
PorterDuffXfermode(android.graphics.PorterDuff.Mode.SRC_OVER));
   canvas.drawBitmap(dest, 0, 0, paint);

PorterDuff has quite a few different modes, so check out the dev guide's
page on PorterDuff.Mode for more information.

Later,
   --jim

-- 
THE SCORE:  ME:  2  CANCER:  0
73 DE N5IAL (/4)        MiSTie #49997  < Running Mac OS X Lion >
spooky1...@gmail.com ICBM/Hurricane: 30.44406N 86.59909W

      "'Wrong' is one of those concepts that depends on witnesses."
     --Catbert:  Evil Director of Human Resources (Dilbert, 05Nov09)

Android Apps Listing at http://www.jstrack.org/barcodes.html

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to