This document introduces you to the Bitmap Transform library.
Allows images to be scaled or rotated. of course the image must be a bitmap, either the actual source file or after converting from some other format to a CFbsBitmap
object.
Bitmap Transform Library Details
The DLL that provides the functionality and the library to which your code must link is identified below.
Bitmap Transform is a member of the Imaging Frameworkss component.
The bitmap transform classes CBitmapRotator and CBitmapScaler provide image rotation and scaling as explained below:
Image Rotation:
CBitmapRotator::Rotate() rotates the image stored in a CFbsBitmap
object according to the CBitmapRotator::TRotationAngle selected and optionally either stores the resulting image in a new CFbsBitmap
or replaces the original.
Image Scaling:
CBitmapScaler provides scaling for the image stored in CFbsBitmap
object according to the size and CBitmapScaler::TQualityAlgorithm quality selected and optionally either stores the resulting image in a new CFbsBitmap
or replaces the original.
The scale and rotate actions are asynchronous operations that use the standard system of taking a pointer to a TRequestStatus
object, that is signalled on completion of the requested action. It is assumed that the client application or calling DLL will hold the TRequestStatus
values within active objects. The bitmap transform classes also make extensive use internally of active objects to provide asynchronous behaviour. As with any use of an active object it is necessary to have an active scheduler present in the same thread as the application making use of the object.
Note: Some more enhanced features are supported by the encoder and the decoder during the bitmap transformation, they are scaling, rotation / mirroring, cropping. For more information see, Tutorial About Enhanced Features for Encoder and Decoder.
Bitmap Transform enables two operations, rotating and scaling images.
This allows an image to be rotated as discussed below.
The application must supply the following details to rotate an image:
A CFbsBitmap
object representing the image to be rotated, flipped or mirrored
Optionally a second CFbsBitmap
object representing the destination image if the original is to be maintained or for whatever reason cannot be modified
The rotation angle (CBitmapRotator::TRotationAngle)
There are five possible rotation angles:
This allows an image to be scaled or resized.
The application must supply the following details for a scaling operation:
A CFbsBitmap
object representing the image to be scaled
Optionally a second CFbsBitmap
object representing the destination image if the original is to be maintained or for whatever reason cannot be modified.
The target size (TSize
)
The size parameter is expressed as a width and height in pixels.
Aspect ratio indicator
The aspect ratio is maintained by default (TBool aMaintainAspectRatio =
ETrue
). Disabling this (aMaintainAspectRatio
= EFalse
) may result in the image stretching in one direction.
A scaling quality and speed preference (CBitmapScaler::TQualityAlgorithm)
There are three scaling settings available representing the image quality and scaling speed, they are:
To rotate or scale an image, it must be decoded and stored in a CFbsBitmap
object. Some decoder supports enhanced functionality in transformation. For more information see, Tutorial About Enhanced Features for Encoder and Decoder.