Android Code Snippet [B4X] [XUI] Canvas Draw Round Rect, Arcs, Ovals

ivan.tellez

Active Member
Licensed User
XUI v1.60 introduces a new method: DrawPath

With this, now we have more options to draw:
  • Arc
  • Oval
  • RoundRect
  • LineTo

Just consult the documentation of each method of the B4XPath object, Asuming an initialized B4XCanvas (tCanvas) the relevant code is:

B4X:
    Dim tRect As B4XRect
    tRect.Initialize(1dip, 1dip, MyWidth, MyHeight)
    
    Dim xPath As B4XPath
    xPath.InitializeRoundedRect(tRect, 10dip)
    
    tCanvas.DrawPath(xPath, Colors.DarkGray, False, 5)


XUI v1.60:
https://www.b4x.com/android/forum/threads/updates-to-internal-libraries.59340/#post-587118



I just have a question to @Erel ; Why to have another object and not only add DrawRoundRect or DrawArc to the B4XCanvas?
 
Top