Declaration
constructor Create();
// Create and initialize size and fill overloads
constructor Create(ImageWidth, ImageHeight: integer; FillColor: TColor; Alpha: Integer = 255); overload; // Sets to ie24RGB
constructor Create(ImageWidth, ImageHeight: integer; ImagePixelFormat: TIEPixelFormat = ie24RGB; FillColor: TColor = clWhite; Alpha: Integer = 255); overload;
// Create and load from file overload
constructor Create(const FileName: string; IOParams: TIOParams = nil); overload;
// Create and clone image overloads
constructor Create(image: TIEBitmap);
constructor Create(image: TBitmap); overload;
// Create and clone image region overloads
constructor Create(image: TIEBitmap; Rect: TRect); overload;
constructor Create(image: TBitmap; Rect: TRect); overload
// Create from memory buffer overload
constructor Create(Buffer: pointer; BufferSize: integer; Format: TIOFileType = ioUnknown); overload;
Description
Creates a new TIEBitmap object.
Optionally, if FillColor <> -1, you can fill the bitmap with the specified color (see
Fill for suitable ranges), and set the alpha (from 0: Fully Transparent - 255: Fully Opaque).
Or create a bitmap by loading an image from a file or assigning another image.
Note: Pass FillColor as -1 to prevent filling. All pixels for the new bitmap will be 0 (i.e. black).
// Create an empty image
bmp1 := TIEBitmap.Create();
// Create a 1000x1000, 24 bit RGB image
bmp2 := TIEBitmap.Create( 1000, 1000, ie24RGB, clWhite );
// Create an image from file "input.png"
bmp2 := TIEBitmap.Create('input.png');
// Create a clone of bmp2
bmp3 := TIEBitmap.Create(bmp2);
// Create an image that is fully transparent
bmp3 := TIEBitmap.Create( 500, 500, clWhite, 0 );
// Split an image into three parts horizontally
bw := ImageEnView1.IEBitmap.Width;
bh := ImageEnView1.IEBitmap.Height;
sw := bw div 3;
bmp1 := TIEBitmap.Create( ImageEnView1.IEBitmap, Rect( 0, 0, sw, bh - 1 ));
bmp2 := TIEBitmap.Create( ImageEnView1.IEBitmap, Rect( sw, 0, bw, bh - 1 ));
bmp3 := TIEBitmap.Create( ImageEnView1.IEBitmap, Rect( bw - sw, 0, bw - 1, bh - 1 ));
// Do something with the images, e.g.
bmp1.SaveToFile( 'D:\image1.png' );
bmp2.SaveToFile( 'D:\image2.png' );
bmp3.SaveToFile( 'D:\image3.png' );
bmp1.Free();
bmp2.Free();
bmp3.Free();
end;