AggPas - Anti-Grain Geomertry for Object Pascal

TAgg2D.BlendMode(m)

Description

Changes the general rendering composition mode (compliant with SVG). This method applies only to the TBitmap surfaces with Alpha channel present (pf32bit).

Default composition mode is AGG_BlendAlpha, in which each pixel is rendered to the surface with the intensity of its Alpha Transparency value.

Parameters

m: TAggBlendMode [*]

A new general composition mode.

Example

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

  VG.ClearAll(255, 255, 255);

  // Draw basic blue rectangle
  VG.NoLine;
  VG.FillColor(0, 0, 255);
  VG.Rectangle(50, 50, 150, 150);

  // Rotate coordinates by 45 degrees
  VG.Translate(-ClientWidth / 2, -ClientHeight / 2);
  VG.Rotate(Deg2Rad(45));
  VG.Translate(ClientWidth / 2, ClientHeight / 2);

  // Changing the general composition mode
  VG.BlendMode(AGG_BlendContrast);

  // Draw the same blue rectangle but with red color
  // Result comes from applying composition mode
  VG.FillColor(255, 0, 0);
  VG.Rectangle(50, 50, 150, 150);

end;

Screenshot: BlendMode example 1

More complex example:

Screenshot: BlendMode example 2

Example download:
tagg2d_example08.zip
tagg2d_example08.exe