TIECanvas.GradientFillRect
 
Declaration
procedure GradientFillRect(aRect: TRect; Dir: TIEGDIPlusGradient = gpgVertical);
procedure GradientFillRect(aRect: TRect; FromColor, ToColor: TColor; Dir: TIEGDIPlusGradient = gpgVertical);
Description
Fill an area with a gradient.
With first overload:
◼From Color is specified by Brush.Color and Brush.Transparency
◼To Color is specified by Brush.BackColor and Brush.BackTransparency
 // Fill image with a vertical gradient from yellow to red
// Fill image with a vertical gradient from yellow to red
ImageEnView1.IEBitmap.IECanvas.GradientFillRect( Rect( 0, 0, ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height ), clYellow, clRed, gpgVertical );
ImageEnView1.Update();

// Create an alpha gradient image
var
  ieBmp: TIEBitmap;
  r: TRect;
begin
  ieBmp := TIEBitmap.Create(320, 240, clWhite );
  try
    r := ieBmp.IECanvas.GDICanvas.ClipRect;
    InflateRect( r, 1, 1 );      // Because Fill may smooth edges
    // Fill image with purple
    ieBmp.IECanvas.FillRect( r, clPurple );
    // Draw gradient to our alpha channnel
    ieBmp.AlphaChannel.PixelFormat := ie24RGB;   // Temporary promote the alpha channel to 24bit to get smoother gradient
    ieBmp.AlphaChannel.IECanvas.GradientFillRect( r, clWhite, clBlack, gpgDiagonal );
    ieBmp.SyncAlphaChannel();                              // Now revert alpha to ie8g
    ieBmp.SaveToFile( 'D:\AlphaGradient.png' );
  finally
    ieBmp.Free;
  end;
end;

See Also
◼IEDrawGradientToComboListBoxItem