Class TCustomImageFormatManager

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TCustomImageFormatManager = class abstract(TObject)

Description

Abstract image format manager, which provides facilities for loading and saving different image formats.

Hierarchy

  • TObject
  • TCustomImageFormatManager

Overview

Methods

Public function LoadFromAsset(const AssetName: StdString; const DestSurface: TPixelSurface; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare): Boolean; virtual; abstract;
Public function LoadFromFile(const FileName: StdString; const DestSurface: TPixelSurface; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare): Boolean; virtual; abstract;
Public function LoadFromStream(const Extension: StdString; const Stream: TStream; const DestSurface: TPixelSurface; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare): Boolean; virtual; abstract;
Public function SaveToFile(const FileName: StdString; const SourceSurface: TPixelSurface; const Quality: Pointer = nil): Boolean; virtual; abstract;
Public function SaveToStream(const Extension: StdString; const Stream: TStream; const SourceSurface: TPixelSurface; const Quality: Pointer = nil): Boolean; virtual; abstract;

Description

Methods

Public function LoadFromAsset(const AssetName: StdString; const DestSurface: TPixelSurface; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare): Boolean; virtual; abstract;

Loads image from specified file located in /assets sub-folder. This function only works on Android platform.

Parameters
FileName
A valid file name (with extension) that represents the image.
DestSurface
The destination surface where image data will be saved. It does need to be a valid instance of TPixelSurface, but it may or may not be empty.
AlphaFormatRequest
The preference for premultipled or non-premultiplied alpha that should be used while loading the image. This is just a suggestion for the manager and it may or may not be followed depending on platform implementation.
Returns

True when successful or False otherwise.

Public function LoadFromFile(const FileName: StdString; const DestSurface: TPixelSurface; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare): Boolean; virtual; abstract;

Loads image from specified file.

Parameters
FileName
A valid file name (with extension) that includes full path that represents the image.
DestSurface
The destination surface where image data will be saved. It does need to be a valid instance of TPixelSurface, but it may or may not be empty.
AlphaFormatRequest
The preference for premultipled or non-premultiplied alpha that should be used while loading the image. This is just a suggestion for the manager and it may or may not be followed depending on platform implementation.
Returns

True when successful or False otherwise.

Public function LoadFromStream(const Extension: StdString; const Stream: TStream; const DestSurface: TPixelSurface; const AlphaFormatRequest: TAlphaFormatRequest = TAlphaFormatRequest.DontCare): Boolean; virtual; abstract;

Loads image from specified stream.

Parameters
Extension
Extension (including dot, e.g. ".png") that represents the format in which the image is stored in the stream.
Stream
Stream which will be used for reading the image from. The current position of the stream will be used and after the call it will be adjusted to be right at the end of image data.
DestSurface
The destination surface where image data will be saved. It does need to be a valid instance of TPixelSurface, but it may or may not be empty.
AlphaFormatRequest
The preference for premultipled or non-premultiplied alpha that should be used while loading the image. This is just a suggestion for the manager and it may or may not be followed depending on platform implementation.
Returns

True when successful or False otherwise.

Public function SaveToFile(const FileName: StdString; const SourceSurface: TPixelSurface; const Quality: Pointer = nil): Boolean; virtual; abstract;

Saves image to specified file.

Parameters
FileName
A valid file name (with extension) that includes full path where the image is to be saved. The path to this file must exist.
SourceSurface
The source surface where image data will be taken from. Note that the surface pixel format may determine the format in which the image will be saved. However, since not all pixel formats may be supported, the function may fail. Typically. TPixelFormat.A8R8G8B8 is the most widely supported format and should work under most circumstances.
Quality
Generic parameter that can be used as hint for saved image quality. For instance, for JPEG files, this is typically just an integer number (typecast to Pointer) representing quality between 0 and 100.
Returns

True when successful or False otherwise.

Public function SaveToStream(const Extension: StdString; const Stream: TStream; const SourceSurface: TPixelSurface; const Quality: Pointer = nil): Boolean; virtual; abstract;

Saves image to specified stream.

Parameters
Extension
Extension (including dot, e.g. ".png") that represents the format in which the image should be stored in the stream.
Stream
Stream which will be used for writing the image to. The current position of the stream will be used and after the call it will be adjusted to be right at the end of image data.
SourceSurface
The source surface where image data will be taken from. Note that the surface pixel format may determine the format in which the image will be saved. However, since not all pixel formats may be supported, the function may fail. Typically. TPixelFormat.A8R8G8B8 is the most widely supported format and should work under most circumstances.
Quality
Generic parameter that can be used as hint for saved image quality. For instance, for JPEG files, this is typically just an integer number (typecast to Pointer) representing quality between 0 and 100.
Returns

True when successful or False otherwise.


Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.