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 TUidPixelFormatDisplayModeToPixelFormat(TDisplayModeaDisplayMode)[static]

Convert from display mode to pixel format.

Parameters

TDisplayMode aDisplayModeDisplay mode to convert.

MinDataStride(TInt, TUidPixelFormat)

IMPORT_C TIntMinDataStride(TIntaWidth,
TUidPixelFormataPixelFormat
)[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 aWidthWidth in pixels of the buffer.
TUidPixelFormat aPixelFormatPixel format of the buffer.

PixelFormatToDisplayMode(TUidPixelFormat)

IMPORT_C TDisplayModePixelFormatToDisplayMode(TUidPixelFormataPixelFormat)[static]

Convert from pixel format to display mode.

Parameters

TUidPixelFormat aPixelFormatPixel format to convert.

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

IMPORT_C TIntTransferPixels(TAny *aDataAddressDest,
TIntaDataStrideDest,
TUidPixelFormataPixelFormatDest,
const TAny *aDataAddressSrc,
TIntaDataStrideSrc,
TUidPixelFormataPixelFormatSrc,
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 * aDataAddressDestThe base address of the destination pixel buffer.
TInt aDataStrideDestThe number of bytes between rows of data in the destination pixel buffer.
TUidPixelFormat aPixelFormatDestPixel format of the destination buffer.
const TAny * aDataAddressSrcThe base address of the source pixel buffer.
TInt aDataStrideSrcThe number of bytes between rows of data in the source pixel buffer.
TUidPixelFormat aPixelFormatSrcPixel format of the source buffer.
const TRect & aRectSourceRectangle of the source pixel buffer which will be transferred to the destination pixel buffer.