gradients: refine checking and docs to fit various conventions

original commit: 553723627c78c0168427e7b8618d4da37432b02d
This commit is contained in:
Matthew Flatt 2011-01-04 12:43:57 -07:00
parent dd7620800d
commit 73b3899dac
3 changed files with 37 additions and 2 deletions

View File

@ -113,6 +113,7 @@ key-event%
keymap%
label->plain-label
labelled-menu-item<%>
linear-gradient%
list-box%
list-control<%>
make-bitmap
@ -160,6 +161,7 @@ read-bitmap
read-editor-global-footer
read-editor-global-header
read-editor-version
radial-gradient%
region%
register-collecting-blit
scroll-event%

View File

@ -923,9 +923,40 @@
(let ([p (send dc get-pen)])
(send dc set-pen (make-object color% 0 0 0 0.1) 1 'solid)
(send dc set-brush (make-object color% 255 0 200 0.5) 'solid)
(send dc draw-rectangle 250 310 20 20)
(send dc draw-rectangle 250 320 20 20)
(send dc set-brush (make-object color% 0 255 200 0.5) 'solid)
(send dc draw-rectangle 260 320 20 20)
(send dc draw-rectangle 260 330 20 20)
(send dc set-pen p))
(let ([p (send dc get-pen)])
(send dc set-pen "white" 1 'transparent)
(send dc set-brush (new brush%
[gradient
(make-object linear-gradient%
300 0 380 0
(list (list 0.0
(make-object color% 255 0 0))
(list 0.5
(make-object color% 0 255 0))
(list 1.0
(make-object color% 0 0 255 0.0))))]))
(send dc draw-rectangle 300 320 80 20)
(send dc set-pen p))
(let ([p (send dc get-pen)])
(send dc set-pen "white" 1 'transparent)
(send dc set-brush (new brush%
[gradient
(make-object radial-gradient%
360 250 5
365 245 25
(list (list 0.0
(make-object color% 255 0 0))
(list 0.5
(make-object color% 0 255 0))
(list 1.0
(make-object color% 0 0 255 0.0))))]))
(send dc draw-rectangle 338 228 44 44)
(send dc set-pen p))
(send dc draw-line 130 310 150 310)

View File

@ -120,6 +120,8 @@ A `region%' can be created as independent of any `dc<%>', in which
cases it uses the drawing context's current transformation at the time
that it is installed as a clipping region.
Brushes now support linear and radial gradients.
The old 'xor mode for pens and brushes is no longer available (since
it is not supported by Cairo).