CFbsDrawDevice Class Reference
class CFbsDrawDevice : public CBase |
Public Member Functions |
---|
TDisplayMode
| DisplayMode() |
IMPORT_C TDisplayMode | DisplayMode16M() |
TInt
| GetCustomPalette(CPalette *&) |
void | GetDrawRect(TRect &) |
TInt
| GetInterface(TInt, TAny *&) |
TInt
| HorzTwipsPerThousandPixels() |
TInt
| InitScreen() |
TInt
| LongWidth() |
void | MapColors(const TRect &, const TRgb *, TInt, TBool) |
IMPORT_C CFbsDrawDevice * | NewBitmapDeviceL(TScreenInfoV01, TDisplayMode, TInt) |
IMPORT_C CFbsDrawDevice * | NewBitmapDeviceL(const TSize &, TDisplayMode, TInt) |
IMPORT_C CFbsDrawDevice * | NewScreenDeviceL(TScreenInfoV01, TDisplayMode) |
IMPORT_C CFbsDrawDevice * | NewScreenDeviceL(TInt, TDisplayMode) |
void | OrientationsAvailable(TBool) |
void | ReadLine(TInt, TInt, TInt, TAny *, TDisplayMode) |
TRgb
| ReadPixel(TInt, TInt) |
TUint32 * | ScanLineBuffer() |
TInt
| ScanLineBytes() |
TDisplayMode
| ScanLineDisplayMode() |
void | SetAutoUpdate(TBool) |
void | SetBits(TAny *) |
TInt
| SetCustomPalette(const CPalette *) |
void | SetDisplayMode(CFbsDrawDevice *) |
void | SetDitherOrigin(const TPoint &) |
void | SetFadingParameters(TUint8, TUint8) |
TBool
| SetOrientation(TOrientation) |
void | SetShadowMode(TShadowMode) |
void | SetUserDisplayMode(TDisplayMode) |
void | ShadowArea(const TRect &) |
void | ShadowBuffer(TInt, TUint32 *) |
TSize
| SizeInPixels() |
void | SwapWidthAndHeight() |
void | Update() |
void | Update(const TRegion &) |
void | UpdateRegion(const TRect &) |
TInt
| VertTwipsPerThousandPixels() |
void | WriteBinary(TInt, TInt, TUint32 *, TInt, TInt, TRgb, CGraphicsContext::TDrawMode) |
void | WriteBinaryLine(TInt, TInt, TUint32 *, TInt, TRgb, CGraphicsContext::TDrawMode) |
void | WriteBinaryLineVertical(TInt, TInt, TUint32 *, TInt, TRgb, CGraphicsContext::TDrawMode, TBool) |
void | WriteLine(TInt, TInt, TInt, TUint32 *, CGraphicsContext::TDrawMode) |
void | WriteRgb(TInt, TInt, TRgb, CGraphicsContext::TDrawMode) |
void | WriteRgbAlphaLine(TInt, TInt, TInt, TUint8 *, TUint8 *, CGraphicsContext::TDrawMode) |
void | WriteRgbAlphaLine(TInt, TInt, TInt, const TUint8 *, const TUint8 *, const TUint8 *, CGraphicsContext::TDrawMode) |
void | WriteRgbAlphaMulti(TInt, TInt, TInt, TRgb, const TUint8 *) |
void | WriteRgbMulti(TInt, TInt, TInt, TInt, TRgb, CGraphicsContext::TDrawMode) |
Member Functions Documentation
DisplayMode()
Return the display mode of the device.
DisplayMode16M()
Depending on current graphics hardware the method will return one of two possible 16M video modes: EColor16M or EColor16MU. If the hardware doesn't support EColor16M or EColor16MU mode, the return value will be ENone.
Depending on the current graphics hardware this will return one of the 16M video modes defined in TDisplayMode, or ENone if a 16M video mode is not supported. TDisplayMode
GetCustomPalette(CPalette *&)
Retrieve a custom palette, if the bit format supports it.
GetDrawRect(TRect &)
void | GetDrawRect | ( | TRect & | aDrawRect | ) | const [pure virtual] |
Gets logical coordinates of the drawing rectangle. If the device is not scaled and with zero origin, logocal coordinates of the drawing rectangle are the same as its physical coordinates. If the device is rotated, drawing rectangle width and height are swapped. Always prefer GetDrawRect() to SizeInPixels() call. SizeInPixels() will return drawing rectangle width and height. But if the device is scaled or with nonzero origin, GetDrawRect() will take into account and the top-left corner of the drawing rectangle too, which may not be [0, 0].
Parameters
TRect & aDrawRect | Upon return aRect contains drawing rectangle logical coordinates. |
GetInterface(TInt, TAny *&)
TInt
| GetInterface | ( | TInt | aInterfaceId, |
| TAny *& | aInterface |
| ) | [pure virtual] |
Retrieves a pointer to the specified CFbsDrawDevice interface extension. BitDrawInterfaceId.h file for the IDs of supported interfaces
Parameters
TInt aInterfaceId | Interface identifier of the interface to be retrieved. |
TAny *& aInterface | Address of pointer variable that retrieves the specified interface. |
HorzTwipsPerThousandPixels()
TInt
| HorzTwipsPerThousandPixels | ( | ) | const [pure virtual] |
Allows the caller to calculate the physical size of a bitmap on the current hardware by calculating how many twips a 1000-pixel wide bitmap would be. Only applicable to screen-based devices; bitmap devices return 0.
InitScreen()
TInt
| InitScreen | ( | ) | [inline, virtual] |
Do any necessary initialisation on screen devices (default applies to bitmaps)
LongWidth()
TInt
| LongWidth | ( | ) | const [pure virtual] |
Scanline width in pixels. The return value can be greater or equal than iSize.iWidth, because the scan line memory is allocated in 32-bit words and can be rounded up, if the display mode allows more than 1 pixel to be stored in a single byte.
MapColors(const TRect &, const TRgb *, TInt, TBool)
void | MapColors | ( | const TRect & | aRect, |
| const TRgb * | aColors, |
| TInt | aNumPairs, |
| TBool | aMapForwards |
| ) | [pure virtual] |
Alter the colours within a defined rectangle according to the supplied mapping. The colour map is supplied as pairs of
TRgb objects. One member of the pair defines a colour value to match, the other defines a colour to replace that value by. Note that, for comparison purposes, smaller gamuts (e.g. 64K colour) are mapped to
TRgb form before comparison, so a colour that is not representable in the current display mode will not be matched. Pixels in the original that do not match an entry in the colour map are unchanged.
- panic
- EScreenDriverPanicOutOfBounds if aRect transforms back to illegal physical coordinates.
- panic
- EScreenDriverPanicNullPointer if aColors == NULL
- panic
- EScreenDriverPanicZeroLength if aNumPairs == 0
Parameters
const TRect & aRect | Area of the device/bitmap to be mapped in logical coordinates |
const TRgb * aColors | Colour map. This should be provided as a set of TRgb pairs, one to be matched and the other to provide a replacement. |
TInt aNumPairs | Number of pairs of colours in aColors. |
TBool aMapForwards | If ETrue, match the first colour of a pair and replace by the second, otherwise match the second and replace by the first. |
NewBitmapDeviceL(TScreenInfoV01, TDisplayMode, TInt)
NewBitmapDeviceL(const TSize &, TDisplayMode, TInt)
Creates a new bitmap device instance, which implements CFbsDrawDevice interface.
-
leave
- KErrNoMemory Not enough memory KErrArgument Invalid aSize value
Creates a new bitmap device instance, which implements
CFbsDrawDevice interface.
- leave
- KErrNoMemory Not enough memory KErrArgument Invalid aSize value
Parameters
const TSize & aSize | Bitmap device size |
TDisplayMode aDispMode | Requested display mode |
TInt aDataStride | Bitmap data stride |
NewScreenDeviceL(TScreenInfoV01, TDisplayMode)
NewScreenDeviceL(TInt, TDisplayMode)
Creates a new screen device instance, which implements
CFbsDrawDevice interface. The method has to be implemented for each type of supported video hardware.
- leave
- KErrNoMemory Not enough memory KErrNotSupported The requested screen device type is not supported
OrientationsAvailable(TBool)
void | OrientationsAvailable | ( | TBool | aOrientation | ) | [pure virtual] |
Reports on which orientations are available on the device/bitmap.
Parameters
TBool aOrientation | Array to receive the capability (use CFbsDrawDevice::TOrientation as an index) |
ReadLine(TInt, TInt, TInt, TAny *, TDisplayMode)
Reads a line of aLength pixels starting at [aX, aY] (in logical coordinates). The direction of reading is affected by the current orientation, and the "stride" taken in sampling pixels is affected by any scaling currently in force. Pixels are converted (if necessary) to the form specified by aDispMode before being written to the buffer. The entire line to be read must be within the physical bounds of the bitmap or device
- panic
- EScreenDriverPanicOutOfBounds if either end of the line is out of bounds
- panic
- EScreenDriverPanicNullPointer if aBuffer == NULL
- panic
- EScreenDriverPanicZeroLength if aLength == 0
Parameters
TInt aX | X coordinate of the pixel to start reading from (logical coordinates) |
TInt aY | Y coordinate of the pixel to start reading from(logical coordinates) |
TInt aLength | Number of pixels to read |
TAny * aBuffer | Buffer to receive the pixel data (must be large enough) |
TDisplayMode aDispMode | Format to use for writing pixels into the buffer. |
ReadPixel(TInt, TInt)
Get the colour of the pixel at the logical position [aX,aY]
- panic
- EScreenDriverPanicOutOfBounds if [aX,aY] transforms back to illegal physical coordinates.
Parameters
TInt aX | X-coordinate of pixel to read (logical coordinates) |
TInt aY | Y-coordinate of pixel to read (logical coordinates) |
ScanLineBuffer()
TUint32 * | ScanLineBuffer | ( | ) | const [pure virtual] |
Returns a pointer to a buffer large enough to read a line of pixels of maximum length. Ownership of the buffer is retained by the bitmap or device object. Repeated calls to this function will return the same buffer.
ScanLineBytes()
TInt
| ScanLineBytes | ( | ) | const [pure virtual] |
Scanline width in bytes. The return value may be greater than the actual number of bytes needed to store the pixels, since scan line memory is allocated in 32-bit words and can be rounded up.
SetAutoUpdate(TBool)
void | SetAutoUpdate | ( | TBool | aValue | ) | [inline, virtual] |
Sets or unsets auto-update for the screen.
Parameters
TBool aValue | ETrue, if the screen is set to auto-update; EFalse, otherwise. |
SetBits(TAny *)
void | SetBits | ( | TAny * | | ) | [inline, virtual] |
Set the internal data buffer to point to the supplied buffer. No checks are made that the buffer is appropriate for the purpose. Ownership is not taken.
SetCustomPalette(const CPalette *)
Set up a custom palette for those bit formats that support palettised colour
SetDisplayMode(CFbsDrawDevice *)
Copies all settings (scaling, orientation, etc.) from the supplied device and reinitialised the current device.
SetDitherOrigin(const TPoint &)
void | SetDitherOrigin | ( | const TPoint & | | ) | [inline, virtual] |
Set the origin point of the dither matrix (if appropriate)
SetFadingParameters(TUint8, TUint8)
Set the current fading parameters
SetOrientation(TOrientation)
Set the orientation of the device
SetShadowMode(TShadowMode)
SetUserDisplayMode(TDisplayMode)
Sets the user display mode - used for certain colour mapping functions
ShadowArea(const TRect &)
void | ShadowArea | ( | const TRect & | | ) | [inline, virtual] |
Apply shadow processing to all the pixels in the supplied rectangle
- panic
- EScreenDriverPanicOutOfBounds If any part of the rectangle maps to an illegal physical address
ShadowBuffer(TInt, TUint32 *)
Applies shadow processing to the supplied buffer
- panic
- EScreenDriverPanicZeroLength If aLength <= 0
- panic
- EScreenDriverPanicNullPointer If aBuffer == NULL
SizeInPixels()
TSize
| SizeInPixels | ( | ) | const [pure virtual] |
Returns the screen size in pixels, taking the orientation into account. Always prefer GetDrawRect() to SizeInPixels() call. GetDrawRect() will take into account possible non-[0,0] top-left corner of the drawing rectangle if the device is scaled.
SwapWidthAndHeight()
void | SwapWidthAndHeight | ( | ) | [pure virtual] |
The method swaps bitmap device's width and height. For example: if the size is (40, 20), the swapped size will be (20, 40). The device's content is not preserved. The method leaves CDrawBitmap object in a consistent state - scaling settings will be set with their default values (the scaling is switched off), iDitherOrigin will be set to (0,0), iOrigin to (0,0). Note: This method is used internally by BITGDI component. Do not call it!
Update()
void | Update | ( | ) | [inline, virtual] |
Update the screen with the update region.
Update(const TRegion &)
void | Update | ( | const TRegion & | | ) | [inline, virtual] |
Update the screen with the union of the update and specified regions.
UpdateRegion(const TRect &)
void | UpdateRegion | ( | const TRect & | | ) | [inline, virtual] |
Update the update region.
VertTwipsPerThousandPixels()
TInt
| VertTwipsPerThousandPixels | ( | ) | const [pure virtual] |
Allows the caller to calculate the physical size of a bitmap on the current hardware by calculating how many twips a 1000-pixel high bitmap would be. Only applicable to screen-based devices; bitmap devices return 0.
WriteBinary(TInt, TInt, TUint32 *, TInt, TInt, TRgb, CGraphicsContext::TDrawMode)
Combines the current content of the device/bitmap with a supplied colour, based on a bitmask and a draw mode. The bitmask is supplied as an array of TUint32s, one for each line (so there should be aHeight entries in the array). Since one word is used per line, aLength must be <= 32. Each bit of the mask controls one pixel - if the bit is 1, the pixel is combined with aColor, if the bit is 0, the pixel is left unchanged. Note that bits in the bitmask are examined in low-high order, so bit0 affects the pixel at aX, bit1 affects the pixel at aX+1 and so forth. If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
- panic
- EScreenDriverPanicOutOfBounds If any part of the rectangle maps to an illegal physical coordinate or if aLength > 32.
- panic
- EScreenDriverPanicNullPointer If aBuffer == NULL
- panic
- EScreenDriverPanicZeroLength If aLength <= 0
Parameters
TInt aX | Left edge of the rectangle (logical coordinates) |
TInt aY | Top edge of the rectangle (logical coordinates) |
TUint32 * aBuffer | Array of bitmasks - one per line |
TInt aLength | Width of the rectangle (must be >0 and <= 32) |
TInt aHeight | Height of the rectangle (== number of entries in aBuffer) |
TRgb aColor | Colour to combine with the existing pixel data |
CGraphicsContext::TDrawMode aDrawMode | Combination function for source and destination pixels. |
WriteBinaryLine(TInt, TInt, TUint32 *, TInt, TRgb, CGraphicsContext::TDrawMode)
Combines the current content of the device/bitmap with a supplied colour, based on a bitmask and a draw mode. This function differs from WriteBinary, in that aLength can be greater than 32, and the height is implicitly 1. aBuffer must contain sufficient elements to hold aLength bits If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
- panic
- EScreenDriverPanicOutOfBounds If any part of the line maps to an illegal physical coordinate
- panic
- EScreenDriverPanicNullPointer If aBuffer == NULL
- panic
- EScreenDriverPanicZeroLength If aLength <= 0
WriteBinary
Parameters
TInt aX | Starting X coordinate (logical coordinates) |
TInt aY | Starting Y coordinate (logical coordinates) |
TUint32 * aBuffer | Array of bitmasks |
TInt aLength | Number of pixels |
TRgb aColor | Colour to combine with existing pixels |
CGraphicsContext::TDrawMode aDrawMode | Combination function for source and destination pixels. |
WriteBinaryLineVertical(TInt, TInt, TUint32 *, TInt, TRgb, CGraphicsContext::TDrawMode, TBool)
Similar to WriteBinaryLine, but writes a vertical, rather than a horizontal line. LIne is drawn upward (decreasing Y) if aUp == ETrue. WriteBinaryLine
WriteLine(TInt, TInt, TInt, TUint32 *, CGraphicsContext::TDrawMode)
Combine the data in aBuffer with existing pixels along the line [aX,aY]-[aX+aLength,aY], using aDrawMode as the combining function. If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
- panic
- EScreenDriverPanicOutOfBounds If any part of the line maps to an illegal physical address
Parameters
TInt aX | Logical X coordinate of the start of the line. |
TInt aY | Logical Y coordinate of the line. |
TInt aLength | Source data - length in pixels. |
TUint32 * aBuffer | Source data. Must be in the format returned by ScanLineDisplayMode(). |
CGraphicsContext::TDrawMode aDrawMode | Combination function for source and destination pixels. |
WriteRgb(TInt, TInt, TRgb, CGraphicsContext::TDrawMode)
Write the given colour to the location [aX,aY], combining it with the existing pixel using aDrawMode If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
- panic
- EScreenDriverPanicOutOfBounds If [aX,aY] maps to an illegal physical address
Parameters
TInt aX | X coordinate (logical coordinates) |
TInt aY | Y coordinate (logical coordinates) |
TRgb aColor | Colour to write |
CGraphicsContext::TDrawMode aDrawMode | Combination function for source and destination pixels. |
WriteRgbAlphaLine(TInt, TInt, TInt, TUint8 *, TUint8 *, CGraphicsContext::TDrawMode)
The method performs an alpha blending of the source data - aRgbBuffer and screen pixels, using the data from aMaskBuffer buffer as an alpha blending factor. The formula used for that, is: (C1 * A + C2 * (255 - A)) / 255, where:
Parameters
TInt aX | Logical X coordinate of the start of the line. |
TInt aY | Logical Y coordinate of the line. |
TInt aLength | Source data - length in pixels. |
TUint8 * aRgbBuffer | A pointer to a line of the source bitmap data. Must be in ERgb format. |
TUint8 * aMaskBuffer | Buffer containing the data which should be used as an alpha blending factor. Must be in EGray256 format. |
CGraphicsContext::TDrawMode aDrawMode | Combination function for source and destination pixels. |
WriteRgbAlphaLine(TInt, TInt, TInt, const TUint8 *, const TUint8 *, const TUint8 *, CGraphicsContext::TDrawMode)
The method performs an alpha blending of the source data - aRgbBuffer1 and aBuffer2, using the data from aMaskBuffer buffer as an alpha blending factor. If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded. The formula used for that, is: (C1 * A + C2 * (255 - A)) / 255, where:
C1 - a pixel from aRgbBuffer1;
C2 - a pixel from aBuffer2;
A - a pixel from aMaskBuffer; The content of source and mask buffers is preserved. The calculated alpha blended pixel is written to the destination - the screen or a bitmap. If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
Parameters
TInt aX | Logical X coordinate of the position in the target the result should be drawn to. |
TInt aY | Logical Y coordinate of the position in the target the result should be drawn to. |
TInt aLength | Source data - length in pixels. |
const TUint8 * aRgbBuffer1 | A pointer to a line of the source bitmap data 1. Must be in ERgb format. |
const TUint8 * aBuffer2 | A pointer to a line of the source bitmap data 2. Must be in the format returned by ScanLineDisplayMode(). |
const TUint8 * aMaskBuffer | Buffer containing the data which should be used as an alpha blending factor. Must be in EGray256 format. |
CGraphicsContext::TDrawMode aDrawMode | Drawing mode |
WriteRgbAlphaMulti(TInt, TInt, TInt, TRgb, const TUint8 *)
Blend aColor with the pixels along the line [aX,aY]-[aX+aLength,aY], using aMaskBuffer as alpha data If the shadowing/fading flag is set, a shadow/fade copy of the source bitmap will be used.
- panic
- EScreenDriverPanicOutOfBounds If any part of the line maps to an illegal physical address
Parameters
TInt aX | Logical X coordinate of the start of the line |
TInt aY | Logical Y coordinate of the line. |
TInt aLength | Length of line to modify |
TRgb aColor | Colour to blend with existing pixels |
const TUint8 * aMaskBuffer | Buffer containing the data which should be used as an alpha blending factor. |
WriteRgbMulti(TInt, TInt, TInt, TInt, TRgb, CGraphicsContext::TDrawMode)
Write the given colour to the rectangle [aX,aY] - [aX+aLength,aY+aHeight], combining it with the exiasting pixels using aDrawMode If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
- panic
- EScreenDriverPanicOutOfBounds If any part of the rectangle maps to an illegal physical address
Parameters
TInt aX | X coordinate (logical coordinates) |
TInt aY | Y coordinate (logical coordinates) |
TInt aLength | Width of the rectangle (logical coordinates) |
TInt aHeight | Height of the rectangle (logical coordinates) |
TRgb aColor | Colour to write |
CGraphicsContext::TDrawMode aDrawMode | Combination function for source and destination pixels. |
Member Enumerations Documentation
Enum TOrientation
Defines possible rotation values
Enumerators
EOrientationNormal |
Normal orientation is supported.
|
EOrientationRotated90 |
A 90 degree rotation is supported.
|
EOrientationRotated180 |
A 180 degree rotation is supported.
|
EOrientationRotated270 |
A 270 degree rotation is supported.
|
Enum TShadowMode
Defines possible Shadowmode values
Enumerators
ENoShadow = 0x0 |
No Shadow mode is supported.
|
EShadow = 0x1 |
Shadow mode is supported.
|
EFade = 0x2 |
Faded mode is supported.
|
EShadowFade = 0x3 |
Shadow and faded mode is supported.
|
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.