Declaration
function CheckFormat(AllowedFormats: TIEPixelFormats; AutoConvert: Boolean = False): Boolean;
Description
Checks whether the current
PixelFormat is one of the formats in
AllowedFormats.
Returns
True if the format is allowed (or after a successful conversion when
AutoConvert is enabled).
If
AllowedFormats is empty (
[]), all pixel formats are treated as allowed.
If the current format is not allowed and
AutoConvert is
False (default), the bitmap is left unchanged and the result is
False.
If
AutoConvert is
True, the bitmap is converted to a preferred compatible format from
AllowedFormats (via
PixelFormat) and the result is
True on success.
Note:
◼Many ImageEn processing methods call related checks and may raise when the pixel format is incompatible (see
RaisePixelFormatExceptions)
◼Returns
False if called on a nil bitmap reference
Examples
// Ensure the image is 24-bit RGB before custom processing
if ImageEnView1.IEBitmap.CheckFormat([ ie24RGB ], True ) then
DoMyProcessing( ImageEnView1.IEBitmap );
// Accept 24-bit or 32-bit RGB without converting
if not ImageEnView1.IEBitmap.CheckFormat([ ie24RGB, ie32RGB ]) then
ShowMessage( 'Unsupported pixel format' );
// Convert grayscale or palette images to a format suitable for color filters
bmp.CheckFormat([ ie24RGB, ie32RGB ], True );
See Also
◼PixelFormat
◼RaisePixelFormatExceptions