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);
    //Create image
    Color := New GxColor.CreateRGB(085164);
    Rect := New GxRect.Create(001530);
    Graph.FillColorRectangle(Color, Rect);
    Color := GxColor.FromKnownColor(GxKnownColor.White);
    Rect := New GxRect.Create(1503030);
    Graph.FillColorRectangle(Color, Rect);
    Color := New GxColor.CreateRGB(2396553);
    Rect := New GxRect.Create(3004530);
    Graph.FillColorRectangle(Color, Rect);
    //Save image to 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