Android Question Canvas - refresh or delete all image

ivanomonti

Expert
Licensed User
Longtime User
IT: come posso ripulire un canvas do un pannello eliminando l'immagine precedente!!!
EN: how do I clear a canvas panel eliminating the previous picture !!!

Screenshot_2015-01-08-10-25-21.png
 

sorex

Expert
Licensed User
Longtime User
sure there is.

use either that blue-ish color that is the background of that picture or use colors.transparent.
 
Upvote 0

CyclopDroid

Well-Known Member
Licensed User
Longtime User
Potresti usare la libreria Gestures ;)


B4X:
Private Sub GesturesTouch(View As Object, PointerID As Int, Action As Int, X As Float, Y As Float) As Boolean 'ignore
    Dim p As Point
    Select Action
        Case g.ACTION_DOWN, g.ACTION_POINTER_DOWN
            'New Point is assigned to the new touch
            p.Id = PointerID
            p.Color = Colors.Transparent
            TouchMap.Put(PointerID, p)
        Case g.ACTION_POINTER_UP
            TouchMap.Remove(PointerID)
        Case g.ACTION_UP
            'This is the end of this gesture
            TouchMap.Clear
    End Select
    Dim px, py As Int
    For i = 0 To TouchMap.Size - 1
        p = TouchMap.GetValueAt(i)
        px = g.GetX(p.id)
        py = g.GetY(p.id)
        If p.prevX > 0 AND p.prevY > 0 Then
            Canvas.DrawLine(p.prevX, p.prevY, px, py, p.Color, 10dip)
        End If
        p.prevX = px
        p.prevY = py
    Next
    pnlCoprente.Invalidate
    Return True
End Sub
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Just use invalidate in the canvas target
 
Upvote 0
Top