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: 10-May-2001 12:37

From: "Ronald Gruss"
> Hi, Scott, > > I'm glad to see how fast and how kindly you (from the rebol-list)
answer to
> my questions which must seem quite easy for you. Thanks. > > But in this case, it doesn't solve my problem : the base of my script
was
> Carl's "Cool Effect Gel" demo script, using a rotary button select
thru
> effects and applying to gel. I'd like to be able to choose the color
of the
> 'multiply' effect (for instance by double-clicking or right-clicking
on the
> gel) > > Whith 255.0.0 in place of xxxxxx, the gel's color is fixed to red > Trying whith request-color, the gel color is black and no color choice > appears. > When I try > >> request-color/color black ; and put the color to blue I get > == 0.0.255 > > It should work !!! > > This script is intended to be used whith children to experiment the
effects
> of colored filters upon other colors. It would be interresting to make
3 of
> these filters (gel) being able to select each filter color (whith the > request-color function) > > Sorry if I wasn't precise enough, but my english is far away from
perfect
> !!! > > REBOL [] > > image1: load-thru/binary http://www.rebol.com/view/nyc.jpg > image2: load-thru/binary http://www.rebol.com/view/palms.jpg > > faces: layout [ > > img: image 300x300 image1 > below > across > button image1 70x70 [img/image: image1 show img] > button image2 70x70 [img/image: image2 show img] > 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 xxxxxx] > > 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 xxxxxx] > show [f pos] > ] > if a = 'down [f/data: e/offset ] > ] > ] > ] > view faces > > Bye
Hi, Ronald, Well, English has been my primary language for 42 years, and I still can't figure the language out! ;-) I'm still not sure that I understand exactly what layout you are looking for, but I've been hacking on two versions this morning. I'll include them both in order to give you further ideas on how to achieve your desired effect. ======== Example One: Changed gel-effects.r to allow right click on image when the selection is set to colorize to change the colorize value. Several problems exists. First, to run this example, save the text in a file. When I cut then paste the text in a REBOL/View console, REBOL locks up. It runs fine from a file. I don't know why this happens. Next, there is at least one additional bug, and this may be a bug in REBOL itself. When the inform windows show with the color selector, the window should be modal as far as I can tell. As you will see the gel-window continues to move while over the color request window. Odd!? And I couldn't figure out a work-around solution. REBOL [] the-image: load-thru/binary http://www.rebol.com/view/palms.jpg effects: [ [contrast 40] [invert] [colorize 0.0.200] [gradcol 1x1 0.0.255 255.0.0] [tint 100] [luma -80] [multiply 80.0.200] [grayscale emboss] [flip 0x1] [flip 1x0] [rotate 90] [reflect 1x1] [blur] [sharpen] ] faces: layout [ size the-image/size backdrop the-image pad 0x20 space 0x2 vh2 yellow "Grab the gel and drag it around." vtext bold "Click on button below to change the effect." across at the-image/size * 0x1 + 10x-40 pos: vh1 90x24 rota: rotary 200 [ v-face/effect: load first rota/data show v-face ] ] rota/data: [] foreach e effects [append/only rota/data form e] my-color: 0.0.200 vid-face: get-style 'face append faces/pane v-face: make vid-face [ size: 100x100 pos/text: offset: 108x92 edge: make edge [color: 250.120.40 size: 4x4] color: font: para: text: data: image: none effect: first effects 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: pick effects index? rota/data show [f pos] ] if a = 'down [f/data: e/offset] if a = 'alt-down [ f/data: e/offset if tpos: find pick effects index? rota/data 'colorize [ tpos: next tpos new-color: request-color/color first tpos if not none = new-color [ change tpos new-color change rota/data rejoin ["colorize " new-color] show [f rota] ] ] ] ] ] ] view faces ======== Example Two: In the second example, I have utilized your second interface, but I changed the effects to buttons. I have only included two effects, but hopefully you will get the idea. The multiply effect requires somewhat higher values or you will only see black. REBOL [] image1: load-thru/binary http://www.rebol.com/view/nyc.jpg image2: load-thru/binary http://www.rebol.com/view/palms.jpg faces: layout [ img: image 300x300 image1 below button "Colorize" [ mpos: find img/effect 'colorize either not none = mpos [ mpos: next mpos new-colorize: request-color/color first mpos if not none = new-colorize [ change mpos new-colorize show img ] ][ new-colorize: request-color if not none = new-colorize [ img/effect: join img/effect ['colorize new-colorize] show img ] ] ] button "Multiply" [ mpos: find img/effect 'multiply either not none = mpos [ mpos: next mpos new-multiply: request-color/color first mpos if not none = new-multiply [ change mpos new-multiply show img ] ][ new-multiply: request-color if not none = new-multiply [ img/effect: join img/effect ['multiply new-multiply] show img ] ] ] across button image1 70x70 [img/image: image1 show img] button image2 70x70 [img/image: image2 show img] return pos: vh2 90x24 ] view faces ========= I hope we are getting you closer to the solution for which you are searching. --Scott Jones