picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

canvas.l (1513B)


      1 # 07aug13abu
      2 # (c) Software Lab. Alexander Burger
      3 
      4 (allow "!jsDraw" )
      5 (push1 '*JS (allow "@lib/plio.js") (allow "@lib/canvas.js"))
      6 
      7 # Canvas Commands
      8 (for (Opc . L)
      9    (quote  # In sync with "@lib/canvas.js"
     10       ### Functions ###
     11       (csFillText Str X Y)
     12       (csStrokeLine X1 Y1 X2 Y2)
     13       (csClearRect X Y DX DY)
     14       (csStrokeRect X Y DX DY)
     15       (csFillRect X Y DX DY)
     16       (csBeginPath)
     17       (csClosePath)
     18       (csMoveTo X Y)
     19       (csLineTo X Y)
     20       (csBezierCurveTo X1 Y1 X2 Y2 X Y)
     21       (csLine X1 Y1 X2 Y2)
     22       (csRect X Y DX DY)
     23       (csArc X Y R A B F)
     24       (csStroke)
     25       (csFill)
     26       (csClip)
     27       (csDrawImage Img DX DY)
     28       (csTranslate X Y)
     29       (csRotate A)
     30       (csScale X Y)
     31       (csSave)
     32       (csRestore)
     33       ### Variables ###
     34       (csFillStyle V)
     35       (csStrokeStyle V)
     36       (csGlobalAlpha V)
     37       (csLineWidth V)
     38       (csLineCap V)
     39       (csLineJoin V)
     40       (csMiterLimit V)
     41       (csGlobalCompositeOperation V) )
     42    (def (car L)
     43       (list
     44          (cdr L)
     45          (list 'link
     46             (if (cdr L)
     47                (cons 'list Opc @)
     48                (list Opc) ) ) ) ) )
     49 
     50 (de <canvas> (Id DX DY Alt)
     51    (prin
     52       "<canvas id=\"" Id
     53       "\" width=\"" DX
     54       "\" height=\"" DY
     55       "\"" )
     56    (dfltCss "canvas")
     57    (prinl ">" Alt "</canvas>" ) )
     58 
     59 (de jsDraw (Id Dly)
     60    (http1 "application/octet-stream" 0)
     61    (let Lst (drawCanvas Id Dly)
     62       (prinl "Content-Length: " (bytes Lst) "^M")
     63       (prinl "^M")
     64       (pr Lst) ) )
     65 
     66 # vi:et:ts=3:sw=3