ImageEn, unit iexBitmaps

TIEBitmap.Create

TIEBitmap.Create


Declaration

constructor Create();

// Create and initialize size overload
constructor Create(ImageWidth, ImageHeight: integer; ImagePixelFormat: TIEPixelFormat = ie24RGB);

// Create and initialize size and fill overload
constructor Create(ImageWidth, ImageHeight: integer; FillColor: TColor; Alpha: Integer = 255); overload;

// Create and load from file overload
constructor Create(const FileName: string; IOParams: TIOParams = nil);

// 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.

Note: All pixels for the new bitmap will be 0 (i.e. black).


Examples

// creates an empty image
bmp1 := TIEBitmap.Create();

// creates 1000x1000, 24 bit RGB image
bmp2 := TIEBitmap.Create(1000, 1000, ie24RGB);
bmp2.Fill( clWhite );

// creates an image from file "input.png"
bmp2 := TIEBitmap.Create('input.png');

// creates a clone of bmp2
bmp3 := TIEBitmap.Create(bmp2);


// 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.Write( 'D:\image1.png' );
bmp2.Write( 'D:\image2.png' );
bmp3.Write( 'D:\image3.png' );

bmp1.Free;
bmp2.Free;
bmp3.Free;
end;