views:

241

answers:

3

How would you draw a Rounded Rectangle in Rebol and fill it with a gradient color ? Can't find any example.

Thanks.

+3  A: 

You must use DRAW in an effect block for a face:

view layout [
    box effect [ ; default box face size is 100x100
      draw [

        ; information for the next draw element (not required)
        line-width 2.5 ; number of pixels in width of the border
        pen black      ; color of the edge of the next draw element

        ; fill pen is a little complex:
        fill-pen 10x10 0 90 0 1 1 0.0.0 255.0.0 255.0.255

        ; the draw element
        box     ; another box drawn as an effect
          5     ; size of rounding in pixels
          10x10 ; upper left corner
          90x90 ; lower right corner
      ]
    ]
]

To study how to use FILL-PEN with different colors and gradient modes, go to the REBOL desktop under REBOL and Tools and try the Grad Lab. You can experiment with different settings there with visible source code, that you can paste into your own draw blocks.

Hope this helps. :-)

Henrik Mikael Kristensen
A: 

Wow great code, thanks a lot !!!

As for Rebol Desktop, it says cannot open folder http://www.rebol.com.index.r ?

By the way, Stackoverflow is also amazing I could even get answer for Rebol I'm so happy :)

Rebol Tutorial
this should be a comment not an answer.
Jeff Atwood
+1  A: 

Remember to click the "Local" text in the lower left corner of the desktop, otherwise it will not go online to get the index.r file.

Henrik Mikael Kristensen
I didn't know that : it works now :)
Rebol Tutorial