[plt-scheme] Bitmap scalling

From: Robby Findler (robby at cs.uchicago.edu)
Date: Mon Jul 26 06:07:50 EDT 2004

I'm not sure which graphics library you're using, but if you use mred,
it does support bitmap scaling. You can use a dc<%> method draw-bitmap
to draw the bitmap and then use the set-scale method to change the
scale. To actually create a scaled bitmap, create a new bitmap-dc,
something like this:

(define orig-bitmap ...)
(define scale ..)
(define w (send orig-bitmap get-width))
(define h (send orig-bitmap get-height))
(define new-bitmap (make-object bitmap% (* scale w) (* scale h)))
(define bdc (make-object bitmap-dc% new-bitmap))
(send bdc clear)
(send bdc set-scale scale)
(send bdc draw-bitmap orig-bitmap 0 0)
(send bdc set-bitmap #f)

At this point, new-bitmap should be a scaled version of the orig-bitmap. 

Robby

At Sun, 25 Jul 2004 23:22:16 -0500, Philippe Ajoux wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> Hello Everyone.
> 
> I have recently started to learn Scheme and I am also trying to create 
> my own form of "texture mapping".
> The major problem I have encountered is the inability to scale and draw 
> bitmaps. Is there anyway to get some kind of extension for my Dr.Scheme 
> to enable me to scale and draw bitmaps? Or is there another method to do 
> this? I am running on Windows. I read somewhere that there was no 
> scaling due to the diffuclity with scaling for X. However, is there 
> anyway to simply allow the Windows and Mac users to scale bitmaps?
> 
> -Thank you, Phil


Posted on the users mailing list.