Bug? B4XCanvas InitializeArc

Star-Dust

Expert
Licensed User
Longtime User
I found what looks like a Bugs in InitializeArc of B4XCanvas in B4A.

When I select the starting degree 0 and the final degree 360, it does not make an entire circle but like the image. stops at 359 degree and always leaves a free space

While in B4J I complete the circle correctly.

Is it a bugs?

B4X:
P.InitializeArc(Can.TargetRect.CenterX,Can.TargetRect.CenterY,Diam,0,360)
Can.ClipPath(P)
Can.DrawBitmap(Bmp,Can.TargetRect)
Can.Invalidate
bugs.png


try this
B4X:
For Degree=0 To 360 Step 10
    P.InitializeArc(Can.TargetRect.CenterX,Can.TargetRect.CenterY,Diam,0,Degree)
    Can.ClipPath(P)
    Can.DrawBitmap(Bmp.Get(0),Can.TargetRect)
    Can.RemoveClip
    Can.Invalidate
    Sleep(10)
Next
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is the behavior of the native API. You will need to use InitializeOval for this case.

Note that you can also achieve this effect with BitmapCreator:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   bc.Initialize(ImageView1.Width, ImageView1.Height)
   Dim brush As BCBrush = bc.CreateBrushFromBitmap(LoadBitmapResize(File.DirAssets, "101440.jpg", bc.mWidth, bc.mHeight, True))
   Dim trans As BCBrush = bc.CreateBrushFromColor(Colors.Transparent)
   For Degree=0 To 360 Step 10
       bc.DrawRect2(bc.TargetRect, trans, True, 0)
       bc.DrawArc2(bc.mWidth / 2, bc.mHeight / 2, bc.mWidth / 2, brush, True, 0, 0, Degree)
       bc.SetBitmapToImageView(bc.Bitmap, ImageView1)
       Sleep(16)
   Next
End Sub
 

Star-Dust

Expert
Licensed User
Longtime User
OK thanks. I had solved with Oval, but I thought it was a Bugs.
 
Last edited:
Top