problems drawline for my galvanometer

alan1968

Active Member
Licensed User
Longtime User
hello,
I wrote a little program to simulate a galvanometer, everything works fine except the needle disappears in 2 places ...

Why is this?

thx!

alan
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You should use File - Export as zip when uploading projects (otherwise you are uploading unnecessary files).

You can set the canvas to draw with "anti alias" mode (requires the reflection library):
B4X:
Sub SetAntiAlias (c As Canvas)
    Dim r As Reflector
    Dim NativeCanvas As Object
    r.Target = c
    NativeCanvas = r.GetField("canvas")
    Dim PaintFlagsDrawFilter As Object
    PaintFlagsDrawFilter = r.CreateObject2("android.graphics.PaintFlagsDrawFilter", _
        Array As Object(0, 1), Array As String("java.lang.int", "java.lang.int"))
    r.Target = NativeCanvas
    r.RunMethod4("setDrawFilter", Array As Object(PaintFlagsDrawFilter), Array As String("android.graphics.DrawFilter"))
End Sub

The line will look good. However you will have some other issues to fix.

Note that you should use 'dip' units when you specify pixel sizes. Otherwise your drawings will not look good on devices with a different scale.
 
Upvote 0
Top