SgUtils Class Reference

class SgUtils

Set of utility functions. These functions are related to a number of Graphics APIs and provide functionality for converting from one pixel format to another, mapping from TDisplayMode to TUidPixelFormat and viceversa, and calculating data strides.

Member Functions Documentation

DisplayModeToPixelFormat(TDisplayMode)

IMPORT_C TUidPixelFormat DisplayModeToPixelFormat ( TDisplayMode aDisplayMode ) [static]

Convert from display mode to pixel format.

Parameters

TDisplayMode aDisplayMode Display mode to convert.

MinDataStride(TInt, TUidPixelFormat)

IMPORT_C TInt MinDataStride ( TInt aWidth,
TUidPixelFormat aPixelFormat
) [static]

Calculates the minimum number of bytes between rows of data in a bi-dimensional pixel buffer. The returned value is not guaranteed to be aligned onto any boundary.

Parameters

TInt aWidth Width in pixels of the buffer.
TUidPixelFormat aPixelFormat Pixel format of the buffer.

PixelFormatToDisplayMode(TUidPixelFormat)

IMPORT_C TDisplayMode PixelFormatToDisplayMode ( TUidPixelFormat aPixelFormat ) [static]

Convert from pixel format to display mode.

Parameters

TUidPixelFormat aPixelFormat Pixel format to convert.

TransferPixels(TAny *, TInt, TUidPixelFormat, const TAny *, TInt, TUidPixelFormat, const TRect &)

IMPORT_C TInt TransferPixels ( TAny * aDataAddressDest,
TInt aDataStrideDest,
TUidPixelFormat aPixelFormatDest,
const TAny * aDataAddressSrc,
TInt aDataStrideSrc,
TUidPixelFormat aPixelFormatSrc,
const TRect & aRectSource
) [static]

Transfer data from one bi-dimensional pixel buffer to another bi-dimensional pixel buffer with a different pixel format. The pixel format conversion may involve some data loss. This function currently supports the following pixel formats.
  • For the source: EUidPixelFormatRGB_565, EUidPixelFormatARGB_8888_PRE.

  • For the destination: EUidPixelFormatARGB_8888_PRE, EUidPixelFormatARGB_8888, EUidPixelFormatXRGB_8888, EUidPixelFormatRGB_888, EUidPixelFormatRGB_565, EUidPixelFormatXRGB_4444, EUidPixelFormatP_8, EUidPixelFormatL_8, EUidPixelFormatL_4, EUidPixelFormatP_4, EUidPixelFormatL_2, EUidPixelFormatL_1.

Parameters

TAny * aDataAddressDest The base address of the destination pixel buffer.
TInt aDataStrideDest The number of bytes between rows of data in the destination pixel buffer.
TUidPixelFormat aPixelFormatDest Pixel format of the destination buffer.
const TAny * aDataAddressSrc The base address of the source pixel buffer.
TInt aDataStrideSrc The number of bytes between rows of data in the source pixel buffer.
TUidPixelFormat aPixelFormatSrc Pixel format of the source buffer.
const TRect & aRectSource Rectangle of the source pixel buffer which will be transferred to the destination pixel buffer.