TBLPixelConverter
Pixel converter.
Provides an interface to convert pixels between various pixel formats. The primary purpose of this record is to allow efficient conversion between pixel formats used natively by Blend2D and pixel formats used elsewhere, for example image codecs or native framebuffers.
Definition
Unit: Blend2D
Remarks
A default-initialized converter has a valid conversion function that would return fail if invoked. Use IsInitialized
to test whether the pixel converter was properly initialized.
Properties
Name | Description |
---|---|
IsInitialized | Whether if the converter is initialized. |
Constructors
Name | Description |
---|---|
Assign | Creates a copy of the AOther converter. |
Finalize | Destroys the pixel-converter and releases all resources allocated by it. |
Initialize | Creates a new default-initialized pixel converter. |
Methods
Name | Description |
---|---|
ConvertRect(Pointer, NativeInt, Pointer, NativeInt, Integer, Integer, TBLPixelConverterOptions) | Converts a rectangular area of pixels from source format to destination. |
ConvertRect(Pointer, NativeInt, Pointer, NativeInt, Integer, Integer) | Converts a rectangular area of pixels from source format to destination. |
ConvertSpan(Pointer, Pointer, Integer, TBLPixelConverterOptions) | Converts a single span of pixels of AWidth . |
ConvertSpan(Pointer, Pointer, Integer) | Converts a single span of pixels of AWidth . |
Make | Creates a new pixel converter that will convert pixels described by |
MakePlatformConverter | Creates a pixel converter appropriate for the current platform. This is useful for platforms where the display format does not match the internal Blend2D format. For example, on macOS, iOS and Android, the red and blue color channels need to be swapped. On Windows, Blend2D's internal format matches the display format and no conversion is needed. |
Reset | Reset the pixel converter. |
Property Descriptions
IsInitialized
Whether if the converter is initialized.
property IsInitialized: Boolean read GetIsInitialized
Type: Boolean
Constructor Descriptions
Assign
Creates a copy of the AOther
converter.
If the AOther
converter has dynamically allocated resources they will be properly managed (reference counting). Only very specific converters require such resources so this operation should be considered very cheap.
constructor Assign(var ADest: TBLPixelConverter; const ASrc: TBLPixelConverter); inline
Parameters
ADest
: TBLPixelConverter
ASrc
: TBLPixelConverter
Exceptions
EBlend2DError
: Raised on failure.
Finalize
Destroys the pixel-converter and releases all resources allocated by it.
destructor Finalize(var ADest: TBLPixelConverter)
Parameters
ADest
: TBLPixelConverter
Exceptions
EBlend2DError
: Raised on failure.
Initialize
Creates a new default-initialized pixel converter.
constructor Initialize(out ADest: TBLPixelConverter)
Parameters
ADest
: TBLPixelConverter
Exceptions
EBlend2DError
: Raised on failure.
Method Descriptions
ConvertRect(Pointer, NativeInt, Pointer, NativeInt, Integer, Integer, TBLPixelConverterOptions)
Converts a rectangular area of pixels from source format to destination.
procedure ConvertRect(const ADstData: Pointer; const ADstStride: NativeInt; const ASrcData: Pointer; const ASrcStride: NativeInt; const AWidth, AHeight: Integer; const AOptions: TBLPixelConverterOptions); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ADstData
: Pointer
ADstStride
: NativeInt
ASrcData
: Pointer
ASrcStride
: NativeInt
AWidth
: Integer
AHeight
: Integer
AOptions
: TBLPixelConverterOptions
ConvertRect(Pointer, NativeInt, Pointer, NativeInt, Integer, Integer)
Converts a rectangular area of pixels from source format to destination.
procedure ConvertRect(const ADstData: Pointer; const ADstStride: NativeInt; const ASrcData: Pointer; const ASrcStride: NativeInt; const AWidth, AHeight: Integer); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ADstData
: Pointer
ADstStride
: NativeInt
ASrcData
: Pointer
ASrcStride
: NativeInt
AWidth
: Integer
AHeight
: Integer
ConvertSpan(Pointer, Pointer, Integer, TBLPixelConverterOptions)
Converts a single span of pixels of AWidth
.
procedure ConvertSpan(const ADstData, ASrcData: Pointer; const AWidth: Integer; const AOptions: TBLPixelConverterOptions); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ADstData
: Pointer
ASrcData
: Pointer
AWidth
: Integer
AOptions
: TBLPixelConverterOptions
ConvertSpan(Pointer, Pointer, Integer)
Converts a single span of pixels of AWidth
.
procedure ConvertSpan(const ADstData, ASrcData: Pointer; const AWidth: Integer); overload; inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ADstData
: Pointer
ASrcData
: Pointer
AWidth
: Integer
Make(TBLFormatInfo, TBLFormatInfo, TBLPixelConverterCreateFlags)
Creates a new pixel converter that will convert pixels described by
Use ACreateFlags
to further specify the parameters of the conversion.
procedure Make(const ADstInfo, ASrcInfo: TBLFormatInfo; const ACreateFlags: TBLPixelConverterCreateFlags = []); inline
Exceptions
EBlend2DError
: Raised on failure.
Parameters
ADstInfo
: TBLFormatInfo
ASrcInfo
: TBLFormatInfo
ACreateFlags
: TBLPixelConverterCreateFlags = []
Remarks
Destination and source format informattion must be valid, otherwise this method will fail.
MakePlatformConverter(TBLFormat)
Creates a pixel converter appropriate for the current platform. This is useful for platforms where the display format does not match the internal Blend2D format. For example, on macOS, iOS and Android, the red and blue color channels need to be swapped. On Windows, Blend2D's internal format matches the display format and no conversion is needed.
On Windows, it returns a converter that doesn't convert, but just copies the data. However, it is more efficient to not use a pixel converter at all on Windows.
On other platforms, it creates a converter that swaps Red and Blue in the given AFormat.
procedure MakePlatformConverter(const AFormat: TBLFormat)
Exceptions
EBlend2DError
: Raised on failure.
Parameters
AFormat
: TBLFormat
Reset
Reset the pixel converter.
procedure Reset; inline
Exceptions
EBlend2DError
: Raised on failure.