ImageEn, unit imageenview

TImageEnView.XBmp2Scr

TImageEnView.XBmp2Scr


Declaration

function XBmp2Scr(x: Integer; CurrentLayer: Boolean = False): Integer;


Description

The XBmp2Scr and YBmp2Scr 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.

x is a bitmap coordinate.
If CurrentLayer is true, then x 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[].ConvXBmp2Scr
 The resulting screen value is relative to the control, i.e. assumes the TImageEnView is positioned at 0,0 on the active screen


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

 YBmp2Scr
 XScr2Bmp
 YScr2Bmp