Hi, i need some example for loading an image into mutable bitmap and draw text over it with Canvas.
My image 1.jpg is image with - let's say a dog on it.
I try this code:
but i see only black image with text into it.
when i put cvs.DrawColor(Colors.Green) i see green background with Hello Dog on it.
But my idea is to draw Hello dog on image with dog picture
Where i am wrong?
My image 1.jpg is image with - let's say a dog on it.
I try this code:
B4X:
Dim bmp As Bitmap = LoadBitmap(File.DirAssets, "1.jpg")
Dim cvs As Canvas
Dim s as String = "Hello dog!"
bmp.InitializeMutable(iWidth * 100dip / 100, iHeight * 100dip / 100)
cvs.Initialize2(bmp)
Dim h As Double = cvs.MeasureStringHeight(s, Typeface.DEFAULT, FontSize)
cvs.DrawText(s, bmp.Width / 2, bmp.Height / 2 + h / 2, Typeface.DEFAULT, FontSize, lFontColour, "CENTER")
but i see only black image with text into it.
when i put cvs.DrawColor(Colors.Green) i see green background with Hello Dog on it.
But my idea is to draw Hello dog on image with dog picture
Where i am wrong?