Android Question Create a new transparent png

AlpVir

Well-Known Member
Licensed 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
When drawing on the image, use colors.transparent or colors.Argb(...) with the needed alfa.
 
Top