Unfortunately this is not possible so far that I have found. You'll have to do it manually or get tricky with using multiple XFermodes in conjunction with each other.
On Jan 22, 9:24 am, spaceraiders <[email protected]> wrote: > Hi, > > I'm writing an image editing application, making use of the Bitmap and > Canvas classes, and I need to edit the colors of pixels in specific > ways for some operations. For example, I'd like to be able to XOR > pixel values and create a multiply filter that works the same way as > in desktop image software. > > With the current Porter Duff modes available (http:// > developer.android.com/reference/android/graphics/PorterDuff.Mode.html) > that you set with Paint.setXfermode(..) I can't do either of these as > the XOR mode and multiply mode available don't treat alpha values the > way that I want. For example, the XOR operation should just XOR all > the bits together and not perform any calculations based on the alpha > value (Canvas does the latter when XOR is set). > > My solution at the moment is to dump the two bitmaps I'm working with > to int arrays, perform the operation by hand using the int arrays (NDK > use would speed this up) and the copy the int arrays back. This is > slow and cumbersome and also means I can't e.g. use operations like > Canvas.drawBitmap with the filters I want. > > Is it possible to introduce my own Porter Duff modes (e.g. using the > NDK)? This would be a much more elegant solution for me. > > I'd appreciate any advice on alternative solutions too. As far as I'm > aware, it isn't possible to modify the contents of Bitmap objects > directly without copying to int arrays first. > > Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

