CreateNew(Width: Integer; Height: Integer; PixelFormat: GxPixelFormat): IGxBitmap;
Width. Image width.
Height. Image height.
PixelFormat. Pixel format.
The CreateNew method creates a new bitmap with the specified parameters.
Sub UserProc;
Var
BMP: IGxBitmap;
Color: IGxColor;
Rect: IGxRect;
Graph: IGxGraphics;
Begin
BMP := GxBitmap.CreateNew(30, 15, GxPixelFormat.Format24bppRgb);
Graph := GxGraphicsClass.FromImage(BMP);
//Create image
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 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: