Android Question Add Arc to Path

BPak

Active Member
Licensed User
Longtime User
B4X:
   Dim p As Path
   p.Initialize(0, 0)
  
   Dim jo As JavaObject = p
   Dim x = 100dip, y = 100dip, radius = 100dip As Float
   jo.RunMethod("addCircle", Array As Object(x, y, radius, "CW"))
   cvs.ClipPath(p)

Where can I find references to obtain more info on Adding different Draws to a Path?
Like DrawArc and so on.
The above code comes from Clipping a Cirlce to draw a bitmap on and uses JavaObject to 'addCircle'.

Where are references to 'addCircle' and other types of drawing?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The API is described here: http://developer.android.com/reference/android/graphics/Path.html

upload_2014-10-13_7-39-48.png


B4X:
Sub Activity_Create(FirstTime As Boolean)
   Dim c As Canvas
   c.Initialize(Activity)
   Dim p As Path
   p.Initialize(100dip, 100dip)
   Dim r As Rect
   r.Initialize(0dip, 0dip, 200dip, 200dip)
   AddArc(p, r, 0, 90)
   p.LineTo(100dip, 100dip)
   c.ClipPath(p)
   c.DrawColor(Colors.Red)
End Sub

Sub AddArc(p As Path, r As Rect, StartAngle As Float, SweepAngle As Float)
   Dim rf As JavaObject
   rf.InitializeNewInstance("android.graphics.RectF", Array (r))
   Dim jo As JavaObject = p
   jo.RunMethod("addArc", Array(rf, StartAngle, SweepAngle))
End Sub
 
Upvote 0

BPak

Active Member
Licensed User
Longtime User
Thank you Erel.

Informatix, I have tried your library but the HardwareAcceleration does not agree with my computer.
 
Upvote 0

BPak

Active Member
Licensed User
Longtime User
When compiling an Example a message is displayed:
Android Manifest:xml 19: error:
No resource identifier found for attribute 'hardwareAccelerated' in package 'android'.
 
Upvote 0

BPak

Active Member
Licensed User
Longtime User
Thanks Erel - works fine.

Top Library Informatix. Can see many uses for it.
Thank you! :)
 
Upvote 0
Top