Android Question Set image in holder in any shap

Pooya1

Active Member
Licensed User
I have template image that contain many shape in picture
example attachment picture
I need add image in placeholder exist on image(i define with number)
My image is exist many shape
How do can i add image in placeholder?
 

Attachments

  • com.instamag.activity_ce634ccc-fc4c-45ae-90fe-831a2b6f28bb.png.jpg
    29.9 KB · Views: 115

Pooya1

Active Member
Licensed User
I found relate function for mask picture
With this function,we have to fill black color in mask
Can i change black color to example yellow?
(I want to use 4 shape in picture with red,yellow,black,blue color and set different bitmap on colors)

B4X:
Public Sub BuildBitmap(iPicture As Bitmap, iPicture2 As Bitmap) As Bitmap
    
    Dim exDraw As ABExtDrawing
  
    Dim xBuildPicture As Bitmap
    Dim xBuildCanvas As Canvas
    
    xBuildPicture.InitializeMutable(iPicture.Width, iPicture.Height)
    xBuildCanvas.Initialize2(xBuildPicture)
      
    Dim paint As ABPaint
    paint.Initialize
    paint.setDither(True)
    paint.setAntiAlias(True)
    paint.setFilterBitmap(True)
  
    Dim d As Rect
    d.Initialize(0,0,iPicture.Width, iPicture.Height)
    
    exDraw.drawBitmap(xBuildCanvas, iPicture, Null, d, paint)
  
    paint.SetPorterDuffXfermode(paint.PorterDuffMode_SRC_IN)
    exDraw.drawBitmap(xBuildCanvas, iPicture2, Null, d, paint)
  
    Return xBuildPicture
    
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…