Draw Bitmap on the screen (no deformation)
| Wed, 2007-07-18 13:40 | |
|
I have a CFbsBitmap called aImage. I want to draw it on the screen. I use this code: CWindowGc& gc = SystemGc(); gc.DrawBitmap(drawRect, aImage); This function, DrawBitmap, scales the bitmap in order to fit inside the TRect called drawRect. Is it possible to make it fit but without changing the aspect ratio? I mean, if the Rect is 320x240 and the original image is 3200x480, I would like to have a result of 320x48 on the screen (the same ratio) and not a 320x240 deformed one. Any Idea is welcome. |
|






Forum posts: 1919
Use BitBlt instead of DrawBitmap.
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 285
Use DrawBitmap(drawRect, aImage, drawRect) or use BitBlit as Eric said.
Cheers,
Sri
Forum posts: 17
As far as I know, BitBlt doesn´t scale the image, and I want to to scale it, but without deformation and without defining the size of the TRect again.
I mean, my TRect is almost screen size, and I want my large images to fit in the screen without deformation. Neither BitBlt or DrawBitmap in the way that I was using before could helpme, so... how can I use this DrawBitmap, like....
DrawBitmap(drawRect, aImage, drawRect)??
How will this make the image fit the TRect without deformation??
BR
Miguel
Forum posts: 285
AFAIK you should either use SVG images or implement your own algorithm (which is very time consuming and difficult).
Cheers,
Sri
Forum posts: 1156
Huh? You don't have to invent new algoritms or use special image formats to maintain your aspect ratio when scaling...
Just make sure your new destination Draw Rect has the same aspect ratio, and adjust it if it doesn't.
compare width/height...
a/b = A/B
then solve the equation....
Forum posts: 17
Thanks.
I guess there is no other way than trying to compute the values of the TRect in order to have exactly the same aspect ratio.