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



-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to