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

[REBOL] Re: Request-color use

From: gjones05:mail:orion at: 9-May-2001 17:40

From: "Ronald Gruss"
> Hi, > > How could I change the filter color in the script below using
request-color ?
> I'm not used enough to rebol to understand everything in
request-color's source.
> > Thanks in advance. > > image1: load-image %./images/couleurprimaire.gif > image2: load-image %./images/couleursecondaire.gif > > faces: layout [ > size 450x480 > backdrop water > img: image 300x300 image1 > below > across > button image1 70x70 [img/image: image1 show img] > button image2 70x70 [img/image: image2 show img] > return > > ; pad 0x20 space 0x2 > label yellow "Utiliser les boutons pour changer l'image à analyser" > return > label yellow "Maintenir le bouton gauche de la souris enfoncé pour
déplacer les filtres"
> ; at image1/size * 0x1 + 10x120 > return > pos: vh2 90x24 > ] > > vid-face: get-style 'face > > append faces/pane v-face: make vid-face [ > size: 90x90 > pos/text: offset: 340x20 > edge: make edge [color: 250.120.40 size: 4x4] > color: font: para: text: data: image: none > effect: [multiply 255.0.0] > feel: make feel [ > engage: func [f a e] [ ;intercepts target face events > if find [over away] a [ > pos/text: f/offset: confine f/offset + e/offset - f/data f/size > 0x0 f/parent-face/size > f/effect: [multiply 255.0.0] > show [f pos] > ] > > if a = 'down [f/data: e/offset] > ] > ] > ] > > view faces > > Bye bye
Hi, Ronald, I had to do a little experimenting to figure this out, because it certainly wasn't obvious to me at first glance. The solution that I think you are looking for is remarkably simple in this case. I shortened the example considerably in order to focus on the key feature that I discovered. Reading the source code for IMAGE it appears as though the effect is initialized by joining the default effect with any new effect, as in: if color [effect: join effect ['colorize color]] In order to affect the correct face, I merely added a path on the pertinent portion. Here is my abbreviated sample code: image1: load-thru/binary http://www.rebol.com/view/nyc.jpg faces: layout [ size 450x480 backdrop water img: image 300x300 image1 below across button image1 70x70 [ img/image: image1 new-color: request-color img/effect: join img/effect ['colorize new-color] show img ] return label yellow "Utiliser les boutons pour changer l'image à analyser" return pos: vh2 90x24 ] view faces Hope this helps. --Scott Jones