CWindowGc Class Reference

class CWindowGc : public CBitmapContext

Window graphics context.

Most window graphics context drawing functions map to equivalent CFbsBitGc functions. They are implemented on the screen with any co-ordinates being relative to the top left corner of the window. However extra clipping is applied. The drawing will always be clipped to the visible part of the window. In addition it will be clipped to the non-invalid part if you are not doing a redraw and to the region being validated if you are doing a redraw.

Note:

In general, server side functions which encounter conditions which would normally cause a leave, do not leave but instead return an error value indicating the leave condition. In this way the leave can be handled on the appropriate side of the client/server boundary. For example, a client can choose to wrap server calls with User::LeaveIfError(), which causes a leave with the specified error.

The above advice is true of many functions in this class, and in its derived classes.

CGraphicsContext

Public Member Functions
CWindowGc(CWsScreenDevice *)
~CWindowGc()
IMPORT_C voidActivate(RDrawableWindow &)
IMPORT_C TIntAlphaBlendBitmaps(const TPoint &, const CFbsBitmap *, const TRect &, const CFbsBitmap *, const TPoint &)
IMPORT_C TIntAlphaBlendBitmaps(const TPoint &, const CWsBitmap *, const TRect &, const CWsBitmap *, const TPoint &)
IMPORT_C voidBitBlt(const TPoint &, const CFbsBitmap *)
IMPORT_C voidBitBlt(const TPoint &, const CFbsBitmap *, const TRect &)
IMPORT_C voidBitBlt(const TPoint &, const CWsBitmap *)
IMPORT_C voidBitBlt(const TPoint &, const CWsBitmap *, const TRect &)
IMPORT_C voidBitBltMasked(const TPoint &, const CFbsBitmap *, const TRect &, const CFbsBitmap *, TBool)
IMPORT_C voidBitBltMasked(const TPoint &, const CWsBitmap *, const TRect &, const CWsBitmap *, TBool)
IMPORT_C voidCancelClippingRect()
IMPORT_C voidCancelClippingRegion()
IMPORT_C voidClear()
IMPORT_C voidClear(const TRect &)
IMPORT_C TIntConstruct()
IMPORT_C voidCopyRect(const TPoint &, const TRect &)
IMPORT_C voidDeactivate()
IMPORT_C CGraphicsDevice *Device()
IMPORT_C voidDiscardBrushPattern()
IMPORT_C voidDiscardFont()
IMPORT_C voidDrawArc(const TRect &, const TPoint &, const TPoint &)
IMPORT_C voidDrawBitmap(const TPoint &, const CFbsBitmap *)
IMPORT_C voidDrawBitmap(const TRect &, const CFbsBitmap *)
IMPORT_C voidDrawBitmap(const TRect &, const CFbsBitmap *, const TRect &)
IMPORT_C voidDrawBitmapMasked(const TRect &, const CFbsBitmap *, const TRect &, const CFbsBitmap *, TBool)
IMPORT_C voidDrawBitmapMasked(const TRect &, const CWsBitmap *, const TRect &, const CWsBitmap *, TBool)
IMPORT_C voidDrawEllipse(const TRect &)
IMPORT_C voidDrawLine(const TPoint &, const TPoint &)
IMPORT_C voidDrawLineBy(const TPoint &)
IMPORT_C voidDrawLineTo(const TPoint &)
IMPORT_C voidDrawPie(const TRect &, const TPoint &, const TPoint &)
IMPORT_C voidDrawPolyLine(const CArrayFix< TPoint > *)
IMPORT_C voidDrawPolyLine(const TPoint *, TInt)
IMPORT_C TIntDrawPolygon(const CArrayFix< TPoint > *, TFillRule)
IMPORT_C TIntDrawPolygon(const TPoint *, TInt, TFillRule)
IMPORT_C voidDrawRect(const TRect &)
IMPORT_C voidDrawRoundRect(const TRect &, const TSize &)
IMPORT_C voidDrawText(const TDesC &, const TPoint &)
IMPORT_C voidDrawText(const TDesC &, const TRect &, TInt, TTextAlign, TInt)
IMPORT_C voidDrawTextVertical(const TDesC &, const TPoint &, TBool)
IMPORT_C voidDrawTextVertical(const TDesC &, const TRect &, TInt, TBool, TTextAlign, TInt)
IMPORT_C voidDrawWsGraphic(const TWsGraphicId &, const TRect &)
IMPORT_C voidDrawWsGraphic(const TWsGraphicId &, const TRect &, const TDesC8 &)
IMPORT_C TAny *Interface(TUid)
IMPORT_C const TAny *Interface(TUid)
IMPORT_C voidMapColors(const TRect &, const TRgb *, TInt, TBool)
IMPORT_C voidMoveBy(const TPoint &)
IMPORT_C voidMoveTo(const TPoint &)
IMPORT_C voidPlot(const TPoint &)
IMPORT_C voidReset()
IMPORT_C voidSetBrushColor(const TRgb &)
IMPORT_C voidSetBrushOrigin(const TPoint &)
IMPORT_C voidSetBrushStyle(TBrushStyle)
IMPORT_C voidSetCharJustification(TInt, TInt)
IMPORT_C voidSetClippingRect(const TRect &)
IMPORT_C TIntSetClippingRegion(const TRegion &)
IMPORT_C voidSetDitherOrigin(const TPoint &)
IMPORT_C voidSetDrawMode(TDrawMode)
IMPORT_C voidSetFaded(TBool)
IMPORT_C voidSetFadingParameters(TUint8, TUint8)
IMPORT_C voidSetOpaque(TBool)
IMPORT_C voidSetOrigin(const TPoint &)
IMPORT_C voidSetPenColor(const TRgb &)
IMPORT_C voidSetPenSize(const TSize &)
IMPORT_C voidSetPenStyle(TPenStyle)
IMPORT_C voidSetStrikethroughStyle(TFontStrikethrough)
IMPORT_C voidSetUnderlineStyle(TFontUnderline)
IMPORT_C voidSetWordJustification(TInt, TInt)
IMPORT_C voidUseBrushPattern(const CFbsBitmap *)
IMPORT_C voidUseFont(const CFont *)
Protected Member Functions
IMPORT_C TIntAPIExtension(TUid, TAny *&, TAny *)
Private Member Functions
TInt APIExDrawText(const TDesC &, const TTextParameters *, const TPoint &)
TInt APIExDrawText(const TDesC &, const TTextParameters *, const TRect &, TInt, TTextAlign, TInt)
TInt APIExDrawTextVertical(const TDesC &, const TTextParameters *, const TPoint &, TBool)
TInt APIExDrawTextVertical(const TDesC &, const TTextParameters *, const TRect &, TInt, TBool, TTextAlign, TInt)
TInt APIExGetShadowColor(TAny *&)
TInt APIExGetUnderlineMetrics(TAny *&)
TInt APIExInterface(TAny *&, TUid)
TInt APIExSetShadowColor(TAny *)
TRgb Color(TInt)
voidDrawArcOrPie(const TRect &, const TPoint &, const TPoint &, TInt)
voidDrawResource(const TPoint &, const RWsDrawableSource &, TGraphicsRotation)
voidDrawResource(const TRect &, const RWsDrawableSource &, TGraphicsRotation)
voidDrawResource(const TRect &, const RWsDrawableSource &, const TRect &, TGraphicsRotation)
voidDrawResource(const TRect &, const RWsDrawableSource &, const TDesC8 &)
IMPORT_C voidReserved_CBitmapContext_1()
IMPORT_C voidReserved_CBitmapContext_2()
IMPORT_C voidReserved_CBitmapContext_3()
IMPORT_C voidReserved_CGraphicsContext_2()
IMPORT_C voidReserved_CWindowGc_3()
IMPORT_C voidReserved_CWindowGc_4()
IMPORT_C voidReserved_CWindowGc_5()
voidSetJustification(TInt, TInt, TInt)
voidWriteTextCommand(TAny *, TInt, const TDesC &, TInt, TInt)
voidWriteTextCommand(TAny *, TInt, const TDesC8 &, TInt, TInt)
voidWriteTextPos(TInt, TInt, const TPoint &, const TDesC &)
voiddoDrawPolyLine(const CArrayFix< TPoint > *, const TPoint *, TInt)
TInt doDrawPolygon(const CArrayFix< TPoint > *, const TPoint *, TInt, TFillRule)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CGraphicsContext::DrawText(const TDesC &,const TPoint &,const TDrawTextParam &)
CGraphicsContext::DrawText(const TDesC &,const TTextParameters *,const TPoint &)
CGraphicsContext::DrawText(const TDesC &,const TTextParameters *,const TPoint &,const TDrawTextParam &)
CGraphicsContext::DrawText(const TDesC &,const TTextParameters *,const TRect &,TInt,TTextAlign,TInt)
CGraphicsContext::DrawTextExtended(const TDesC &,const TPoint &,const TDrawTextExtendedParam &)
CGraphicsContext::DrawTextExtended(const TDesC &,const TTextParameters *,const TPoint &,const TDrawTextExtendedParam &)
CGraphicsContext::DrawTextVertical(const TDesC &,const TTextParameters *,const TPoint &,TBool)
CGraphicsContext::DrawTextVertical(const TDesC &,const TTextParameters *,const TRect &,TInt,TBool,TTextAlign,TInt)
CGraphicsContext::GetShadowColor(TRgb &)
CGraphicsContext::GetUnderlineMetrics(TInt &,TInt &)
CGraphicsContext::IsFbsBitGc()const
CGraphicsContext::JustificationInPixels(TInt &,TInt &)
CGraphicsContext::JustificationInPixels(TInt,TInt,TInt,TInt)
CGraphicsContext::Reserved()
CGraphicsContext::SetShadowColor(const TRgb &)
Public Member Enumerations
enumTGraphicsRotation { EGraphicsRotationNone, EGraphicsRotation90, EGraphicsRotation180, EGraphicsRotation270 }
Inherited Enumerations
CGraphicsContext:TBrushStyle
CGraphicsContext:TDrawMode
CGraphicsContext:TDrawModeComponents
CGraphicsContext:TFillRule
CGraphicsContext:TPenStyle
CGraphicsContext:TTextAlign
Private Attributes
CWsScreenDevice *iDevice
CPimpl *iPimpl

Constructor & Destructor Documentation

CWindowGc(CWsScreenDevice *)

IMPORT_CCWindowGc(CWsScreenDevice *aDevice)

Constructor which creates, but does not initialise a graphics context.

CWsScreenDevice::CreateContext()

Parameters

CWsScreenDevice * aDeviceAny screen device owned by the same session. Its life time should be at least as long as the gc itself.

~CWindowGc()

IMPORT_C~CWindowGc()[virtual]

Destructor.

Member Functions Documentation

APIExDrawText(const TDesC &, const TTextParameters *, const TPoint &)

TInt APIExDrawText(const TDesC &aBuf,
const TTextParameters *aParam,
const TPoint &aPos
)[private]

Parameters

const TDesC & aBuf
const TTextParameters * aParam
const TPoint & aPos

APIExDrawText(const TDesC &, const TTextParameters *, const TRect &, TInt, TTextAlign, TInt)

TInt APIExDrawText(const TDesC &aBuf,
const TTextParameters *aParam,
const TRect &aBox,
TIntaBaselineOffset,
TTextAlignaHoriz = ELeft,
TIntaLeftMrg = 0
)[private]

Parameters

const TDesC & aBuf
const TTextParameters * aParam
const TRect & aBox
TInt aBaselineOffset
TTextAlign aHoriz = ELeft
TInt aLeftMrg = 0

APIExDrawTextVertical(const TDesC &, const TTextParameters *, const TPoint &, TBool)

TInt APIExDrawTextVertical(const TDesC &aText,
const TTextParameters *aParam,
const TPoint &aPos,
TBoolaUp
)[private]

Parameters

const TDesC & aText
const TTextParameters * aParam
const TPoint & aPos
TBool aUp

APIExDrawTextVertical(const TDesC &, const TTextParameters *, const TRect &, TInt, TBool, TTextAlign, TInt)

TInt APIExDrawTextVertical(const TDesC &aText,
const TTextParameters *aParam,
const TRect &aBox,
TIntaBaselineOffset,
TBoolaUp,
TTextAlignaVert = ELeft,
TIntaMargin = 0
)[private]

Parameters

const TDesC & aText
const TTextParameters * aParam
const TRect & aBox
TInt aBaselineOffset
TBool aUp
TTextAlign aVert = ELeft
TInt aMargin = 0

APIExGetShadowColor(TAny *&)

TInt APIExGetShadowColor(TAny *&aOutput)[private]

Parameters

TAny *& aOutput

APIExGetUnderlineMetrics(TAny *&)

TInt APIExGetUnderlineMetrics(TAny *&aOutput)[private]

Parameters

TAny *& aOutput

APIExInterface(TAny *&, TUid)

TInt APIExInterface(TAny *&aInterface,
TUidaInterfaceId
)[private]

Parameters

TAny *& aInterface
TUid aInterfaceId

APIExSetShadowColor(TAny *)

TInt APIExSetShadowColor(TAny *aShadowColor)[private]

Parameters

TAny * aShadowColor

APIExtension(TUid, TAny *&, TAny *)

IMPORT_C TIntAPIExtension(TUidaUid,
TAny *&aOutput,
TAny *aInput
)[protected, virtual]

APIExtension can contain as many additional methods as is required by CGraphicsContext after its original conception. It takes 3 parameters. Function is exported due to constrains of retaining BC with earlier versions. This is not used directly by external methods, instead it is called by a named method in CGraphicsContext which passes the relivant arguements including an unique identifier for the required action. Valid Uid identifiers are listed in header gdi.h CGraphicsContext

Parameters

TUid aUidThe unique identifier for the method that is required. Selected internally by a series of "if" statements.
TAny *& aOutputis a TAny pointer to a reference. Used to output data as the structure does not need to be instantiated before the function call this adds greater flexibility.
TAny * aInputis a TAny pointer used to input data.

Activate(RDrawableWindow &)

IMPORT_C voidActivate(RDrawableWindow &aDevice)[virtual]

Activates the context for a given window and updates iDevice with the pointer to the screen device of the screen on which aDevice is found.

When drawing is complete, the code using the context should call Deactivate(). Draw methods invoked after an Activate() will affect the window specified. A graphics context can only be active for one window at a time. A panic occurs if a draw function is called before calling this function, or if Activate() is called twice without an intervening Deactivate().

Parameters

RDrawableWindow & aDevice

AlphaBlendBitmaps(const TPoint &, const CFbsBitmap *, const TRect &, const CFbsBitmap *, const TPoint &)

IMPORT_C TIntAlphaBlendBitmaps(const TPoint &aDestPt,
const CFbsBitmap *aSrcBmp,
const TRect &aSrcRect,
const CFbsBitmap *aAlphaBmp,
const TPoint &aAlphaPt
)[virtual]
Performs an alpha blending of the source data, aSrcBmp, with the window, using the data from aAlphaBmp as an alpha blending factor. The formula used is: (S * A + W * (255 - A)) / 255, where:
  • S - a pixel from aSrcBmp;

  • W - a pixel from the window;

  • A - a pixel from aAlphaBmp; The contents of source and alpha bitmap are preserved. The calculated alpha blended pixels are written to the destination - the window image. The effect of this function when applied to transparent pixels when the opaque flag is set is undefined. See SetOpaque().

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

This method is supported from version 8.1 CFbsBitGc::AlphaBlendBitmaps()

Parameters

const TPoint & aDestPtPosition in the target the result should be drawn to.
const CFbsBitmap * aSrcBmpA pointer to the source bitmap.
const TRect & aSrcRectThe part of the source bitmap that should be used.
const CFbsBitmap * aAlphaBmpA pointer to the bitmap used as an alpha blending factor.
const TPoint & aAlphaPtPosition of the first pixel in the alpha bitmap that should be used as a source for the alpha blending. The size of the area is the same as the source bitmap area - aSrcRect parameter.

AlphaBlendBitmaps(const TPoint &, const CWsBitmap *, const TRect &, const CWsBitmap *, const TPoint &)

IMPORT_C TIntAlphaBlendBitmaps(const TPoint &aDestPt,
const CWsBitmap *aSrcBmp,
const TRect &aSrcRect,
const CWsBitmap *aAlphaBmp,
const TPoint &aAlphaPt
)[virtual]

The method performs an alpha blending of the source data, aSrcBmp, with the window, using the data from aAlphaBmp as an alpha blending factor. For information on how this function works, see the other overload.

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

This method is supported from version 8.1 CFbsBitGc::AlphaBlendBitmaps()

Parameters

const TPoint & aDestPtPosition in the target the result should be drawn to.
const CWsBitmap * aSrcBmpA pointer to the source bitmap.
const TRect & aSrcRectThe part of the source bitmap that should be used.
const CWsBitmap * aAlphaBmpA pointer to the bitmap used as an alpha blending factor.
const TPoint & aAlphaPtPosition of the first pixel in the alpha bitmap that should be used as a source for the alpha blending. The size of the area is the same as the source bitmap area - aSrcRect parameter.

BitBlt(const TPoint &, const CFbsBitmap *)

IMPORT_C voidBitBlt(const TPoint &aPos,
const CFbsBitmap *aBitmap
)[virtual]

Performs a bitmap block transfer.

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

CBitmapContext::BitBlt()

Parameters

const TPoint & aPosThe position for the top left corner of the bitmap.
const CFbsBitmap * aBitmapA memory-resident bitmap.

BitBlt(const TPoint &, const CFbsBitmap *, const TRect &)

IMPORT_C voidBitBlt(const TPoint &aDestination,
const CFbsBitmap *aBitmap,
const TRect &aSource
)[virtual]

Performs a bitmap block transfer of a rectangular piece of a bitmap.

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

Note: if the rectangle aSource is larger than the bitmap then the bitmap will be padded with white.

CBitmapContext::BitBlt()

Parameters

const TPoint & aDestinationThe position for the top left corner of the bitmap.
const CFbsBitmap * aBitmapA memory-resident bitmap
const TRect & aSourceA rectangle defining the piece of the bitmap to be drawn, with co-ordinates relative to the top left corner of the bitmap

BitBlt(const TPoint &, const CWsBitmap *)

IMPORT_C voidBitBlt(const TPoint &aPoint,
const CWsBitmap *aBitmap
)[virtual]

Performs a bitmap block transfer on a bitmap to which the window server already has a handle.

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

This function should be used in preference to the CFbsBitmap overload if the bitmap is to be used more than once, as it is a lot quicker.

CBitmapContext::BitBlt()

Parameters

const TPoint & aPointThe position for the top left corner of the bitmap.
const CWsBitmap * aBitmapA window server bitmap.

BitBlt(const TPoint &, const CWsBitmap *, const TRect &)

IMPORT_C voidBitBlt(const TPoint &aDestination,
const CWsBitmap *aBitmap,
const TRect &aSource
)[virtual]

Performs a bitmap block transfer of a rectangular piece of a bitmap to which the window server already has a handle.

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

This function should be used in preference to the CFbsBitmap overload if the bitmap is to be used more than once, as it is a lot quicker.

Note: if the rectangle aSource is larger than the bitmap then the bitmap will be padded with white.

CBitmapContext::BitBlt()

Parameters

const TPoint & aDestinationThe position for the top left corner of the bitmap.
const CWsBitmap * aBitmapA window server bitmap.
const TRect & aSourceA rectangle defining the piece of the bitmap to be drawn, with co-ordinates relative to the top left corner of the bitmap

BitBltMasked(const TPoint &, const CFbsBitmap *, const TRect &, const CFbsBitmap *, TBool)

IMPORT_C voidBitBltMasked(const TPoint &aPoint,
const CFbsBitmap *aBitmap,
const TRect &aSourceRect,
const CFbsBitmap *aMaskBitmap,
TBoolaInvertMask
)[virtual]

Performs a masked bitmap block transfer of a memory resident source bitmap.

The mask bitmap can be used as either a positive or negative mask. Masked pixels are not mapped to the destination rectangle.

A black and white (binary) mask bitmap is used. With aInvertMask=EFalse, black pixels in the mask bitmap stop corresponding pixels in the source bitmap from being transferred to the destination rectangle. With aInvertMask=ETrue, white pixels in the mask bitmap stop corresponding pixels in the source bitmap from being transferred to the destination rectangle.

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

CBitmapContext::BitBltMasked()

Parameters

const TPoint & aPointA position for the top left corner of the bitmap.
const CFbsBitmap * aBitmapA memory-resident source bitmap.
const TRect & aSourceRectA rectangle defining the piece of the bitmap to be drawn, with co-ordinates relative to the top left corner of the bitmap
const CFbsBitmap * aMaskBitmapA mask bitmap.
TBool aInvertMaskIf false, a source pixel that is masked by a black pixel is not transferred to the destination rectangle. If true, then a source pixel that is masked by a white pixel is not transferred to the destination rectangle.

BitBltMasked(const TPoint &, const CWsBitmap *, const TRect &, const CWsBitmap *, TBool)

IMPORT_C voidBitBltMasked(const TPoint &aPoint,
const CWsBitmap *aBitmap,
const TRect &aSourceRect,
const CWsBitmap *aMaskBitmap,
TBoolaInvertMask
)[virtual]

Performs a masked bitmap block transfer of a window server bitmap.

The mask bitmap can be used as either a positive or negative mask. Masked pixels are not mapped to the destination rectangle.

A black and white (binary) mask bitmap is used. With aInvertMask=EFalse, black pixels in the mask bitmap stop corresponding pixels in the source bitmap from being transferred to the destination rectangle. With aInvertMask=ETrue, white pixels in the mask bitmap stop corresponding pixels in the source bitmap from being transferred to the destination rectangle.

This function should be used in preference to the CFbsBitmap overload if the bitmap is to be used more than once, as it is a lot quicker.

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

CBitmapContext::BitBltMasked()

Parameters

const TPoint & aPointA position for the top left corner of the bitmap.
const CWsBitmap * aBitmapA window server bitmap.
const TRect & aSourceRectA rectangle defining the piece of the bitmap to be drawn, with co-ordinates relative to the top left corner of the bitmap.
const CWsBitmap * aMaskBitmapA window server mask bitmap.
TBool aInvertMaskIf false, a source pixel that is masked by a black pixel is not transferred to the destination rectangle. If true, then a source pixel that is masked by a white pixel is not transferred to the destination rectangle.

CancelClippingRect()

IMPORT_C voidCancelClippingRect()[virtual]

Cancels the clipping rectangle.

SetClippingRect()

CancelClippingRegion()

IMPORT_C voidCancelClippingRegion()[virtual]

Cancels the current clipping region.

Clear()

IMPORT_C voidClear()[virtual]

Clears the whole window.

The cleared area is filled with the current brush colour.

CBitmapContext::Clear()

Clear(const TRect &)

IMPORT_C voidClear(const TRect &aRect)[virtual]

Clears a rectangular area of a window.

The cleared area is filled with the current brush colour.

CBitmapContext::Clear()

Parameters

const TRect & aRectThe rectangle to clear.

Color(TInt)

TRgb Color(TIntaOpcode)const [private]

Parameters

TInt aOpcode

Construct()

IMPORT_C TIntConstruct()[virtual]

Completes construction.

panic
TW32Panic 17 in debug builds if called on an already constructed object. This function always causes a flush of the window server buffer.

CopyRect(const TPoint &, const TRect &)

IMPORT_C voidCopyRect(const TPoint &anOffset,
const TRect &aRect
)[virtual]

Copies a rectangle from any part of the screen into the window that the gc is active on.

The copy part of the operation applies to the whole rectangle, irrespective of whether or not it within the window, however the "paste" is clipped to the drawing area.

The rectangle is specified in window coordinates (if the top-left of the rectangle is (0,0) then the area of the screen it specifies has its top-left at the top left corner of the window, if it is (-10,-10) then it starts 10 pixels above and to the left of the window).

Note: shadows in the source rectangle will be copied. None of the area drawn to will gain shadowing (even if the window is already in shadow).

This version of this function is only really suitable for testing.

CBitmapContext::CopyRect()

Parameters

const TPoint & anOffsetThe offset from the original position to the point where the rectangle is copied.
const TRect & aRectThe rectangular area to be copied. This is in window co-ordinates, e.g. the top left corner of the window is position (0,0) with respect to the rectangle.

Deactivate()

IMPORT_C voidDeactivate()[virtual]

Frees the graphics context to be used with another window.

This method should be called when the application has completed drawing to the window.

Device()

IMPORT_C CGraphicsDevice *Device()const [virtual]

Returns a pointer to the device, more specifically a CWsScreenDevice, for the screen that the WindowGc was last activated on. If the WindowGc has not been activated at all, it then returns the device that was passed to its constructor.

The user should be careful when calling this function since it can return the screen device of any screen in the system. Hence, the return value of this function will be useful only if the user is aware of how the WindowGc was used before this function is called.

DiscardBrushPattern()

IMPORT_C voidDiscardBrushPattern()[virtual]

Discards a non-built-in brush pattern.

This frees up the memory used for the bitmap, if it is not being shared by another process.

If no brush pattern has been set when this function is called, it has no effect.

CGraphicsContext::DiscardBrushPattern()

DiscardFont()

IMPORT_C voidDiscardFont()[virtual]

Discards a font.

This frees up the memory used (if the font is not being shared with some other process).

Note that if no font is in use when this function is called, then there is no effect.

CGraphicsContext::DiscardFont()

DrawArc(const TRect &, const TPoint &, const TPoint &)

IMPORT_C voidDrawArc(const TRect &aRect,
const TPoint &aStart,
const TPoint &aEnd
)[virtual]

Draws an arc (a portion of an ellipse).

The point aStart is used to define one end of a line from the geometric centre of the ellipse. The point of intersection between this line and the ellipse defines the start point of the arc. The point aEnd is used to define one end of a second line from the geometric centre of the ellipse. The point of intersection between this line and the ellipse defines the end point of the arc. The pixels at both the start point and the end point are drawn.

The arc itself is the segment of the ellipse in an anti-clockwise direction from the start point to the end point.

Notes

A rectangle is used in the construction of the ellipse of which the arc is a segment. This rectangle is passed as an argument of type TRect.

A wide line arc is drawn with the pixels distributed either side of a true ellipse, in such a way that the outer edge of the line would touch the edge of the construction rectangle. In other words, the ellipse used to construct it is slightly smaller than that for a single pixel line size.

If aStart or aEnd are the ellipse centre then the line that defines the start/end of the arc defaults to one extending vertically above the centre point.

If aStart and aEnd are the same point, or points on the same line through the ellipse centre then a complete unfilled ellipse is drawn.

Line drawing is subject to pen colour, width and style and draw mode

CGraphicsContext::DrawArc()

Parameters

const TRect & aRectThe rectangle in which to draw the ellipse (of which the arc is a segment).
const TPoint & aStartA point to define the start of the arc.
const TPoint & aEndA point to define the end of the arc.

DrawArcOrPie(const TRect &, const TPoint &, const TPoint &, TInt)

voidDrawArcOrPie(const TRect &aRect,
const TPoint &aStart,
const TPoint &aEnd,
TIntaOpcode
)[private]

Parameters

const TRect & aRect
const TPoint & aStart
const TPoint & aEnd
TInt aOpcode

DrawBitmap(const TPoint &, const CFbsBitmap *)

IMPORT_C voidDrawBitmap(const TPoint &aTopLeft,
const CFbsBitmap *aDevice
)[virtual]

Draws a bitmap at a specified point.

The function does a compress/stretch based on its internally stored size in twips. Note that if the twips value of the bitmap is not set then nothing is drawn (this is the default situation).

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

Note: this member function uses the bitmap's size in twips and does a stretch/compress blit using a linear DDA.

CGraphicsContext::DrawBitmap()

Parameters

const TPoint & aTopLeftThe point where the top left pixel of the bitmap is to be drawn
const CFbsBitmap * aDeviceThe source bitmap.

DrawBitmap(const TRect &, const CFbsBitmap *)

IMPORT_C voidDrawBitmap(const TRect &aDestRect,
const CFbsBitmap *aDevice
)[virtual]

Draws a bitmap in a rectangle.

The bitmap is compressed/stretched to fit the specified rectangle. Note that if the twips value of the bitmap is not set then nothing is drawn (this is the default situation).

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

Notes: this member function uses the bitmap's size in pixels and does a stretch/compress blit using a linear DDA.

CGraphicsContext::DrawBitmap()

Parameters

const TRect & aDestRectThe rectangle within which the bitmap is to be drawn.
const CFbsBitmap * aDeviceThe source bitmap.

DrawBitmap(const TRect &, const CFbsBitmap *, const TRect &)

IMPORT_C voidDrawBitmap(const TRect &aDestRect,
const CFbsBitmap *aDevice,
const TRect &aSourceRect
)[virtual]

Draws a specified rectangle from a bitmap into another rectangle.

The function compresses/stretches the specified rectangle from the bitmap to fit the destination rectangle. Note that if the twips value of the bitmap is not set then nothing is drawn (this is the default situation).

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

Note: this member function uses rectangle sizes in pixels and does a stretch/compress blit using a linear DDA.

CGraphicsContext::DrawBitmap()

Parameters

const TRect & aDestRectThe rectangle within which the bitmap is to be drawn.
const CFbsBitmap * aDeviceA source bitmap.
const TRect & aSourceRectThe rectangle in the source bitmap that is copied to the destination rectangle.

DrawBitmapMasked(const TRect &, const CFbsBitmap *, const TRect &, const CFbsBitmap *, TBool)

IMPORT_C voidDrawBitmapMasked(const TRect &aDestRect,
const CFbsBitmap *aBitmap,
const TRect &aSourceRect,
const CFbsBitmap *aMaskBitmap,
TBoolaInvertMask
)[virtual]

Draws a specified rectangle from a bitmap and its mask into another rectangle.

The function compresses/stretches the specified rectangle from the bitmap to fit the destination rectangle. The mask bitmap can be used as either a positive or negative mask. Masked pixels are not mapped to the destination rectangle.

A black and white (binary) mask bitmap is used. With aInvertMask=EFalse, black pixels in the mask bitmap stop corresponding pixels in the source bitmap from being transferred to the destination rectangle. With aInvertMask=ETrue, white pixels in the mask bitmap stop corresponding pixels in the source bitmap from being transferred to the destination rectangle.

If mask bitmap's display mode is EColor256, the function does AplhaBlending and ignores aInvertMask parameter.

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

Note: this member function uses rectangle sizes in pixels and does a stretch/compress blit using a linear DDA.

Parameters

const TRect & aDestRectThe rectangle within which the masked bitmap is to be drawn.
const CFbsBitmap * aBitmapA source bitmap.
const TRect & aSourceRectThe rectangle in the source bitmap that is copied to the destination rectangle.
const CFbsBitmap * aMaskBitmapA mask bitmap.
TBool aInvertMaskIf false, a source pixel that is masked by a black pixel is not transferred to the destination rectangle. If true, then a source pixel that is masked by a white pixel is not transferred to the destination rectangle.

DrawBitmapMasked(const TRect &, const CWsBitmap *, const TRect &, const CWsBitmap *, TBool)

IMPORT_C voidDrawBitmapMasked(const TRect &aDestRect,
const CWsBitmap *aBitmap,
const TRect &aSourceRect,
const CWsBitmap *aMaskBitmap,
TBoolaInvertMask
)[virtual]

Draws a specified rectangle from a wserv bitmap and its mask into another rectangle.

The function compresses/stretches the specified rectangle from the bitmap to fit the destination rectangle. The mask bitmap can be used as either a positive or negative mask. Masked pixels are not mapped to the destination rectangle.

A black and white (binary) mask bitmap is used. With aInvertMask=EFalse, black pixels in the mask bitmap stop corresponding pixels in the source bitmap from being transferred to the destination rectangle. With aInvertMask=ETrue, white pixels in the mask bitmap stop corresponding pixels in the source bitmap from being transferred to the destination rectangle.

If mask bitmap's display mode is EColor256, the function does AplhaBlending and ignores aInvertMask parameter.

Windows that store their redraw commands will only store drawing position and a handle to bitmaps that are drawn in it. The bitmap handle is just a pointer to the bitmap in the FBSERV heap. At some point later WSERV may need to draw that window again and it will just replay the stored commands including the draw bitmap. However, if the client has changed the content of the bitmap, WSERV will effectively draw a different bitmap when it replays the commands.

Note: this member function uses rectangle sizes in pixels and does a stretch/compress blit using a linear DDA.

Parameters

const TRect & aDestRectThe rectangle within which the masked bitmap is to be drawn.
const CWsBitmap * aBitmapA source wserv bitmap.
const TRect & aSourceRectThe rectangle in the source bitmap that is copied to the destination rectangle.
const CWsBitmap * aMaskBitmapA mask wserv bitmap.
TBool aInvertMaskIf false, a source pixel that is masked by a black pixel is not transferred to the destination rectangle. If true, then a source pixel that is masked by a white pixel is not transferred to the destination rectangle.

DrawEllipse(const TRect &)

IMPORT_C voidDrawEllipse(const TRect &aRect)[virtual]

Draws and fills an ellipse.

The ellipse is drawn inside the rectangle defined by the aRect argument. Any TRect that has odd pixel dimensions, has the bottom right corner trimmed to give even pixel dimensions before the ellipse is constructed.

The column and row of pixels containing the bottom right co-ordinate of the aRect argument are not part of the rectangle.

Note: a wide outline ellipse is drawn with the pixels distributed either side of a true ellipse, in such a way that the outer edge of the line touches the edge of the construction rectangle. In other words, the ellipse used to construct it is smaller than that for a single pixel line size.

CGraphicsContext::DrawEllipse()

Parameters

const TRect & aRectThe rectangle in which to draw the ellipse

DrawLine(const TPoint &, const TPoint &)

IMPORT_C voidDrawLine(const TPoint &aPoint1,
const TPoint &aPoint2
)[virtual]

Draws a straight line between two points.

CGraphicsContext::DrawLine()

Parameters

const TPoint & aPoint1The point at the start of the line.
const TPoint & aPoint2The point at the end of the line.

DrawLineBy(const TPoint &)

IMPORT_C voidDrawLineBy(const TPoint &aPoint)[virtual]

Draws a straight line relative to the current internal drawing position, using a vector.

The start point of the line is the current internal drawing position. The vector aVector is added to the internal drawing position to give the end point of the line

CGraphicsContext::DrawLineBy()

Parameters

const TPoint & aPointThe vector to add to the current internal drawing position, giving the end point of the line.

DrawLineTo(const TPoint &)

IMPORT_C voidDrawLineTo(const TPoint &aPoint)[virtual]

Draws a straight line from the current internal drawing position to a point.

CGraphicsContext::DrawLineTo()

Parameters

const TPoint & aPointThe point at the end of the line.

DrawPie(const TRect &, const TPoint &, const TPoint &)

IMPORT_C voidDrawPie(const TRect &aRect,
const TPoint &aStart,
const TPoint &aEnd
)[virtual]

Draws and fills a pie-shaped slice of an ellipse.

Outlines are subject to the current pen colour, width, style and draw mode. Set the pen to ENullPen for no outline. The fill is subject to brush style (colour, hash or pattern), the origin and the current drawing mode. Set the brush to ENullBrush for no fill.

The point aStart is used to define one end of a line to the centre of the ellipse. The point of intersection between this line and the ellipse defines the start point of the arc bounding the pie slice. The point aEnd is used to define one end of a second line to the centre of the ellipse. The point of intersection between this line and the ellipse defines the end point of the arc bounding the pie slice. The pixels at the end point are not drawn.

The pie slice itself is the area bounded by: the arc of the ellipse in an anticlockwise direction from the start point to the end point; the straight line from the start point from the geometric centre of the ellipse; the straight line from the end point from the geometric centre of the ellipse.

The line drawn by the pen goes inside the rectangle given by the aRect argument.

Notes:

A rectangle is used in the construction of the pie slice. This rectangle is passed as an argument of type TRect. The curved edge of the pie slice is an arc of an ellipse constructed within the rectangle.

A wide line edged pie slice has the arc drawn with the pixels distributed either side of a true ellipse. This is done in such a way that the outer edge of the line would touch the edge of the construction rectangle. In other words, the ellipse used to construct it is slightly smaller than that for a single pixel line size.

If aStart or aEnd are the ellipse centre then the line that defines the start/end of the arc defaults to one extending vertically above the centre point.

If aStart and aEnd are the same point, or points on the same line through the ellipse centre then a complete filled ellipse is drawn. A line is also drawn from the edge to the ellipse centre.

CGraphicsContext::DrawPie()

Parameters

const TRect & aRectA rectangle in which to draw the ellipse bounding the pie slice
const TPoint & aStartA point to define the start of the pie slice
const TPoint & aEndA point to define the end of the pie slice

DrawPolyLine(const CArrayFix< TPoint > *)

IMPORT_C voidDrawPolyLine(const CArrayFix< TPoint > *aPointList)[virtual]

Draws a polyline using points in an array.

A polyline is a series of concatenated straight lines joining a set of points.

CGraphicsContext::DrawPolyLine()

Parameters

const CArrayFix< TPoint > * aPointListAn array containing the points on the polyline.

DrawPolyLine(const TPoint *, TInt)

IMPORT_C voidDrawPolyLine(const TPoint *aPointList,
TIntaNumPoints
)[virtual]

Draws a polyline using points in a list.

A polyline is a series of concatenated straight lines joining a set of points.

CGraphicsContext::DrawPolyLine()

Parameters

const TPoint * aPointListPointer to a list of points on the polyline.
TInt aNumPointsThe number of points in the point list.

DrawPolygon(const CArrayFix< TPoint > *, TFillRule)

IMPORT_C TIntDrawPolygon(const CArrayFix< TPoint > *aPointList,
TFillRuleaFillRule = EAlternate
)[virtual]

Draws and fills a polygon using points defined in an array.

The first TPoint in the array defines the start of the first side of the polygon. The second TPoint defines the second vertex (the end point of the first side and the start point of the second side) and so on. The final side of the polygon is drawn using the last TPoint from the array or list, and the line drawn to the start point of the first side.

Self-crossing polygons can be filled according to one of two rules, TFillRule::EAlternate (the default), or TFillRule::EWinding. To explain the difference between these rules, the concept of a winding number needs to be introduced. The area outside any of the loops of the polygon has a winding number of zero, and is never filled. An inside a loop which is bounded by an area with winding number 0 has a winding number of 1. If an area is within a loop that is bounded by an area with winding number 1, e.g. a loop within a loop, has a winding number of 2, and so on.

The filling of a polygon proceeds according to this algorithm:

If aFillRule is TFillRule::EAlternate (default) and it has an odd winding number, then fill the surrounding area.

If aFillRule is TFillRule::EWinding and it has a winding number greater than zero, then fill the surrounding area.

This function always causes a flush of the window server buffer.

CGraphicsContext::DrawPolygon()

Parameters

const CArrayFix< TPoint > * aPointListAn array of points, specifying the vertices of the polygon.
TFillRule aFillRule = EAlternateEither TFillRule::EAlternate (the default) or TFillRule::EWinding.

DrawPolygon(const TPoint *, TInt, TFillRule)

IMPORT_C TIntDrawPolygon(const TPoint *aPointList,
TIntaNumPoints,
TFillRuleaFillRule = EAlternate
)[virtual]

Draws and fills a polygon using points defined in a list.

The first TPoint in the list defines the start of the first side of the polygon. The second TPoint defines the second vertex (the end point of the first side and the start point of the second side) and so on. The final side of the polygon is drawn using the last TPoint from the array or list, and the line drawn to the start point of the first side.

Self-crossing polygons can be filled according to one of two rules, TFillRule::EAlternate (the default), or TFillRule::EWinding. To explain the difference between these rules, the concept of a winding number needs to be introduced. The area outside any of the loops of the polygon has a winding number of zero, and is never filled. An inside a loop which is bounded by an area with winding number 0 has a winding number of 1. If an area is within a loop that is bounded by an area with winding number 1, e.g. a loop within a loop, has a winding number of 2, and so on.

The filling of a polygon proceeds according to this algorithm:

If aFillRule is TFillRule::EAlternate (default) and it has an odd winding number, then fill the surrounding area.

If aFillRule is TFillRule::EWinding and it has a winding number greater than zero, then fill the surrounding area.

This function always causes a flush of the window server buffer.

CGraphicsContext::DrawPolygon()

Parameters

const TPoint * aPointListPointer to a list of points, specifying the vertices of the polygon.
TInt aNumPointsThe number of points in the vertex list
TFillRule aFillRule = EAlternateEither TFillRule::EAlternate (the default) or TFillRule::EWinding.

DrawRect(const TRect &)

IMPORT_C voidDrawRect(const TRect &aRect)[virtual]

Draws and fills a rectangle.

The rectangle's border is drawn with the pen, and it is filled using the brush.

CGraphicsContext::DrawRect()

Parameters

const TRect & aRectThe rectangle to be drawn.

DrawResource(const TPoint &, const RWsDrawableSource &, TGraphicsRotation)

voidDrawResource(const TPoint &aPos,
const RWsDrawableSource &aSource,
TGraphicsRotationaRotation = EGraphicsRotationNone
)[private]

Parameters

const TPoint & aPos
const RWsDrawableSource & aSource
TGraphicsRotation aRotation = EGraphicsRotationNone

DrawResource(const TRect &, const RWsDrawableSource &, TGraphicsRotation)

voidDrawResource(const TRect &aDestRect,
const RWsDrawableSource &aSource,
TGraphicsRotationaRotation = EGraphicsRotationNone
)[private]

Parameters

const TRect & aDestRect
const RWsDrawableSource & aSource
TGraphicsRotation aRotation = EGraphicsRotationNone

DrawResource(const TRect &, const RWsDrawableSource &, const TRect &, TGraphicsRotation)

voidDrawResource(const TRect &aDestRect,
const RWsDrawableSource &aSource,
const TRect &aSrcRect,
TGraphicsRotationaRotation = EGraphicsRotationNone
)[private]

Parameters

const TRect & aDestRect
const RWsDrawableSource & aSource
const TRect & aSrcRect
TGraphicsRotation aRotation = EGraphicsRotationNone

DrawResource(const TRect &, const RWsDrawableSource &, const TDesC8 &)

voidDrawResource(const TRect &aDestRect,
const RWsDrawableSource &aSource,
const TDesC8 &aParam
)[private]

Parameters

const TRect & aDestRect
const RWsDrawableSource & aSource
const TDesC8 & aParam

DrawRoundRect(const TRect &, const TSize &)

IMPORT_C voidDrawRoundRect(const TRect &aRect,
const TSize &aEllipse
)[virtual]

Draws and fills a rectangle with rounded corners.

The rounded corners are each constructed as an arc of an ellipse. The dimensions of each corner (corner size and corner height) are given by aEllipse. See DrawArc() for a description of arc construction.

The line drawn by the pen (if any) goes inside the rectangle given by the TRect argument.

Notes:

Dotted and dashed pen styles cannot be used for the outline of a rounded rectangle.

If either corner size dimension is greater than half the corresponding rectangle length, the corner size dimension is reduced to half the rectangle size.

CGraphicsContext::DrawRoundRect()

Parameters

const TRect & aRectThe rectangle to be drawn.
const TSize & aEllipseThe dimensions of each corner.

DrawText(const TDesC &, const TPoint &)

IMPORT_C voidDrawText(const TDesC &aBuf,
const TPoint &aPos
)[virtual]

Draws horizontal text with no surrounding box.

The appearance of the text is subject to the drawing mode, the font, pen colour, word justification and character justification.

A panic occurs if this function is called when there is no font: see UseFont().

CGraphicsContext::DrawText()

Parameters

const TDesC & aBufThe string to write.
const TPoint & aPosThe point specifying the position of the baseline at the left end of the text.

DrawText(const TDesC &, const TRect &, TInt, TTextAlign, TInt)

IMPORT_C voidDrawText(const TDesC &aBuf,
const TRect &aBox,
TIntaBaselineOffset,
TTextAlignaHoriz = ELeft,
TIntaLeftMrg = 0
)[virtual]

Draws horizontal text within a cleared box.

The appearance of the text is subject to the drawing mode, the font, pen colour, word justification and character justification. It is also subject to the background brush (set brush to ENullBrush for no effect on background).

A panic occurs if this function is called when there is no font: see UseFont().

Note: the text is clipped to the box. You must ensure that the specified string is not too large.

CGraphicsContext::DrawText()

Parameters

const TDesC & aBufThe text to write.
const TRect & aBoxThe box to draw the text in.
TInt aBaselineOffsetAn offset from the top of the box to the text baseline. Note that the baseline is the line on which letters sit, for instance below r, s, t, and above the tail of q, and y.
TTextAlign aHoriz = ELeftThe text alignment mode (default is left, rather than centre or right).
TInt aLeftMrg = 0The left margin for left-aligned text, or the right margin for right-aligned text (default is zero).

DrawTextVertical(const TDesC &, const TPoint &, TBool)

IMPORT_C voidDrawTextVertical(const TDesC &aText,
const TPoint &aPos,
TBoolaUp
)[virtual]

Draws vertical text in the specified direction.

A panic occurs if this function is called when there is no font: see UseFont().

Parameters

const TDesC & aTextThe text to be drawn.
const TPoint & aPosPoint of origin of the text baseline.
TBool aUpDirection. ETrue for up, EFalse for down.

DrawTextVertical(const TDesC &, const TRect &, TInt, TBool, TTextAlign, TInt)

IMPORT_C voidDrawTextVertical(const TDesC &aText,
const TRect &aBox,
TIntaBaselineOffset,
TBoolaUp,
TTextAlignaVert = ELeft,
TIntaMargin = 0
)[virtual]

Draws text vertically in the specified direction, within a box of the specified size.

A panic occurs if this function is called when there is no font: see UseFont().

Parameters

const TDesC & aTextThe text to be drawn.
const TRect & aBoxThe bounding box within which the text should be drawn, and which it is clipped to.
TInt aBaselineOffsetThe height of the top of the characters from their text baseline.
TBool aUpThe direction. ETrue for up, EFalse for down.
TTextAlign aVert = ELeftThe text alignment.
TInt aMargin = 0The margin.

DrawWsGraphic(const TWsGraphicId &, const TRect &)

IMPORT_C voidDrawWsGraphic(const TWsGraphicId &aId,
const TRect &aDestRect
)[virtual]

Draws an abstract artwork. It does nothing if aDestRect values fall outside the window area.

Since
9.2

Parameters

const TWsGraphicId & aIdthe identifier for the artwork
const TRect & aDestRectthe destination rect within the active window for this artwork

DrawWsGraphic(const TWsGraphicId &, const TRect &, const TDesC8 &)

IMPORT_C voidDrawWsGraphic(const TWsGraphicId &aId,
const TRect &aDestRect,
const TDesC8 &aData
)[virtual]

Draws an abstract artwork. It does nothing if aDestRect values fall outside the window area.

Since
9.2

Parameters

const TWsGraphicId & aIdthe identifier for the artwork
const TRect & aDestRectthe destination rect within the active window for this artwork
const TDesC8 & aDataopaque datagram to associate with this occasion of drawing. The format is dependent upon the artwork

Interface(TUid)

IMPORT_C TAny *Interface(TUidaInterfaceId)

Parameters

TUid aInterfaceId

Interface(TUid)

IMPORT_C const TAny *Interface(TUidaInterfaceId)const

Parameters

TUid aInterfaceId

MapColors(const TRect &, const TRgb *, TInt, TBool)

IMPORT_C voidMapColors(const TRect &aRect,
const TRgb *aColors,
TIntaNumPairs = 2,
TBoolaMapForwards = ETrue
)[virtual]

Re-maps pixel colours within a rectangle.

aColors is an array of paired colour values. The rectangle is scanned and the colour value of each pixel is looked up in the array, and if found is replaced by the value with which it is paired. The arguments specify the rectangle, the array of pairs, the number of pairs in the array, and the 'direction' of lookup. If no entry is found for the colour value of a given pixel it remains unchanged.

This function was designed for cursor display. A cursor is normally displayed as the XOR of the background against which it appears. However in some graphics modes, certain colours XOR to very similar shades. MapColors() allows more pleasing maps to be specified.

The effect of this function when applied to transparent pixels when the opaque flag is set is undefined. See SetOpaque().

Parameters

const TRect & aRectRectangle to be mapped.
const TRgb * aColorsArray of colour value pairs, one value in a pair is the lookup value and the other is the replacement value.
TInt aNumPairs = 2Number of pairs in the array. aColors must have twice this number of elements. By default the aColors array is assumed to specify 2 colours (i.e. it specifies a single mapping).
TBool aMapForwards = ETrueDirection of lookup. ETrue to map forwards, i.e. treat the first value in the pair as the lookup value and the second as the replacement value; EFalse does the opposite.

MoveBy(const TPoint &)

IMPORT_C voidMoveBy(const TPoint &aPoint)[virtual]

Moves the internal drawing position by a vector, without drawing a line.

The internal drawing position is moved relative to its current co-ordinates.

CGraphicsContext::MoveBy() CGraphicsContext::MoveTo()

Parameters

const TPoint & aPointThe vector to move the internal drawing position by.

MoveTo(const TPoint &)

IMPORT_C voidMoveTo(const TPoint &aPoint)[virtual]

Moves the internal drawing position relative to the co-ordinate origin, without drawing a line.

A subsequent call to DrawLineTo() or DrawLineBy() will then use the new internal drawing position as the start point for the line drawn.

Notes:

The operations DrawLine(), DrawLineTo(), DrawLineBy() and DrawPolyline() also change the internal drawing position to the last point of the drawn line(s).

The internal drawing position is set to the co-ordinate origin if no drawing or moving operations have yet taken place.

CGraphicsContext::MoveTo() CGraphicsContext::MoveBy()

Parameters

const TPoint & aPointThe point to move the internal drawing position to.

Plot(const TPoint &)

IMPORT_C voidPlot(const TPoint &aPoint)[virtual]

Draws a single point.

The point is drawn with the current pen settings using the current drawing mode.

Note: if the pen size is greater than one pixel, a filled circle of the current pen colour is drawn, with the pen size as the diameter and the plotted point as the centre. If the pen size is an even number of pixels, the extra pixels are drawn below and to the right of the centre. See SetPenSize().

CGraphicsContext::Plot()

Parameters

const TPoint & aPointThe point to be drawn.

Reserved_CBitmapContext_1()

IMPORT_C voidReserved_CBitmapContext_1()[private, virtual]

Reserved_CBitmapContext_2()

IMPORT_C voidReserved_CBitmapContext_2()[private, virtual]

Reserved_CBitmapContext_3()

IMPORT_C voidReserved_CBitmapContext_3()[private, virtual]

Reserved_CGraphicsContext_2()

IMPORT_C voidReserved_CGraphicsContext_2()[private, virtual]

A reserved virtual function for future use.

Reserved_CWindowGc_3()

IMPORT_C voidReserved_CWindowGc_3()[private, virtual]

Reserved_CWindowGc_4()

IMPORT_C voidReserved_CWindowGc_4()[private, virtual]

Reserved_CWindowGc_5()

IMPORT_C voidReserved_CWindowGc_5()[private, virtual]

Reset()

IMPORT_C voidReset()[virtual]

Resets the graphics context to its default settings.

The drawing mode is set to TDrawMode::EDrawModePen (pen and brush colours used as they are); there is no clipping rectangle; the pen settings are black, solid, single pixel size; the brush style is null; no text font is selected.

CGraphicsContext::Reset()

SetBrushColor(const TRgb &)

IMPORT_C voidSetBrushColor(const TRgb &aColor)[virtual]

Sets the brush colour.

The effective brush colour depends on the drawing mode (see SetDrawMode()). If no brush colour has been set, it defaults to white. However the default brush style is null, so when drawing to a window, the default appears to be the window's background colour.

CGraphicsContext::SetBrushColor()

Parameters

const TRgb & aColorThe RGB colour for the brush.

SetBrushOrigin(const TPoint &)

IMPORT_C voidSetBrushOrigin(const TPoint &aOrigin)[virtual]

Sets the brush pattern origin.

This specifies the position of the pixel in the top left corner of a reference pattern tile, (in absolute device co-ordinates). Other copies of the pattern tile are then drawn around the reference one. Thus the brush origin can be set as the top left corner of a shape.

The brush pattern may be a built-in style (see SetBrushStyle()), or a bitmap. To use a bitmap, the brush must have a pattern set (see UseBrushPattern()) and the brush style must be set to TBrushStyle::EPatternedBrush.

Notes:

If SetBrushOrigin() is not used, then the origin defaults to (0,0).

This brush origin remains in effect for all fillable shapes drawn subsequently, until a new brush origin is set. Shapes can thus be considered as windows onto a continuous pattern field (covering the whole clipping region of a screen device, or the whole device area of a printer).

CGraphicsContext::SetBrushOrigin()

Parameters

const TPoint & aOriginThe origin point for the brush.

SetBrushStyle(TBrushStyle)

IMPORT_C voidSetBrushStyle(TBrushStyleaBrushStyle)[virtual]

Sets the line drawing style for the brush.

The GDI provides ten brush styles, including six built-in hatching patterns (see CGraphicsContext::TBrushStyle).

Use TBrushStyle::ENullBrush to draw the outline of a fillable shape on its own, without filling.

If the TBrushStyle::EPatternedBrush style is set, but no bitmap pattern has been selected using UseBrushPattern(), then the brush defaults to TBrushStyle::ENullBrush.

Hatching lines are done in the current brush colour, set using SetBrushColor(). Hatching can be overlaid on other graphics. The hatching pattern starts at the brush origin, set using SetBrushOrigin().

CGraphicsContext::SetBrushStyle()

Parameters

TBrushStyle aBrushStyleThe brush style.

SetCharJustification(TInt, TInt)

IMPORT_C voidSetCharJustification(TIntaExcessWidth,
TIntaNumChars
)[virtual]

Sets the character justification.

This function is used primarily to get accurate WYSIWYG, and is not intended for regular use by developers.

The text line that is to be justified has a certain number of characters (this includes the spaces between the words). It also has a distance (in pixels) between the end of the last word and the actual end of the line (right hand margin, usually). These excess width pixels are distributed amongst all the characters, increasing the gaps between them, to achieve full justification of the text line.

This function is particularly useful for WYSIWYG underlining or strikethrough, as it ensures that the lines extend into the gaps between characters.

See CGraphicsContext::SetCharJustification() for more information.

CGraphicsContext::SetCharJustification()

Parameters

TInt aExcessWidthThe excess width (in pixels) to be distributed between the specified number of characters.
TInt aNumCharsThe number of characters involved

SetClippingRect(const TRect &)

IMPORT_C voidSetClippingRect(const TRect &aRect)[virtual]

Sets a clipping rectangle.

Graphics drawn to the window are clipped, so that only items which fall within the rectangle are displayed.

Note that clipping is additive. If a clipping region has been set using SetClippingRegion() then clipping will be to the intersection of that region and this rectangle.

SetClippingRegion()

Parameters

const TRect & aRectThe clipping rectangle.

SetClippingRegion(const TRegion &)

IMPORT_C TIntSetClippingRegion(const TRegion &aRegion)[virtual]

Sets the clipping region.

Drawing is always clipped to the visible area of a window. The region specified by this function is in addition to that area.

This function always causes a flush of the window server buffer.

Parameters

const TRegion & aRegion

SetDitherOrigin(const TPoint &)

IMPORT_C voidSetDitherOrigin(const TPoint &aPoint)[virtual]

Sets the origin used for colour dithering.

Parameters

const TPoint & aPointNew dither origin.

SetDrawMode(TDrawMode)

IMPORT_C voidSetDrawMode(TDrawModeaDrawingMode)[virtual]

Sets the drawing mode.

This affects the colour that is actually drawn, because it defines the way that the current screen colour logically combines with the current pen colour and brush colour.

There are 13 drawing modes (see CGraphicsContext::TDrawMode enum), each giving different logical combinations of pen, brush and screen colours. Each mode is produced by ORing together different combinations of seven drawing mode components (see CGraphicsContext::TDrawModeComponents enum).

The three most important modes are TDrawMode::EDrawModePEN, TDrawMode::EDrawModeNOTSCREEN and TDrawMode::EDrawModeXOR. The default drawing mode is TDrawMode::EDrawModePEN.

The drawing mode is over-ridden for line and shape drawing functions when a wide pen line has been selected. It is forced to TDrawMode::EDrawModePEN. This is to prevent undesired effects at line joins (vertexes).

Notes:

TDrawMode::EDrawModeAND gives a "colour filter" effect. For example:

ANDing with white gives the original colour

ANDing with black gives black

TDrawMode::EDrawModeOR gives a "colour boost" effect. For example:

ORing with black gives the original colour

ORing with white gives white

TDrawMode::EDrawModeXOR gives an "Exclusive OR" effect. For example:

white XOR black gives white

white XOR white gives black

black XOR black gives black

CGraphicsContext::SetDrawMode()

Parameters

TDrawMode aDrawingModeA drawing mode.

SetFaded(TBool)

IMPORT_C voidSetFaded(TBoolaFaded)[virtual]

Sets whether the graphics context is faded.

Fading is used to make a window appear less colourful so that other windows stand out. For example, a window would be faded when a dialogue is displayed in front of it.

Parameters

TBool aFadedETrue to fade the graphics context, EFalse to unfade it.

SetFadingParameters(TUint8, TUint8)

IMPORT_C voidSetFadingParameters(TUint8aBlackMap,
TUint8aWhiteMap
)[virtual]

Sets the fading parameters.

This function allows you to override the map used when drawing with a faded graphics context. However if you draw to a faded window with a faded graphics context, then fading on the graphics context is ignored and it will use the fading of the window.

Fading is used to make a window appear less colourful so that other windows stand out. For example, a window would be faded when a dialogue is displayed in front of it.

You can either make a faded window closer to white or closer to black. The fading map allows you to over-ride the default fading parameters set in RWsSession::SetDefaultFadingParameters().

Fading re-maps colours to fall between the specified black and white map values. If aBlackMap=0 and aWhiteMap=255 then the colours are mapped unchanged. As the values converge, the colours are mapped to a smaller range, so the differences between colours in the faded graphics context decrease. If the values are reversed then the colours are inverted (i.e. where the gc would be black, it is now white).

RWsSession::SetDefaultFadingParameters() RWindowTreeNode::SetFaded()

Parameters

TUint8 aBlackMapBlack map fading parameter. Unfaded this is 0.
TUint8 aWhiteMapWhite map fading parameter. Unfaded this is 255.

SetJustification(TInt, TInt, TInt)

voidSetJustification(TIntaExcessWidth,
TIntaNumGaps,
TIntaOpcode
)[private]

Parameters

TInt aExcessWidth
TInt aNumGaps
TInt aOpcode

SetOpaque(TBool)

IMPORT_C voidSetOpaque(TBoolaDrawOpaque = ETrue)[virtual]

Sets and unsets an opaque flag on the window. When drawing to a transparent window with the opaque flag set, drawing commands will not appear transparent. When drawing to a non-transparent window this command has no effect. The result of non-opaque drawing performed over the top of an area of the window to which opaque drawing has already been done is undefined. The result of opaque alpha blending or color mapping over the top of an area of the window to which opaque drawing has not already been done is undefined. This method is supported from version 8.1

Parameters

TBool aDrawOpaque = ETrueIf true, opaque mode is switched on. If false, normal drawing will be used.

SetOrigin(const TPoint &)

IMPORT_C voidSetOrigin(const TPoint &aPoint =  TPoint(0, 0))[virtual]

Sets the position of the co-ordinate origin.

All subsequent drawing operations are then done relative to this origin. The default origin is (0,0), the top left corner of the window.

CGraphicsContext::SetOrigin()

Parameters

const TPoint & aPoint =  TPoint(0, 0)A point for the origin, default (0,0).

SetPenColor(const TRgb &)

IMPORT_C voidSetPenColor(const TRgb &aColor)[virtual]

Sets the pen colour.

The effective pen colour depends on the drawing mode (see SetDrawMode()).

The default pen colour is black.

CGraphicsContext::SetPenColor()

Parameters

const TRgb & aColorThe RGB colour for the pen.

SetPenSize(const TSize &)

IMPORT_C voidSetPenSize(const TSize &aSize)[virtual]

Sets the line drawing size for the pen.

Lines of size greater than one pixel are drawn with rounded ends that extend beyond the end points, (as if the line is drawn using a circular pen tip of the specified size). Rounded ends of lines drawn with a wide pen are always drawn in TDrawMode::EDrawModePEN mode, overriding whatever mode has been set using SetDrawMode().

CGraphicsContext::SetPenSize()

Parameters

const TSize & aSizeA line size, the default being 1 pixel.

SetPenStyle(TPenStyle)

IMPORT_C voidSetPenStyle(TPenStyleaPenStyle)[virtual]

Sets the line drawing style for the pen.

The pen is used when drawing lines and for the outline of filled shapes. There are 6 pen styles (see CGraphicsContext::TPenStyle enum). If no pen style is set, the default is TPenStyle::ESolidPen.

To use a pen style, its full context must be given, e.g. for a null pen: CGraphicsContext::TPenStyle::ENullPen.

CGraphicsContext::SetPenStyle()

Parameters

TPenStyle aPenStyleA pen style.

SetStrikethroughStyle(TFontStrikethrough)

IMPORT_C voidSetStrikethroughStyle(TFontStrikethroughaStrikethroughStyle)[virtual]

Sets the strikethrough style for all subsequently drawn text.

CGraphicsContext::SetStrikethroughStyle()

Parameters

TFontStrikethrough aStrikethroughStyleThe strikethrough style: either on or off.

SetUnderlineStyle(TFontUnderline)

IMPORT_C voidSetUnderlineStyle(TFontUnderlineaUnderlineStyle)[virtual]

Sets the underline style for all subsequently drawn text.

CGraphicsContext::SetUnderlineStyle()

Parameters

TFontUnderline aUnderlineStyleThe underline style: either on or off.

SetWordJustification(TInt, TInt)

IMPORT_C voidSetWordJustification(TIntaExcessWidth,
TIntaNumGaps
)[virtual]

Sets word justification.

This function is particularly useful for doing WYSIWYG underlining or strikethrough, as it ensures that the lines extend correctly into the gaps between words. It is not intended for regular use by developers.

CGraphicsContext::SetWordJustification()

Parameters

TInt aExcessWidthThe excess width (in pixels) to be distributed between the specified number of gaps (starting immediately)
TInt aNumGapsThe number of gaps between words

UseBrushPattern(const CFbsBitmap *)

IMPORT_C voidUseBrushPattern(const CFbsBitmap *aDevice)[virtual]

Sets the brush pattern to the specified bitmap.

For the brush to actually use the bitmap, TBrushStyle::EPatternedBrush must be used to set the brush style (see SetBrushStyle()). When the brush pattern is no longer required, use DiscardBrushPattern() to free up the memory used, (if the bitmap is not being shared). If UseBrushPattern() is used again without using DiscardBrushPattern() then the previous pattern is discarded automatically.

Notes:

When loading a bitmap, the GDI checks to see if the bitmap is already in memory. If the bitmap is already there, then that copy is shared.

The brush does not need to have a pattern set at all. There are several built-in hatching patterns, which can be selected using SetBrushStyle().

CGraphicsContext::UseBrushPattern()

Parameters

const CFbsBitmap * aDeviceA bitmap pattern for the brush

UseFont(const CFont *)

IMPORT_C voidUseFont(const CFont *aFont)[virtual]

Sets this context's font.

The font is used for text drawing. If the font is already in the font and bitmap server's memory the GDI will share that copy.

Note that this function must be called prior to drawing text or the calling thread will panic.

CGraphicsContext::UseFont()

Parameters

const CFont * aFontA device font.

WriteTextCommand(TAny *, TInt, const TDesC &, TInt, TInt)

voidWriteTextCommand(TAny *aCmd,
TIntaLen,
const TDesC &aBuf,
TIntaOpcode,
TIntaOpcodePtr
)const [private]

Parameters

TAny * aCmd
TInt aLen
const TDesC & aBuf
TInt aOpcode
TInt aOpcodePtr

WriteTextCommand(TAny *, TInt, const TDesC8 &, TInt, TInt)

voidWriteTextCommand(TAny *aCmd,
TIntaLen,
const TDesC8 &aBuf,
TIntaOpcode,
TIntaOpcodePtr
)const [private]

Parameters

TAny * aCmd
TInt aLen
const TDesC8 & aBuf
TInt aOpcode
TInt aOpcodePtr

WriteTextPos(TInt, TInt, const TPoint &, const TDesC &)

voidWriteTextPos(TIntaOpcode,
TIntaOpcodePtr,
const TPoint &aPos,
const TDesC &aBuf
)const [private]

Parameters

TInt aOpcode
TInt aOpcodePtr
const TPoint & aPos
const TDesC & aBuf

doDrawPolyLine(const CArrayFix< TPoint > *, const TPoint *, TInt)

voiddoDrawPolyLine(const CArrayFix< TPoint > *aPointArray,
const TPoint *aPointList,
TIntaNumPoints
)[private]

Parameters

const CArrayFix< TPoint > * aPointArray
const TPoint * aPointList
TInt aNumPoints

doDrawPolygon(const CArrayFix< TPoint > *, const TPoint *, TInt, TFillRule)

TInt doDrawPolygon(const CArrayFix< TPoint > *aPointArray,
const TPoint *aPointList,
TIntaNumPoints,
TFillRuleaFillRule
)[private]

Parameters

const CArrayFix< TPoint > * aPointArray
const TPoint * aPointList
TInt aNumPoints
TFillRule aFillRule

Member Enumerations Documentation

Enum TGraphicsRotation

Defines possible clockwise rotation values.

WARNING: Enum for internal and partner use ONLY. Compatibility is not guaranteed in future releases.

Enumerators

EGraphicsRotationNone

No rotation.

EGraphicsRotation90

A 90 degree rotation.

EGraphicsRotation180

A 180 degree rotation.

EGraphicsRotation270

A 270 degree rotation.

Member Data Documentation

CWsScreenDevice * iDevice

CWsScreenDevice *iDevice[private]

CPimpl * iPimpl

CPimpl *iPimpl[private]