News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Paint Zooming

Started by xandaz, September 03, 2011, 11:44:02 AM

Previous topic - Next topic

xandaz

   How do Painting/drawing apps do the zooming? I've been looking into it but couldn'tfind anything on the subject. I looked in the skd but alli could find was the ScaleWindow/ViewportExtEx. I tried it out but no changes made. Does anyone have any tips on this subject? thanks

Tedd

Normal viewing = draw each pixel 1x1
Zoom 2x = draw each pixel 2x2
Zoom 3x = draw each pixel 3x3
Zoom 10x = draw each pixel 10x10

That's all you need to do - just draw each of the pixels 'bigger.'
I'd use StretchBlt :wink
No snowflake in an avalanche feels responsible.

xandaz

   Sounds simple. Except that if i make a pen larger than one and if it's not straight it doesnt really work does it? Couldnt i use setworldtransformand other scaling functions? Do you know how other apps do it? Do you any examples? Thanks Ted

xandaz

   Having thought a little about it it would be best to use stretching. Thanks ted. I think i just have to map the mouse to the pixels size right? Thanks again

qWord

Quote from: xandaz on September 03, 2011, 01:53:55 PM
   Having thought a little about it it would be best to use stretching. Thanks ted. I think i just have to map the mouse to the pixels size right? Thanks again
yes, simply divide the mouse's x and y position by the current scale factor (2,4,...). Using this coordinates, you an draw to your bitmap/DC.
FPU in a trice: SmplMath
It's that simple!

xandaz

   thanks guys ...you're the best...