racket/draw: doc overview fix and tweaks
This commit is contained in:
parent
fc52248446
commit
7fd4f59e5a
|
@ -276,13 +276,13 @@ stipple for @racket[blue-brush]:
|
||||||
Along similar lines, a @racket[color%] object lets you specify a color
|
Along similar lines, a @racket[color%] object lets you specify a color
|
||||||
through its red, green, and blue components instead of a built-in
|
through its red, green, and blue components instead of a built-in
|
||||||
color name. Due to the way that @racket[color%] initialization is
|
color name. Due to the way that @racket[color%] initialization is
|
||||||
overloaded, use @racket[make-object%] instead of @racket[new] to
|
overloaded, use @racket[make-object] instead of @racket[new] to
|
||||||
instantiate @racket[color%]:
|
instantiate @racket[color%], or use the @racket[make-color] function:
|
||||||
|
|
||||||
@racketblock+eval[
|
@racketblock+eval[
|
||||||
#:eval draw-eval
|
#:eval draw-eval
|
||||||
(define red-pen
|
(define red-pen
|
||||||
(new pen% [color (make-object color% 200 100 150)] [width 2]))
|
(new pen% [color (make-color 200 100 150)] [width 2]))
|
||||||
(send dc erase)
|
(send dc erase)
|
||||||
(draw-face dc)
|
(draw-face dc)
|
||||||
]
|
]
|
||||||
|
@ -521,7 +521,8 @@ either the pen or brush, can be set using
|
||||||
@racketblock+eval[
|
@racketblock+eval[
|
||||||
#:eval draw-eval
|
#:eval draw-eval
|
||||||
(send dc erase)
|
(send dc erase)
|
||||||
(send dc set-font (make-object font% 14 'roman 'normal 'bold))
|
(send dc set-font (make-font #:size 14 #:family 'roman
|
||||||
|
#:weight 'bold))
|
||||||
(send dc set-text-foreground "blue")
|
(send dc set-text-foreground "blue")
|
||||||
(send dc draw-rectangle 0 0 100 30)
|
(send dc draw-rectangle 0 0 100 30)
|
||||||
(send dc draw-text "Hello, World!" 5 1)
|
(send dc draw-text "Hello, World!" 5 1)
|
||||||
|
@ -645,10 +646,10 @@ text with its reflection below it.
|
||||||
(code:comment "using a small bitmap that we never draw into.")
|
(code:comment "using a small bitmap that we never draw into.")
|
||||||
(define bdc (new bitmap-dc% [bitmap (make-bitmap 1 1)]))
|
(define bdc (new bitmap-dc% [bitmap (make-bitmap 1 1)]))
|
||||||
(define str "Racketeers, ho!")
|
(define str "Racketeers, ho!")
|
||||||
(define the-font (send the-font-list find-or-create-font
|
(define the-font (make-font #:size 24 #:family 'swiss
|
||||||
24 'swiss 'normal 'bold))
|
#:weight 'bold))
|
||||||
(define-values (tw th)
|
(define-values (tw th)
|
||||||
(let-values ([(tw th _1 _2)
|
(let-values ([(tw th ta td)
|
||||||
(send dc get-text-extent str the-font)])
|
(send dc get-text-extent str the-font)])
|
||||||
(values (inexact->exact (ceiling tw))
|
(values (inexact->exact (ceiling tw))
|
||||||
(inexact->exact (ceiling th)))))
|
(inexact->exact (ceiling th)))))
|
||||||
|
@ -691,8 +692,8 @@ text with its reflection below it.
|
||||||
(code:comment "linear gradient over the portion of the bitmap")
|
(code:comment "linear gradient over the portion of the bitmap")
|
||||||
(code:comment "where the shadow goes")
|
(code:comment "where the shadow goes")
|
||||||
(define stops
|
(define stops
|
||||||
(list (list 0 (make-object color% 0 0 0 0.4))
|
(list (list 0 (make-color 0 0 0 0.4))
|
||||||
(list 1 (make-object color% 0 0 0 0.0))))
|
(list 1 (make-color 0 0 0 0.0))))
|
||||||
(send bdc set-brush
|
(send bdc set-brush
|
||||||
(new brush%
|
(new brush%
|
||||||
[gradient
|
[gradient
|
||||||
|
|
Loading…
Reference in New Issue
Block a user