IGxBitmapClass.CreateNew

Syntax

CreateNew(Width: Integer; Height: Integer; PixelFormat: GxPixelFormat): IGxBitmap;

Parameters

Width. Image width.

Height. Image height.

PixelFormat. Pixel format.

Description

The CreateNew method creates a new bitmap with the specified parameters.

Example

Sub UserProc;
Var
    BMP: IGxBitmap;
    Color: IGxColor;
    Rect: IGxRect;
    Graph: IGxGraphics;
Begin
    BMP := GxBitmap.CreateNew(
3015, GxPixelFormat.Format24bppRgb);
    Graph := GxGraphicsClass.FromImage(BMP);
    //Image formatting
    Color :=New  GxColor.CreateRGB(0,85,164);
    Rect:= 
New GxRect.Create(0,0,15,30);
    Graph.FillColorRectangle(Color, Rect);
    Color := GxColor.FromKnownColor(GxKnownColor.White);
    Rect:= 
New GxRect.Create(15,0,30,30);
    Graph.FillColorRectangle(Color, Rect);
    Color := 
New GxColor.CreateRGB(239,65,53);
    Rect:= 
New GxRect.Create(30,0,45,30);
    Graph.FillColorRectangle(Color, Rect);
    
//Save image to the file
    BMP.SaveToFileEncoded("D:\flag.bmp",GxImageFormats.Bmp);
End Sub UserProc;

After executing the example a new image is created. Three rectangles will be rendered in the image, so that the image looks like the flag of France. Image will be saved to the *.BMP file.

See also:

IGxBitmapClass