6

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.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Kleptine
  • 5,089
  • 16
  • 58
  • 81
  • This also needs to be a solution using the Canvas rendering system, not openGL. – Kleptine Dec 26 '10 at 21:44
  • Hi i asked a related question about just how many pixels android can draw and keep screen refresh speeds up. Just how many pixles are you drawing on each screeen and how fps are you getting ? – mP. Dec 31 '10 at 02:12
  • I don't really have a clue about the FPS, but I was attempting to set a 50x50 image multiple times(something around 40-50 times), and it was extremely slow. It's a smudge tool so the operation has to be applied to every few pixels along a drawn line. – Kleptine Dec 31 '10 at 02:27
  • It's bad because most android rendering methods are wrapped native methods which have far greater power to actually handle the rendering. Sorry I couldn't be more help to your question. – Kleptine Dec 31 '10 at 02:28

3 Answers3

2

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

Andi Krusch
  • 1,383
  • 8
  • 6
1

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.

num1
  • 4,825
  • 4
  • 31
  • 49
-1

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

colithium
  • 10,269
  • 5
  • 42
  • 57