[plt-scheme] Re : interaction bug of draw-bitmap set-scale and get-loaded-mask
I had to fill in a few more details to get a working program, but hte
program I got worked fine. Here it is:
#lang scheme/gui
(define image (make-object bitmap% (build-path (collection-path
"icons") "plt-logo-red-shiny.png") 'png/mask))
(define mask (make-object bitmap% (send image get-width) (send image
get-height)))
(define gray (send the-color-database find-color "gray"))
(define black (send the-color-database find-color "black"))
(define white (send the-color-database find-color "white"))
(define mask-dc (instantiate bitmap-dc% (mask)))
(send mask-dc set-background white)
(send mask-dc clear)
(send mask-dc draw-bitmap (send image get-loaded-mask) 0 0)
(define (draw dc)
(send dc set-scale 0.5 0.5)
(send dc set-background gray)
(send dc clear)
(send dc draw-bitmap image 0 0 'solid black (send image
get-loaded-mask)) ;doesn't work
(send dc draw-bitmap image 0 (send mask get-width) 'solid black mask))
(define f (new frame% [label ""]))
(define c (new canvas%
[parent f]
[min-width (send mask get-width)]
[min-height (* 2 (send mask get-width))]
[paint-callback
(λ (c dc) (draw dc))]))
(send f show #t)
On Sat, Jan 9, 2010 at 12:58 PM, stephane bonnet <stefanbonnet at yahoo.fr> wrote:
> well, just to make sure it's not something I totally missed :
>
> (define image (make-object bitmap% (string->path "image-path-string") 'png/mask))
> (define mask (make-object bitmap% (send image get-width) (send image get-height)))
>
> (define mask-dc (instantiate bitmap-dc% (mask)))
> (send mask-dc set-background white)
> (send mask-dc clear)
> (send mask-dc draw-bitmap (send image get-loaded-mask) 0 0)
>
> (send dc set-scale 0.5 0.5)
> (send dc set-background grey)
> (send dc clear)
>
> (send dc draw-bitmap image 0 0 'solid black (send image get-loaded-mask)) ;doesn't work
> (send dc draw-bitmap image 0 0 'solid black mask) ;works fine
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>