slideshow/balloon: add `balloon-enable-3d'

This commit is contained in:
Matthew Flatt 2013-03-01 10:49:40 -07:00
parent c4cdcafec4
commit cb8dd143d9
3 changed files with 16 additions and 5 deletions

View File

@ -1125,6 +1125,10 @@ relative to the balloon's top-left corner.}
The default background color for a balloon. The default background color for a balloon.
@defboolparam[balloon-enable-3d on?]{
A parameter that determines whether balloons are drawn with 3-D shading.}
@; ---------------------------------------- @; ----------------------------------------
@subsection{Face} @subsection{Face}

View File

@ -14,7 +14,8 @@
balloon-pict balloon-pict
balloon-point-x balloon-point-x
balloon-point-y balloon-point-y
balloon-color) balloon-color
balloon-enable-3d)
(define-struct balloon (pict point-x point-y)) (define-struct balloon (pict point-x point-y))
@ -22,8 +23,12 @@
(define no-brush (find-brush "white" 'transparent)) (define no-brush (find-brush "white" 'transparent))
(define black-pen (find-pen "black")) (define black-pen (find-pen "black"))
(define balloon-enable-3d (make-parameter #t (lambda (x) (and x #t))))
(define (series dc steps start-c end-c f pen? brush?) (define (series dc steps start-c end-c f pen? brush?)
(color-series dc steps #e0.5 start-c end-c f pen? brush?)) (if (balloon-enable-3d)
(color-series dc steps #e0.5 start-c end-c f pen? brush?)
(color-series dc 0 0 start-c end-c f pen? brush?)))
(define (mk-balloon w h corner-radius spike-pos dx dy (define (mk-balloon w h corner-radius spike-pos dx dy
[color balloon-color]) [color balloon-color])
@ -122,9 +127,10 @@
(if (string? color) (make-object color% color) color) (if (string? color) (make-object color% color) color)
(lambda (i) (draw-once i #t)) (lambda (i) (draw-once i #t))
#t #t) #t #t)
(send dc set-brush no-brush) (when (balloon-enable-3d)
(send dc set-pen (find-pen dark-color 0.5)) (send dc set-brush no-brush)
(draw-once 0 #f) (send dc set-pen (find-pen dark-color 0.5))
(draw-once 0 #f))
(send dc set-pen p) (send dc set-pen p)
(send dc set-brush b))) (send dc set-brush b)))

View File

@ -1,5 +1,6 @@
Version 5.3.3.7 Version 5.3.3.7
Added module-compiled-cross-phase-persistent? Added module-compiled-cross-phase-persistent?
slideshow/balloon: add balloon-enable-3d
Version 5.3.3.6 Version 5.3.3.6
Added "phase-collapse" module inference and instantiation Added "phase-collapse" module inference and instantiation