IGxGraphics.DrawImageTransparentF

Syntax

DrawImageTransparentF(Image: IGxImage; DestRect: IGxRectF; SrcRect: IGxRectF; SrcUnit: GxUnit; TransColor: IGxColor): IGxRectF;

Parameters

Image. Image.

DestRect. Integer rectangle where a part of the image should be rendered. If the Null value is sent as a parameter, the image is rendered according to the size sent in the SrcRect parameter.

SrcRect. Integer rectangle determining a part of the image, which should be rendered in the DestRect area. If the Null value is sent as a parameter, the whole available image area is taken.

SrcUnit. Units used by the SrcRect parameter. This parameter is not supported.

TransColor. Image color interpreted as transparent. Transparent color is not displayed on image rendering. If Null is passed as a parameter, all colors of the image are rendered.

Description

The DrawImageTransparentF method renders the image passed by the Image parameter in the specified real rectangle with the specified transparency.

Fore Example

Executing the example requires a form with the button named Button1, the ImageBox component named. The file system should contain the image C:\Image.gif. Add links to the Drawing, Forms system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    BMP: IGxBitmap;
    Image: IGxImage;
    Graph: IGxGraphics;
    Rect1, Rect2: IGxRectF;
Begin
    BMP := GxBitmap.CreateNew(ImageBox1.ClientWidth, ImageBox1.ClientHeight, GxPixelFormat.Format24bppRgb);
    Image := GxImage.FromFile(
"c:\Image.gif");
    Graph := GxGraphicsClass.FromImage(BMP);
    Rect1 := 
New GxRectF.Create(00, ImageBox1.ClientWidth, ImageBox1.ClientHeight);
    Rect2 := 
New GxRectF.Create(0016.516.5);
    Graph.DrawImageTransparentF(Image, Rect1, Rect2, GxUnit.World, 
Null);
    ImageBox1.Image := BMP;
End Sub Button1OnClick;

After executing the example clicking the button in the ImageBox component displays a new bitmap with rendered part of the graphic file C:\Image.gif.

See also:

IGxGraphics