Hi there,
I have drawed a Bitmap with Canvas and then saved it.
But when I save, it captures the entire Screen. I only want the "DestRect".
Here's my code:
I have tried clipping and it doesn't work :c
I have drawed a Bitmap with Canvas and then saved it.
But when I save, it captures the entire Screen. I only want the "DestRect".
Here's my code:
B4X:
Dim C As Canvas
Dim Bitmap1 As Bitmap
Dim Bitmap2 As Bitmap
Dim DestRect As Rect
SetFont("Font.ttf")
C.Initialize(Activity)
Bitmap1.Initialize(File.DirAssets,"Img1.png")
Bitmap2.Initialize(File.DirAssets,"Img2.png")
DestRect.Initialize(0,0,240,180)
C.DrawRect(DestRect,Colors.Blue,True,1)
C.DrawBitmap(Bitmap2,Null,DestRect)
C.DrawBitmap(Bitmap1,Null,DestRect)
C.DrawText("Text1", 20,30,default_font,5,Colors.white,"LEFT")
C.DrawText("Text2", 20,45,default_font,5,Colors.white,"LEFT")
C.DrawText("Text3",DestRect.Right- 20,30,default_font,5,Colors.white,"RIGHT")
C.DrawText("Text4",DestRect.Right- 20,DestRect.Bottom- 20,default_font,5,Colors.white,"RIGHT")
Dim Out As OutputStream
Out = File.OpenOutput(File.DirInternalCache, "TempImage.png", False)
C.Bitmap.WriteToStream(Out, 90, "JPEG")
Out.Close