anti-aliasing ?

ozgureffe

Member
Licensed User
Longtime User
Hi,

I am writing an color painting application for my kid which uses finger movements and strokes...

And it has some features like stroke width and color selection etc...

Everything is OK but anti-aliasing ???

This is the method which draws finger movements on the canvas

But I couldn't manage to draw strokes anti-alised?

B4X:
Sub pnl_notePanel_Touch(Action As Int, tx As Float, ty As Float)
    Select Action
    Case 1
        If tx > 85%x Then         
            btn_nextPanel_Click
        End If
    Case 0
        x1 = tx
        y1 = ty
        cnvs_note.DrawCircle(x1, y1, 5dip, LineColor, True, 1dip)
        pnl_notePanel.Invalidate3(x1 - 7dip, y1 - 7dip, x1 + 7dip, y1 + 7dip)
    Case 2
        x2 = tx
        y2 = ty
        cnvs_note.DrawLine(x1, y1, x2, y2, LineColor, 10dip)
        cnvs_note.DrawCircle(x2, y2, 5dip, LineColor, True, 1dip)
        pnl_notePanel.Invalidate3(Min(x1, x2) - 7dip, Min(y1, y2) - 7dip, Max(x1, x2) + 7dip ,Max(y1, y2) + 7dip)
                
        x1 = x2
        y1 = y2
    End Select
End Sub

Any possible solution?

Thanks...
 

agraham

Expert
Licensed User
Longtime User
Try this with the Reflection library
B4X:
   Dim Obj1 As Reflector
   Dim Canv As Canvas
   Canv.Initialize(Btn1) ' initialize on what you want
   Obj1.Target = Canv
   Obj1.Target = Obj1.GetField("paint")
   Obj1.RunMethod2("setAntiAlias", True, "java.lang.boolean")
 
Upvote 0
Top