Bitmap Transform Library Overview

This document introduces you to the Bitmap Transform library.

Purpose

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.

DLL LIB Short Description

bitmaptransforms.dll

bitmaptransforms.lib

These files are used for implementing Bitmap Transform operation. But these files are not used for the enhanced functionality of encoder / decoder during bitmap transformation.

Architectural Relationship

Bitmap Transform is a member of the Imaging Frameworkss component.

Key Bitmap Transform Library Classes

The bitmap transform classes CBitmapRotator and CBitmapScaler provide image rotation and scaling as explained below:

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.

Description

Bitmap Transform enables two operations, rotating and scaling images.

Rotate 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:

    • 90 degrees (ERotation90DegreesClockwise)

    • 180 degrees (ERotation180DegreesClockwise)

    • 270 degrees (ERotation270DegreesClockwise)

    • Horizontal Flip (EMirrorHorizontalAxis)

    • Vertical Flip (EMirrorVerticalAxis)

Scale Images

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:

    • Minimum (EMinimumQuality)

    • Medium (EMediumQuality)

    • Maximum (EMaximumQuality)

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.

Using Bitmap Transform

Bitmap Transform is used for the following:

  • Rotating and mirroring bitmap images.

  • Scaling and resizing bitmap images.

Related concepts