Questions tagged [xfermode]

The Android Xfermode series of enumerations specify the ways in which bitmap data can be transferred and blended with existing data on a canvas.

The Android Xfermode series of enumerations specify the ways in which bitmap data can be transferred and blended with existing data on a canvas.

Documentation: http://developer.android.com/reference/android/graphics/PorterDuffXfermode.html

15 questions
17
votes
3 answers

Explanation of Android Xfermode

I'm newbie in graphics and there is really raw explanation of Xfermode class in Android documentation for me. Searching the web, I found only relation with such terms like: color blending, image compositing, small explanation about Transfer modes…
teoREtik
  • 7,886
  • 15
  • 46
  • 65
3
votes
2 answers

Xfermode in Android P beta

On the left is screenshot taken on Android P beta and on right is on Android 26. There seems to be inconsistencies on how Xfermode is working on Android P beta. Below is the corresponding code. public class CropView extends View { private…
Gaurav Vashisth
  • 7,547
  • 8
  • 35
  • 56
2
votes
0 answers

Blend mode to replace highest alpha?

Is there a blend mode that does the following? Essentially take the highest alpha closest to opaque. A = (Da > Sa) ? Da : Sa C = Sc I'm more interested in the alpha behavior than the color behavior.
Jona
  • 13,325
  • 15
  • 86
  • 129
1
vote
0 answers

Create a mask to bigger Image using another smaller image with transparency

I have two Images. Image 1 is big and only has some colors. Image 2 has vector numbers in black color with transparent background. I am trying to color Image 2 letters using Image 1 colors. I have tried using .svg then converting to bitmap. I…
Jmz
  • 159
  • 7
1
vote
1 answer

How to erase part of a Bitmap using PorterDuff Xfermodes and Alpha Mask?

I have an alpha mask and I want to use this mask as a rubber, when user touch on the screen that part of bitmap should be erased as the shape of the alpha mask. I have tried it but it always get the whole bitmap as mask not the alpha part. Later,…
cezmi sakar
  • 191
  • 1
  • 9
1
vote
0 answers

color blending and porterduffxfermode effect

int color1 = 0xDDfbc2ba; int color2 = 0xDD7a6c3e; int mixColor = mixTwoColors(color1,color2,0.5f); public static int mixTwoColors( int color1, int color2, float amount ) { final byte ALPHA_CHANNEL = 24; final byte…
ng2b30
  • 351
  • 6
  • 18
1
vote
1 answer

Custom ViewGroup with Circular child

I'd like to implement custom ViewGroup which is displaying single View inside. The tricky part is that the child view have to be crop into circle shape and it have to be drawn fast. What is the best way to implement this behavior? My current…
VizGhar
  • 3,036
  • 1
  • 25
  • 38
1
vote
1 answer

Clip round from image using xfermode in android

I need to create a rounded ImageView in Android. Now I use Canvas.clipPath() but hardware acceleration isn't supported by it. Of course I use View.LAYER_TYPE_SOFTWARE for this view. public class RoundedCornerImageView extends MaptrixImageView { …
Nik
  • 7,114
  • 8
  • 51
  • 75
0
votes
0 answers

Which mode in android's PorterDuffXfermode(PorterDuff.mode.[type]) performs alpha blending according to formula of WebP image specification

I am trying to blend two bitmaps with alpha blending method stated on WebP Container Specification. My code is extracting frames and rather displaying on view I am trying to make bitmap for each fraames. As we know decoder draws frames over view…
CrackerKSR
  • 1,380
  • 1
  • 11
  • 29
0
votes
0 answers

Flutter support xfermode?

In Android Studio + Java environment, I used to set xfermode. So, I was able to paint so many types of things. Is this xfermode possible in Flutter? [sample code which I wrote] bimage_baby_fit = Bitmap.createBitmap((int) baby_wh, (int)…
mc j
  • 211
  • 1
  • 2
  • 4
0
votes
1 answer

Android - Canvas Paint - only draw over White/Transparent

i need to draw a Rectangle only over the areas, which were not drawn yet. For example when i call drawText to write something, and then draw the Rect over it, it should be behind the text. I cant simply first draw the Rect, then write the Text in…
metinkale38
  • 718
  • 3
  • 10
  • 28
0
votes
1 answer

Draw Circular Bitmap on Canvas with XferMode

I'am trying to draw a circular bitmap into a canvas. The bitmap gets clipped correctly if the canvas i want to draw on is transparent, but not if i have drawn a rectangle before with a different color. Heres what i got …
luQ
  • 519
  • 1
  • 10
  • 25
0
votes
1 answer

OpenStreetMap add marker to Nutiteq MapView with custom Xfermode

I need to put some markers on top of a Nutiteq MapView. In order to create these markers I create a bitmap with a semi-transparent circle. int size = (int)(30*mDisplayMetrics.density); Bitmap androidMarkerBitmap = Bitmap.createBitmap(size, size,…
Massimo
  • 3,436
  • 4
  • 40
  • 68
0
votes
1 answer

android : Xfermode masking disappearing on 180 degree rotation of Canvas

I am inspired by the the new Material Design animations and I worked to create a similar drawable that is used in new support v7 Action Bar Drawer Toggle. I created a CustomDrawable. All I actually did is that I created a Play triangle on canvas and…
user3426273
0
votes
1 answer

AvoidXfermode on api v10 and api v14

In map activity i created overlay on which on Cnavas i draw shapes using Paint Shape consists from points and lines linePaint = new Paint(); linePaint.setColor(mContext.getResources().getColor(R.color.Line)); …
Johnny Doe
  • 3,280
  • 4
  • 29
  • 45