ImageEn, unit iegdiplus




procedure TIECanvas.SetCompositingMode(Mode: TIECanvasCompositingMode; Quality: TIECanvasCompositingQuality);


Specify how alpha compositing is performed.
Suppose you create an object that has an alpha of 192, which is about 75% of 255.
If your compositing mode is CompositingModeSourceOver, then areas filled with the object are a blend that is 75% brush color and 25% background color.
If your compositing mode is CompositingModeSourceCopy, then the background color is not blended with the brush color. However, the color rendered by the brush has an intensity that is 75% of what it would be if the alpha component were 255.

GDI+ Methods: GdipSetCompositingMode, GdipSetCompositingQuality


// Draw a semi-transparent ellipse
  bitmap: TIEBitmap;
  bitmap := TIEBitmap.Create( 500, 500, ie32RGB );   // <= RGBA required!
  bitmap.Fill( 0 );
  bitmap.AlphaChannel.Fill( 0 );

  bitmap.IECanvas.SetCompositingMode( ieCompositingModeSourceOver, ieCompositingQualityDefault );
  bitmap.IECanvas.Pen.Width := 4;
  bitmap.IECanvas.Pen.Color := clRed;
  bitmap.IECanvas.Brush.Color := clBlue;
  bitmap.IECanvas.Pen.Transparency := 90;
  bitmap.IECanvas.Brush.Transparency := 90;

  bitmap.IECanvas.Ellipse(10, 10, 400, 400);

  bitmap.SynchronizeRGBA( True ); // <= gdi+ draws alpha on RGBA. This copies 'A' to TIEBitmap alpha channel

  imageenview1.iebitmap.Assign( bitmap );

// Draw a custom shape onto a bitmap
Bitmap := TIEBitmap.Create( w, h, ie32RGB );
Bitmap.Fill( clWhite );    // Note: Used as the blend color for the anti-aliasing of GDI+ objects
Bitmap.IECanvas.SetCompositingMode(ieCompositingModeSourceOver, ieCompositingQualityDefault);
Bitmap.IECanvas.DrawShape( 0, 0, Bitmap.Width, Bitmap.Height, ... );
Bitmap.SynchronizeRGBA( True, True );