Continuous line drawing with touch

Discussion in 'iOS Code Snippets' started by Mark Turney, Feb 14, 2015.

  1. Mark Turney

    Mark Turney Active Member Licensed User

    I couldn't find this particular bit of code anywhere and so I figured it out myself. Used it for my Less Note 1.0.0 drawing/sketching/writing app currently waiting for review.

    Code:
    Sub DrawPanel_Touch(Action As Int, X As Float, Y As Float)
        
    Select Action
            
    Case DrawPanel.ACTION_DOWN
                x2 = X
                y2 = Y
            
    Case DrawPanel.ACTION_MOVE
                cvsDrawPad.DrawLine(X, Y, x2, y2, penColor, penwidth)
                x2 = X
                y2 = Y
                cvsDrawPad.Refresh
        
    End Select
    End Sub
    Hope this is helpful.
     
    Filippo likes this.
  2. freedom2000

    freedom2000 Well-Known Member Licensed User

    Hi,

    I tried your code but got an error on the refresh method...

    Code:
    Error description: Unknown member: refresh
    Occurred on line: 
    178
                cvsDrawPad.Refresh
    Word: refresh
     
  3. Mark Turney

    Mark Turney Active Member Licensed User

    Silly question, but iOS or Android? This is specifically for iOS. If Android, you use Invalidate to "redraw" a view.
     
  4. freedom2000

    freedom2000 Well-Known Member Licensed User

    Oups I didn't see that it was a B4i post

    Sorry
     
    Mark Turney likes this.
  5. narek adonts

    narek adonts Well-Known Member Licensed User

    Great code, Thank you.
    But the quality of drawing is not so good.
    So maybe anyone know a better method for drawing?

    Narek
     
  6. klaus

    klaus Expert Licensed User

    You need to tell us what is not goog !?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice