Android Question Create a new transparent png

AlpVir

Well-Known Member
Licensed User
Longtime User
The following code creates a PNG image on which you can draw.
B4X:
Dim C               As Canvas
Dim BMP            As Bitmap
BMP.InitializeMutable(1000,600)
C.Initialize2 (BMP)
………………
…………………………..
C.DrawLine (...........
……………………
……………………
Dim Out As OutputStream
Out = File.OpenOutput (File.DirRootExternal , “x.png”,False )
C.Bitmap.WriteToStream (Out,100,"PNG")
Out.Close
How do you make the image transparent (color white for example) ?
Thanks in advance
 

derez

Expert
Licensed User
Longtime User
When drawing on the image, use colors.transparent or colors.Argb(...) with the needed alfa.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…