AggPas - Anti-Grain Geomertry for Object Pascal

TAgg2D.MasterAlpha: double

Description

Retrieves the current value of general Alpha Transparency.

Returns

If 1, everything being rendered is fully opaque. This doesn't apply if individual state parameters (e.g. line color) have defined their own transparency, in which case the parameter's value is used.

If < 1 but > 0, everything being rendered is semitransparent with given level of transparency. Individual state parameters have trasparency level multiplied by this general level.

If 0, nothing is visible even if the individual state parameter has a full opacity.

Example

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

  VG.ClearAll (255, 255, 255);
  VG.LineWidth(20);

  // Full Master Alpha, Full LineColor opacity
  VG.Translate(0, 30);
  VG.LineColor(255, 0, 0, 255);
  VG.Line     (20, 10, 150, 10);

  // Full Master Alpha, Half LineColor opacity
  VG.Translate(0, 30);
  VG.LineColor(255, 0, 0, 128);
  VG.Line     (20, 10, 150, 10);

  // Half Master Alpha, Full LineColor opacity
  VG.MasterAlpha(0.5);

  VG.Translate(0, 30);
  VG.LineColor(255, 0, 0, 255);
  VG.Line     (20, 10, 150, 10);

  // Half Master Alpha, Half LineColor opacity
  VG.Translate(0, 30);
  VG.LineColor(255, 0, 0, 128);
  VG.Line     (20, 10, 150, 10);

  // No Master Alpha, Full LineColor opacity
  // NOT VISIBLE
  VG.MasterAlpha(0);

  VG.Translate(0, 30);
  VG.LineColor(255, 0, 0, 255);
  VG.Line     (20, 10, 150, 10);

end;

Screenshot: MasterAlpha example