Declaration
function Allocate(ImageWidth, ImageHeight: integer; FillColor: TColor; Alpha: Integer = 255): boolean; overload; // Sets to ie24RGB
function Allocate(ImageWidth, ImageHeight: integer; ImagePixelFormat: TIEPixelFormat = ie24RGB; FillValue: Double = -1; Alpha: Integer = 255): boolean; overload;
Description
Prepares space for an image with ImageWidth and ImageHeight sizes.
Optionally, if FillColor <> -1, it will fill with the specified color (see
Fill for suitable ranges), and set the alpha (from 0: Fully Transparent - 255: Fully Opaque).
The first overload always creates an ie24RGB image.
Returns
true on success.
Note:
◼Calling Allocate to set Alpha to 255 will have no effect unless another parameter is different from the existing value, i.e. this method has no effect: myBmp.Allocate( myBmp.Width, myBmp.Height, myBMP.PixelFormat, -1, 255 );
◼The following
pixel formats are not available if the
bitmap location is ieTBitmap: ie32f, ieCMYK, ieCIELab, ie48RGB
◼You will need to call
Update to display changes if attached to a TImageEnView
Examples
// Create a 1000x1000 CMYK bitmap
ImageEnView1.IEBitmap.Allocate( 1000, 1000, ieCMYK );
ImageEnView1.Update();
// Create bitmap with red background
ImageEnView1.IEBitmap.Allocate( 250, 250, clRed );
ImageEnView1.Update();
// Create fully transparent bitmap
ImageEnView1.IEBitmap.Allocate( 250, 250, clWhite, 0 );
ImageEnView1.Update();
// Create a 48 bit image in a TImageEnView
ImageEnView1.IEBitmap.Location := ieFile; // Location must not be ieTBitmap for some native pixel formats
ImageEnView1.IEBitmap.Allocate( 600, 400, ie48RGB, clWhite, 255 );