Kleptine
Kleptine

Reputation: 5085

Android Blend Modes

I am looking for a way to add more advanced blend modes to my program (ones that I could define myself). How would you suggest going about this with Android?

Setting pixels individually is too slow to be a viable solution.

Upvotes: 6

Views: 5966

Answers (3)

num1
num1

Reputation: 4975

To be honest I'm not sure this is supported. Using OpenGL as an example, the blending modes are defined by the OpenGL ES Spec, so that they can potentially be implemented in hardware. Adding your own blend function would be breaking the spec, not to mention incredibly slow, because it would have to act pixel by pixel.

I'm not so sure about canvas, but I believe that you can't do it there either, for similar reasons.

Upvotes: 1

Andi Krusch
Andi Krusch

Reputation: 1383

It's possible even without openGL. PorterDuff should be the solution:

android.graphics.PorterDuffXfermode

and

android.graphics.PorterDuff

Here is a very good example:

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/Xfermodes.html

Upvotes: 2

colithium
colithium

Reputation: 10327

Android supports a subset of OpenGL. That would be the route to take if you're looking for speed.

Upvotes: -1

Related Questions