ImageEn, unit imageenview

TImageEnView.YBmp2Scr

TImageEnView.YBmp2Scr


Declaration

function YBmp2Scr(y: Integer; CurrentLayer: Boolean = False): Integer;


Description

The YBmp2Scr and XBmp2Scr methods convert a bitmap coordinate to the window coordinate (considering the Zoom and View status). x and y are bitmap coordinates.
These methods are useful to select a bitmap region independently from the Zoom, ViewX and ViewY properties.

y is a bitmap coordinate.
If CurrentLayer is true, then y is assumed to be a coordinate of the current layer. If false, y is a coordinate of the background layer (layer 0).

Note:
 To convert a coordinate of a non-current layer, you can use TImageEnView.Layers[].ConvYBmp2Scr
 The resulting screen value is relative to the control, i.e. assumes the TImageEnView is positioned at 0,0 on the active screen
 If you are using the PdfViewer in ShowAllPages mode, y is assumed to be a position within the active page (See: PageOrigin)


Demo

Demo  Demos\Other\PixelView\PixelView.dpr


Example

// Select rect 10, 10, 100, 100 of bitmap
ImageEnView1.Zoom(300);
x1 := XBmp2Scr(10);
y1 := YBmp2Scr(10);
x2 := XBmp2Scr(100);
y2 := YBmp2Scr(100);
ImageEnView1.Select( x1, y1, x2, y2);

// Select rect 10,10,100,100 of the window
ImageEnView1.Select(10, 10, 100, 100)
                

See Also

 XBmp2Scr
 XScr2Bmp
 YScr2Bmp