How to draw and fill a rounded rectangle in Rebol
Question
How would you draw a Rounded Rectangle in Rebol and fill it with a gradient color ? Can't find any example.
Thanks.
Solution
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. :-)
OTHER TIPS
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow