--- In [email protected], "mockey_a" <[EMAIL PROTECTED]> wrote: > OK. I thought this over a bit and here is my approach: > I'd try to avoid any dividing to avoid rounding mistakes and to get > an exactly enlarged picture. > So starting from the smallest I define a radius of pixels > surrounding the pixel that the mouse is over: > local nRadius=10 > Then I define a zoom factor, e.g.: > local nZoom=5 > The width and height of the scanned square is then: nRadius*2+1 (+1 > is the pixel that the mouse is over) > I get the width and height of the zoomed square as: > local nRect=(nRadius*2+1)*nZoom > where every original pixel is 5x5 pixel big. > > Now the centered cursor is over the left top pixel of the enlarged > pixel. Why? I think the problem is that the reference point of the > scaling of the image is not its center but its left top. So I shift > the zoomed picture half the zoom-factor up and left (OK, in case of > a zoom factor of 5, I take 3), to get over the center of the zoomed > pixel. This is my offset: > local nOff=nZoom/2+1 > which I also subtract from the width and height of the window to > avoid a margin. So basically I get: > > hWnd.size(nRect-nOff,nRect-nOff) > for(!mouseleft) > hWnd.move(xmouse-nRadius*nZoom,ymouse-nRadius*nZoom) > dll.call("StretchBlt|ui i i i i ui i i i i ui",;;+ > hDC_TT,nOff*-1,nOff*-1,nRect,nRect,;;+ > hDC_SC,xmouse-nRadius,ymouse-nRadius,;;+ > nRadius*2+1,nRadius*2+1,0xCC0020) > endfor > > Maybe still not 100 percent, but looks pretty right to me.
Hmm... Interesting. I'll think about it. Sean Attention: PowerPro's Web site has moved: http://www.ppro.org Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/power-pro/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
