scrollPreview

Syntax

static int scrollPreview(int mode, int ox, int oy)

Arguments

mode
Set to 0 for relative mode and 1 for absolute mode
ox, oy
For relative mode, horizontal and vertical offset in pixel units. For absolute mode, the coordinates of the center of the preview.

Return

Always returns 1.

Description

Scrolls the preview image (the part of the image displayed in the preview window) into the new position. Scrolling can be relative to current position or absolute.

This function only work if the image is larger than the preview. If the image is fully displayed in the preview, this function has no effect.

Warning: Only use scrollPreview() in the OnCtl and OnFilterStart handlers, otherwise you will get some unwanted effects in the preview! Calling it several times in a loop also causes redraw problems. But if works fine if only used for moving the image in the preview to a certain position, if followed by doAction(CA_PREVIEW).

Example

scrollPreview(0, 100, 100) - scroll the preview image 100 pixels down and to the right

scrollPreview(0, -100, -100) - scroll the preview image 100 pixels up and to the left

scrollPreview(1, 0, 0) - display the top left corner of the image in the preview

scrollPreview(1, 200, 200) - center the preview image at the coordinate (200,200)

scrollPreview(1, X/2, Y/2) - display the center of the image in the preview

See Also

setZoom, scaleFactor

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.