Android Question A canvas ClearRect Problem

jkhazraji

Active Member
Licensed User
Longtime User
The following code is derived from the B4XCanvas drawing video tutorial. I loaded a bitmap accordingly.. but canvas.ClearRect does not clear the picture or the Rect as shown in the Sub Erase.
Anybody can help ?😥

B4X:
Sub Class_Globals
    Private xui As XUI
    Private pnlDrawing As B4XView
    Private canvas As B4XCanvas
    Private bground As B4XBitmap
    Private bgRect As B4XRect
End Sub
Public Sub Initialize(Parent As B4XView)
    Parent.LoadLayout("drawing")
    canvas.Initialize(pnlDrawing)
    bground= xui.LoadBitmapResize(File.DirAssets,"board.png",400dip,300dip,True)
    bgRect.Initialize(0dip,0dip,bRight,bBot)
    canvas.DrawBitmap(bground,bgRect)
   
    canvas.Invalidate

End Sub
.
.
.
.
Sub Erase
     .
     .
     .
     [COLOR=rgb(147, 101, 184)] canvas.ClearRect(bgRect)[/COLOR]  ' ⬅

End sub



⬅😥
 
Top