Older Newer
Sun, 07 Mar 2010 08:22:56 . . . . afh [add info about getCtlCoord]

Changes by last author:

= getPreviewCoordY =

== Syntax ==

:int getPreviewCoordY (void)

== Arguments ==


== Return ==

:Returns the y coordinate in the image above which the mouse pointer is placed.

== Description ==

:Together with getPreviewCoordX you can use it to get the coordinates of the mouse pointer above the image in the preview. The returned coordinates are already converted to image coordinates. But it is recommended to multiply the returned value with scaleFactor to get a coordinate relative to the full image and not just a coordinate relative to the e.g. 33% zoomed version of the image.

== Example ==



ctl(0):statictext,"Please right click on the preview to set a cross.",size=(100,20)






doAction(CA_PREVIEW );


return false;



int g,h,z, color;

int PreviewX = j0/scaleFactor;

int PreviewY = j1/scaleFactor;

//Calculate color of the cross

color = ( src(PreviewX,PreviewY,0) + src(PreviewX,PreviewY,1)+src(PreviewX,PreviewY,2) )/3;

if (color>128 && color<196) color=0;

if (color>64 && color<128) color=255;

else color =255-color;

//Display Cross

if (doingProxy){

for (z=0;z<Z;z++){

for (g=-7;g<8;g++)

if (g<-1 || g>1) pset(PreviewX + g, PreviewY, z, color);

for (h=-7;h<8;h++)

if (h<-1 || h>1) pset(PreviewX, PreviewY + h, z, color );



return true;



== Also see ==

:getPreviewCoordX, getCtlCoord, scaleFactor

== Comments ==

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

*Calling getPreviewCoordY() is equivalent to calling getCtlCoord(CTL_PREVIEW, 1).