Implementing Zoom in the BitmapView Class
The BitmapView::zoomIn and BitmapView::zoomOut methods are inlined and the BitmapView::zoom method is called:
void zoomIn() { zoom((IlFloat)2.); }
void zoomOut() { zoom((IlFloat).5); }
The only method that needs to be implemented is the BitmapView::zoom method:
void
BitmapView::zoom(IlFloat factor)
{
IlvContainer* container = IlvContainer::GetContainer(_icon);
container->zoomView(IlvPoint(0,0), factor, factor);
// Resize the container to fit the bitmap
IlvRect bbox;
container->boundingBox(bbox);
container->resize(bbox.w()*factor, bbox.h()*factor);
}
It uses the
IlvContainer::zoomView method to change the transformer used to draw the
IlvZoomableIcon that displays the document bitmap.
Then, the container of the icon is resized so that the scroll bars of the scrolled view are updated.
The final Bitmap Editor application is shown in
The Final Bitmap Editor Application:
The Final Bitmap Editor Application
Published date: 05/24/2022
Last modified date: 02/24/2022