ImageEn, unit imageenview

TImageEnView.CopyFromPolygon

TImageEnView.CopyFromPolygon


Declaration

procedure CopyFromPolygon(Source: TBitmap; const Polygon: array of TPoint; PolygonLen: Integer; const Position: TPoint);


Description

Copies a region (Polygon) of source bitmap to current image.
The current bitmap will be enlarged in necessary.

Parameter Description
Source Source bitmap
Polygon Array of polygon vertexes (pixel coordinates related to Source bitmap)
PolygonLen Number of vertexes in polygon
Position Destination point (pixel coordinate related to current image). The destination point is the top-left side of the rectangle that encloses source polygon


Example

// Copies current selected area of ImageEnView1 to ImageEnView2 at position 0, 0
ImageEnView2.CopyFromPolygon(ImageEnView1.IEBitmap.VCLBitmap, ImageEnView1.PolySelPoints^, ImageEnView1.PolySelCount, Point(0, 0));

// Copies the rect 0, 0, 100, 100 in ImageEnView2 at position 0, 0
ImageEnView2.CopyFromPolygon(ImageEnView1.IEBitmap.VCLBitmap, [Point(0, 0), Point(100, 0), Point(100, 100), Point(0, 100)], 4, Point(0, 0));

// Copies current selection to ImageEnView2. Then enhance contrast of ImageEnView2 and copy back to ImageEnView1 (in same selection).
ImageEnView2.CopyFromPolygon(ImageEnView1.IEBitmap.VCLBitmap, ImageEnView2.PolySelPoints^, ImageEnView2.PolySelCount, Point(0, 0));
ImageEnView2.Proc.Contrast(30);
ImageEnView2.CopyToPolygon(ImageEnView1.IEBitmap.VCLBitmap, ImageEnView1.PolySelPoints^, ImageEnView1.PolySelCount, Point(0, 0));
ImageEnView1.Update();