ImageEn, unit ieview

IEDrawBackground


Declaration

// Standard overload
procedure IEDrawBackground(Canvas: TCanvas;
                           BackgroundStyle: TIEBackgroundStyle;
                           BackgroundColor: TColor; BackgroundColor2: TColor;
                           DestX, DestY, Width, Height: integer;
                           ChessboardSize: integer = 16; ChessboardBrushStyle: TBrushStyle = bsSolid;
                           GradientEndColor: TColor = clBlack; GradientDir: TIEGDIPlusGradient = gpgNone); overload;

// Wallpaper overload
procedure IEDrawBackground(Canvas: TCanvas;
                           DestX, DestY, Width, Height: integer;
                           Wallpaper: TPicture;
                           WallpaperStyle: TIEWallpaperStyle); overload;

// Internal usage overload
procedure IEDrawBackground(Canvas: TCanvas;
                           Bitmap: TBitmap;
                           BackgroundStyle: TIEBackgroundStyle;
                           BackgroundColor: TColor; BackgroundColor2: TColor;
                           DestX, DestY, Width, Height: integer;
                           x1, y1, x2, y2: integer;
                           ChessboardSize: integer; ChessboardBrushStyle: TBrushStyle;
                           GradientEndColor: TColor; GradientDir: TIEGDIPlusGradient;
                           Wallpaper: TPicture; WallpaperStyle: TIEWallpaperStyle;
                           LiveBackground: TIEBitmap;
                           HonorClippingRect: boolean;
                           AControl: TControl = nil;
                           DesigningState: Boolean = False); overload;


Description

Draw a TImageEnView background to a canvas.

Parameter Description
Canvas The desination canvas
Bitmap The image contained in the control (only used for some measurement tasks). Should generally be set to nil
BackgroundStyle The Background to draw
BackgroundColor The main color of the background
BackgroundColor2 The secondary color of the background for two color styles, such as iebsChessboard, iebsHorizontal, iebsVertical, etc. If specified as clNone, then color 2 will be a reverse of BackgroundColor. Not used for gradients
DestX, DestY, Width, Height Where to draw the background, e.g. 0,0,Width,Height
x1, y1, x2, y2 The area of the image, can be 0,0,0,0
ChessboardSize Specifies the box size (generally 16)
ChessboardBrushStyle Specifies the brush style of the boxes (generally bsSolid)
GradientEndColor The secondary color if the style is iebsGradient
GradientDir The gradient direction if the style is iebsGradient
Wallpaper If a valid TPicture is specified, all prior settings are ignored and the wallpaper is drawn
WallpaperStyle How the wallpaper should be drawn
LiveBackground A live background that is stretch drawn over canvas (generally should be nil)
HonorClippingRect Setting HonorClippingRect = True means clipping rect is always honored. This parameter has no effect unless Bitmap is specified
AControl The control being drawn to, or NIL. Used to genrate a themed edge for iebsCropped
DesigningState If true, only a simple background is drawn


Example

// Save the current image with alpha background converted to chessboard (so transparent regions can be better seen)
bmp := TIEBitmap.Create( ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height );
IEDrawBackground( bmp.Canvas, iebsChessboard, clWhite, $00E1E1E1, 0, 0, bmp.Width, bmp.Height );
ImageEnView1.IEBitmap.DrawToTIEBitmap( bmp, 0, 0 );
bmp.Write( 'D:\Transparent.jpg' );
bmp.Free;