smallee
asked on
Centralize the bitmap location
Expert
I want to show a bitmap to screen. Its size is much larger than the screen size.
if i have the coordinates of some interest regions let say(x1,y1),(x2,y2)........ ..........
Are there any easy way to centralize the coordinate of the interest region on the screen (i show the image in actual size, those region out of the screen size will not be showed) and show the interest region one by one.
Many thanks
I want to show a bitmap to screen. Its size is much larger than the screen size.
if i have the coordinates of some interest regions let say(x1,y1),(x2,y2)........
Are there any easy way to centralize the coordinate of the interest region on the screen (i show the image in actual size, those region out of the screen size will not be showed) and show the interest region one by one.
Many thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ruskialt
I knew how to use StretchBlt to display my interest region
But i have a problem. i use OnDraw to print the bitmap to screen. After it was printed on the screen. I use OnFocus to reprint the interest region. But the new printed region just covered on the old print region. The old print region was still at here.
Any step i am missing?
void CMFCView::OnDraw(CDC* pDC)
{
...
...
pDC->StretchBlt(0, 0, iClientWidth, iClientHeight, &dcMemory, 0, 0, iBpWidth, iBpHeight, SRCCOPY);
}
void CMFCView::OnFocus()
{
...
...
CDC* pDC
pDC = this->GetDC();
pDC->StretchBlt(0, 0, iClientWidth, iClientHeight, &dcMemory, iRegionX, iRegionY, 240, 320, SRCCOPY);
}
I knew how to use StretchBlt to display my interest region
But i have a problem. i use OnDraw to print the bitmap to screen. After it was printed on the screen. I use OnFocus to reprint the interest region. But the new printed region just covered on the old print region. The old print region was still at here.
Any step i am missing?
void CMFCView::OnDraw(CDC* pDC)
{
...
...
pDC->StretchBlt(0, 0, iClientWidth, iClientHeight, &dcMemory, 0, 0, iBpWidth, iBpHeight, SRCCOPY);
}
void CMFCView::OnFocus()
{
...
...
CDC* pDC
pDC = this->GetDC();
pDC->StretchBlt(0, 0, iClientWidth, iClientHeight, &dcMemory, iRegionX, iRegionY, 240, 320, SRCCOPY);
}
I'm not sure if I understand your problem.. Dont draw anything like this in OnFocus(), call Invalidate() from OnLButtonDown() instead to have OnDraw() called again. Please explain again, what yo want to do..??
ASKER
Ruskialt
Actually, i am writting a image browser in pocket pc.
what i want to do
1) Display the image in fit screen scale first.
2) Press a button to calculate the interest region ( return a interest coordinate)
3) then i want to display the specific region based on this interest coordinate. (my question)
i am wondering whether i should use stretchBlt to display the image again or any other method can do that?
Many thanks!
Actually, i am writting a image browser in pocket pc.
what i want to do
1) Display the image in fit screen scale first.
2) Press a button to calculate the interest region ( return a interest coordinate)
3) then i want to display the specific region based on this interest coordinate. (my question)
i am wondering whether i should use stretchBlt to display the image again or any other method can do that?
Many thanks!
So you want to zoom to a particular place in the image?
As my previous post suggests:
Handle OnLButtonDown(), and from here save the mouse coordinate and call Invalidate(). This will lead to a new call to OnDraw(). In OnDraw() draw the image zoomed. You probably want your view to hold information on zoom factor and position of "current view". In your OnLButtonDown() update those parameters, so that next OnDraw() will zoom to the correct place..
Any of this making sence to you?
As my previous post suggests:
Handle OnLButtonDown(), and from here save the mouse coordinate and call Invalidate(). This will lead to a new call to OnDraw(). In OnDraw() draw the image zoomed. You probably want your view to hold information on zoom factor and position of "current view". In your OnLButtonDown() update those parameters, so that next OnDraw() will zoom to the correct place..
Any of this making sence to you?
http://www.codeproject.com/miscctrl/wndimg.asp