Android custom XferMode / PorterDuff.Mode
Asked Answered
T

0

11

There are some predefined blending modes described here: https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html

Is there a possibility to use some other custom modes? (for drawing various stuff on Canvas)

For example, I really need two more:

  • Replace the alpha (it would be written as [Sa, Dc] if I understand right)
  • Blend using destination alpha [Sa, Da * Sc + (1 - Da) * Dc] (here I don't really care about the result's alpha)

And it would be OK if it would require OpenGL ES 2+.

There's a [remotely] similar question here: Implementing different PorterDuff modes in android — but the answer seems to require using two bitmaps, and I want to stay free of temporary bitmaps, because they are… not free.

Tearjerker answered 20/3, 2015 at 6:32 Comment(5)
what about ColorMatrixColorFilter?Clairclairaudience
ColorFilter can't be used for blending two images, it can only apply a transform to one image, isn't it?Tearjerker
When saying "blending" what exactly do you mean?Clairclairaudience
draw image A (a Paint probably) over an existing image B (Canvas), using some function with 2 inputs (pixel from A, pixel from B) to compute the final pixels.Tearjerker
@Clairclairaudience "blending" means "mixing". He wants to overlay 2 images.Amorist

© 2022 - 2024 — McMap. All rights reserved.