Sub Process_Globals
Private xui As XUI
End Sub
Sub Globals
Private pnlClip As B4XView
Private cvsClip As B4XCanvas
Private pthClip As B4XPath
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
cvsClip.Initialize(pnlClip)
DrawImage
End Sub
Private Sub DrawImage
' 20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%
pthClip.Initialize(20%x, 0%y)
pthClip.LineTo(0%x, 20%y)
pthClip.LineTo(30%x, 50%y)
pthClip.LineTo(0%x, 80%y)
pthClip.LineTo(20%x, 100%y)
pthClip.LineTo(50%x, 70%y)
pthClip.LineTo(80%x, 100%y)
pthClip.LineTo(100%x, 80%y)
pthClip.LineTo(70%x, 50%y)
pthClip.LineTo(100%x, 20%y)
pthClip.LineTo(80%x, 0%y)
pthClip.LineTo(50%x, 30%y)
pthClip.LineTo(20%x, 0%y)
cvsClip.ClipPath(pthClip)
cvsClip.DrawBitmap(LoadBitmap(File.DirAssets, "rose.jpg"), cvsClip.TargetRect)
cvsClip.Invalidate
End Sub