A simple Demo, how to work with a larger Image in conjunction with a smaller ViewPort, using
Cairo-ImageSurfaces and their Transformation-methods (Translate, Scale, Rotate),
to make this task a quite easy one...
The code of that Demo is sitting in one single VB-Form only, since it is not very large.
The left Picturebox will support "shifting the original Image per Mouse-Dragging" -
and the two ComboBoxes above it, allow for Rotation and Zooming of that Image.
The semitransparent Selection-Box is adjustable at its four sides per Mouse-Dragging as well,
and the area which this Selection-Box currently covers, is then rendered in the PicBox to the right
(respecting the current Aspect-Ratio of the Selection).
The Main-Window is adjusting the two PicBoxes (picSrc and picDst) dynamically, when it is resized.
The Demo requires the cairo-wrapper-classes from vbRichClient5 (just google for it)...
Here's the SourceCode (containing a TestImage): ViewPortHandlingCairo.zip
And here a ScreenShot:
![]()
Olaf
Cairo-ImageSurfaces and their Transformation-methods (Translate, Scale, Rotate),
to make this task a quite easy one...
The code of that Demo is sitting in one single VB-Form only, since it is not very large.
The left Picturebox will support "shifting the original Image per Mouse-Dragging" -
and the two ComboBoxes above it, allow for Rotation and Zooming of that Image.
The semitransparent Selection-Box is adjustable at its four sides per Mouse-Dragging as well,
and the area which this Selection-Box currently covers, is then rendered in the PicBox to the right
(respecting the current Aspect-Ratio of the Selection).
The Main-Window is adjusting the two PicBoxes (picSrc and picDst) dynamically, when it is resized.
The Demo requires the cairo-wrapper-classes from vbRichClient5 (just google for it)...
Here's the SourceCode (containing a TestImage): ViewPortHandlingCairo.zip
And here a ScreenShot:

Olaf