B4J Question How can one clear a clipped path of a canvas

VB6Back

Member
Hi All,

I am wondering if there is a way to clear the content of a clipped region in a canvas?

I tried the obvious but that didn't work.

B4X:
Sub ClearRegoin(cnvs As Canvas,Region As List)
   
    cnvs.ClipPath(Region)
    cnvs.ClearRect(0,0,cnvs.Width,cnvs.Height)
    cnvs.RemoveClip
   
End Sub

In another post Erel states that we can use DrawRect to clear: https://www.b4x.com/android/forum/posts/284787/

Any idea on how this could be done?
 

VB6Back

Member
Try:
B4X:
cnvs.DrawRect(0, 0, cnvs.Width, cnvs.Height, fx.Colors.Transparent, True, 0)
Thanks Erel for your reply.

I tried the above but nothing is cleared from the canvas. If I use a non transparent color the clipped region is painted as expected.

Any other suggestion?
 
Upvote 0

VB6Back

Member
I tried the following with no effect:

B4X:
Sub ClearRegoin(cnvs As Canvas,Region As List)
   
    cnvs.ClipPath(Region)
'    cnvs.ClearRect(0,0,cnvs.Width,cnvs.Height)

    Dim p As Paint = fx.Colors.Transparent
    cnvs.DrawRect(0,0,cnvs.Width,cnvs.Height,p,True,1)

    cnvs.RemoveClip
   
End Sub
 
Upvote 0
Top