Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[ALLY] Canvas style using Draw Dialect

From: allenk:powerup:au at: 10-Apr-2001 12:42

Hi All, Here is a simple example drawing Canvas style that uses the new draw dialect in in View. For a fuller demo of how this style can be used, do http://www.rebolforces.com/reb/canvas.r ; Create the style for drawing on draw-styles: stylize [ canvas: image with [ size: 100x100 edge: [size: 2x2 effect: 'ibevel color: 110.120.130] color: ivory saved-area: none line: none reset: does [clear line append line compose [pen (pen) line]] set-pen: func [color][old-pen: pen pen: color if pen <> old-pen [append line compose [pen (pen) line]] ] pen: black old-pen: pen feel: make feel [ engage: func [f a e] [ if find [down over] a [ append f/line e/offset - 2x2 show f ] if a = 'up [append f/line [line]] ] ] words: [pen [new/pen: second args next args]] init: [ if (1 >= length? self/effect) [ self/effect: copy/deep compose/deep [draw [pen (self/pen) line]] ] self/line: second self/effect ] ] ] ; Now to use the style in a simple layout... view center-face layout [ styles draw-styles canvas 200x200 pen green ] Cheers, Allen K For a fuller demo of how this style can be used, do http://www.rebolforces.com/reb/canvas.r