AggPas - Anti-Grain Geomertry for Object Pascal

TAgg2D.TransformImage(bitmap, parallelo)

Description

Draws a TBitmap image at defined target surface parallelogram.

Parameters

bitmap: TBitmap

Reference to non empty pf32bit TBitmap (or descendant).

parallelo: PDouble

Pointer to the first element of an array defining the three coordinates of target surface parallelogram [all elements in subpixels].

Individual corners of parallelogram are in this order: Top Left (x,y), Top Right (x,y) & Bottom Right(x,y). The remaining Bottom Left (x,y) corner is computed internally from the other three corners.

Example

// Cut and paste this into the tagg2d_example08.zip

var
  parall: array[1..6] of double;

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 Lena image around own axis
  VG.Translate(-(50 + Image2.Picture.Bitmap.Width / 2),
   -(150 + Image2.Picture.Bitmap.Height / 2));
  VG.Rotate(Deg2Rad(TrackBar1.Position));
  VG.Translate((50 + Image2.Picture.Bitmap.Width / 2),
   (150 + Image2.Picture.Bitmap.Height / 2));

  // Draw the bitmap
  parall[1] := 50;
  parall[2] := 150;
  parall[3] := Image2.Picture.Bitmap.Width + 50;
  parall[4] := 150;
  parall[5] := Image2.Picture.Bitmap.Width + 120;
  parall[6] := Image2.Picture.Bitmap.Height + 150;

  VG.TransformImage(Image2.Picture.Bitmap, @parall[1 ]);

end;

Screenshot: example