AggPas - Anti-Grain Geomertry for Object Pascal

TAgg2D.CopyImage(bitmap, imgX1, imgY1, imgX2, imgY2, dstX, dstY)

Description

Draws a portion of TBitmap image defined by source image rectangle at defined coordinates.

This method is just raw image data copier, so affine transformations of coordinate system doesn't apply to the image data (only destination coordinates are transformed).

Parameters

bitmap: TBitmap

Reference to non empty pf32bit TBitmap (or descendant).

imgX1: integer

X coordinate of source image data Top Left corner [in pixels].

imgY1: integer

Y coordinate of source image data Top Left corner [in pixels].

imgX2: integer

X coordinate of source image data Bottom Right corner [in pixels].

imgY2: integer

Y coordinate of source image data Bottom Right corner [in pixels].

dstX: double

X coordinate of target point on surface to copy image to [in subpixels].

dstY: double

Y coordinate of target point on surface to copy image to [in subpixels].

Example

// Cut and paste this into the tagg2d_example08.zip

  if VG.Attach(Image1.Picture.Bitmap) then begin

  VG.ClearAll(255, 255, 255, 0);

  // Setting master parameters
  VG.MasterAlpha(TrackBar2.Position / 255);
  VG.AntiAliasGamma(TrackBar3.Position / 10);
  VG.BlendMode(BM);

  // Rotate coordinates system around own axis
  VG.Translate(-ClientWidth / 2, -ClientHeight / 2);
  VG.Rotate(Deg2Rad(TrackBar1.Position));
  VG.Translate(ClientWidth / 2, ClientHeight / 2);

  // Copy a portion of Image
  VG.CopyImage(Image2.Picture.Bitmap,
   60, 40, Image2.Picture.Bitmap.Width - 60, Image2.Picture.Bitmap.Height - 60,
   50, 150);

end;

Screenshot: example