use pen's alpha color stuff in 2htdp/image

This commit is contained in:
Robby Findler 2010-12-31 10:25:01 -06:00
parent 6f9bcf0001
commit 830c797ee4
3 changed files with 7 additions and 4 deletions

View File

@ -882,6 +882,11 @@
=> =>
(rectangle 100 10 "solid" "blue")) (rectangle 100 10 "solid" "blue"))
(test (overlay (rectangle 100 10 'solid (color 255 0 0 0))
(rectangle 100 10 'solid (color 0 255 0 255))
(rectangle 100 10 'solid (color 0 0 255 0)))
=>
(rectangle 100 10 'solid (color 0 255 0)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;

View File

@ -1065,7 +1065,8 @@ the mask bitmap and the original bitmap are all together in a single bytes!
(make-object color% (make-object color%
(color-red color) (color-red color)
(color-green color) (color-green color)
(color-blue color)))) (color-blue color)
(/ (color-alpha color) 255))))
(define (pen->pen-obj/cache pen) (define (pen->pen-obj/cache pen)

View File

@ -1222,9 +1222,6 @@ This section lists predicates for the basic structures provided by the image lib
The constructor, @racket[make-color], also accepts only three arguments, in which case The constructor, @racket[make-color], also accepts only three arguments, in which case
the three arguments are used for the @racket[red], @racket[green], and @racket[blue] fields, and the the three arguments are used for the @racket[red], @racket[green], and @racket[blue] fields, and the
@racket[alpha] field defaults to @racket[255]. @racket[alpha] field defaults to @racket[255].
Unfortunately, not all of the primitives that accept or produce @racket[color] structs use the @racket[alpha]
field; only @racket[image->color-list] and @racket[color-list->bitmap] do.
} }
@defproc[(y-place? [x any/c]) boolean?]{ @defproc[(y-place? [x any/c]) boolean?]{