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

draw question

 [1/6] from: blemeri::noos::fr at: 25-Oct-2002 12:41

Hi, We can add a transparent box with effect to an image (see the script below) but how can we add a transparent circle with effect ? I can't find a solution. Can anyone help me ? Bruno. the-image: load %palms.jpg faces: layout [ size the-image/size backdrop the-image ] vid-face: get-style 'face append faces/pane v-face: make vid-face [ size: 100x100 color: font: para: text: data: none effect: [invert] feel: make feel [ engage: func [f a e] [ ;intercepts target face events if find [over away] a [ f/offset: confine f/offset + e/offset - f/data f/size 0x0 f/parent-face/size show f ] if a = 'down [f/data: e/offset] ] ] ] view faces

 [2/6] from: cyphre:seznam:cz at: 25-Oct-2002 13:59

Hello Bruno and all, I'm not sure if I understand you well but here is a simple example how to use DRAW dialect for "painting" into alpha channel of the image. I think with the function make-alpha (bellow in the example) you can draw almost any kind of transparent shape though it is not the fastest method....IMO the possibility to use DRAW pens for alpha channel should be done at Rebol's native level...What dou you think Holger? ;-) !!watch out line breaks!! --------------<code>------------- make-alpha: func [fx img /local idx][ append fx 'grayscale fx: to-block mold to-image make face [ size: img/size effect: fx edge: none ] fx: fx/3/2 img: to-block mold img idx: 0 remove-each i fx [ idx: idx + 1 either idx > 1 [ if idx = 3 [idx: 0] true ][ false ] ] append img/3 fx return do load img ] pic: load-thru/binary view layout [ backdrop effect reduce ['gradient red orange] image make-alpha [ gradient 1x1 0.0.0 255.255.255 draw [ pen 0.0.0 fill-pen 200.200.200 circle 100x80 50 fill-pen 0.0.0 box 80x80 125x125 ] ] pic ] -----------------------------<end of code>------------------------------- regards, Cyphre

 [3/6] from: cyphre:seznam:cz at: 25-Oct-2002 15:52

Hello to myself, just little correction: You can use the make-alpha function not only with DRAW but with any other effect-block command(like the transparent gradient in the example) ..and little note: this script need at least Rebol/View version 1.2.5 and up or Rebol/Link from the version where alpha-channel support was added. regards, Cyphre

 [4/6] from: blemeri:noos at: 25-Oct-2002 16:36

Hi cyphre, Perhaps my last message was not clear enough: I wan't to have the invert effect in a circular part of an image and i would like to control the position of this circle with the mouse. But may be your code will help me: i'm going to study it Thx, Bruno. I

 [5/6] from: cyphre:seznam:cz at: 25-Oct-2002 18:13

Hi Bruno, aha, then maybe this is what you want to do? ------------code-------------- img: load %palms.jpg view layout [ image img at 50x50 box 100x100 with [ effect: [ merge invert oval key 0.0.0 ] feel: make feel [ click?: false engage: func [f a e][ if find [down] a [ click?: true mouse-pos: e/offset ] if find [up] a [ click?: false ] if find [over away] a [ if click? [ f/offset: f/offset + e/offset - mouse-pos show f ] ] ] ] ] ] ---------------end of code------------------------ regards, Cyphre

 [6/6] from: blemeri:noos at: 25-Oct-2002 19:13

Yes...Many thanks cyphre, that's what i was looking for. Now, i think i must find a good documentation about the effect options ("merge" for exemple). Regards, Bruno.