Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: gdi.h
Link against: gdi.lib

Class CGraphicsContext

CGraphicsContext

Support

Supported from 5.0

Description

Abstract, device independent, interface to graphics contexts.

The class CBitmapContext is derived from this class.

See CGraphicsContext::Reset() for the default settings of a graphics context immediately after construction.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CGraphicsContextAbstract, device independent, interface to graphics contexts

Defined in CGraphicsContext:
CancelClippingRect(), Device(), DiscardBrushPattern(), DiscardFont(), DrawArc(), DrawBitmap(), DrawEllipse(), DrawLine(), DrawLineBy(), DrawLineTo(), DrawPie(), DrawPolyLine(), DrawPolygon(), DrawRect(), DrawRoundRect(), DrawText(), EAlternate, EAnd, ECenter, EDashedPen, EDiamondCrossHatchBrush, EDotDashPen, EDotDotDashPen, EDottedPen, EDrawModeAND, EDrawModeANDNOT, EDrawModeNOTAND, EDrawModeNOTANDNOT, EDrawModeNOTOR, EDrawModeNOTORNOT, EDrawModeNOTPEN, EDrawModeNOTSCREEN, EDrawModeNOTXOR, EDrawModeOR, EDrawModeORNOT, EDrawModePEN, EDrawModeXOR, EForwardDiagonalHatchBrush, EHorizontalHatchBrush, EInvertPen, EInvertScreen, ELeft, ELogicalOp, ENullBrush, ENullPen, EOr, EPatternedBrush, EPenmode, ERearwardDiagonalHatchBrush, ERight, ESolidBrush, ESolidPen, ESquareCrossHatchBrush, EVerticalHatchBrush, EWinding, EXor, JustificationInPixels(), MoveBy(), MoveTo(), Plot(), Reset(), SetBrushColor(), SetBrushOrigin(), SetBrushStyle(), SetCharJustification(), SetClippingRect(), SetDrawMode(), SetOrigin(), SetPenColor(), SetPenSize(), SetPenStyle(), SetStrikethroughStyle(), SetUnderlineStyle(), SetWordJustification(), TBrushStyle, TDrawMode, TDrawModeComponents, TDrawTextParam, TFillRule, TPenStyle, TTextAlign, UseBrushPattern(), UseFont()

Inherited from CBase:
operator new()

See also:


Graphics device


Device()

virtual CGraphicsDevice* Device() const=0;

Description

Gets a pointer to the graphics context’s graphics device.

Return value

CGraphicsDevice*

A pointer to the graphics device.

[Top]


Resetting


Reset()

virtual void Reset()=0;

Description

Resets the graphics context to its default settings:

[Top]


Drawing control


SetDrawMode()

virtual void SetDrawMode(TDrawMode aDrawingMode)=0;

Description

Sets the drawing mode.

The way that the pen and brush draw depends on the drawing mode. The drawing mode 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, 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.

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:

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

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

Parameters

TDrawMode aDrawingMode

See also:


SetOrigin()

virtual void SetOrigin(const TPoint& aPos=TPoint(0,0))=0;

Description

Sets the position of the co-ordinate origin.

All subsequent drawing operations are done relative to this origin.

Parameters

const TPoint& aPos

The origin. The default origin is TPoint(0,0) — the top left corner of the screen.

[Top]


The internal drawing position


MoveTo()

virtual void MoveTo(const TPoint& aPoint)=0;

Description

Sets the drawing point relative to the co-ordinate origin.

A subsequent call to DrawLineTo() or DrawLineBy() uses the new drawing point as the start point for the line drawn.

Notes

Parameters

const TPoint& aPoint

The new internal drawing position.


MoveBy()

virtual void MoveBy(const TPoint& aVector)=0;

Description

Sets the drawing point relative to the current co-ordinates.

A subsequent call to DrawLineTo() or DrawLineBy() uses the new drawing point as the start point for the line drawn.

Notes

Parameters

const TPoint& aVector

The amount by which the internal drawing position is to move.

[Top]


Clipping


SetClippingRect()

virtual void SetClippingRect(const TRect& aRect)=0;

Description

Sets the clipping rectangle.

The area of visible drawing depends on the clipping region. The default clipping rectangle is the full device area.

Parameters

const TRect& aRect

The clipping rectangle.


CancelClippingRect()

virtual void CancelClippingRect()=0;

Description

Cancels any clipping rectangle.

Clipping thus reverts to the full device area, the default.

See also:

[Top]


Pen control


SetPenColor()

virtual void SetPenColor(const TRgb& aColor)=0;

Description

Sets the pen colour.

The effective pen colour depends on the drawing mode. The default pen colour is black.

Note:

Parameters

const TRgb& aColor

An RGB colour for the pen.

See also:


SetPenStyle()

virtual void SetPenStyle(TPenStyle aPenStyle)=0;

Description

Sets the line drawing style for the pen.

There are 6 pen styles. If no pen style is set, then 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

Notes:

The dotted/dashed pattern is continued, without re-starting, for all consecutively drawn straight lines, i.e.

Parameters

TPenStyle aPenStyle

A pen style.

See also:


SetPenSize()

virtual void SetPenSize(const TSize& aSize)=0;

Description

Sets the line drawing size for the pen.

Lines of size greater than one pixel:

Notes:

Parameters

const TSize& aSize

A line size. The default is 1 pixel.

[Top]


Brush control


SetBrushColor()

virtual void SetBrushColor(const TRgb& aColor)=0;

Description

Sets the brush colour.

The effective brush colour depends on the drawing mode.

Notes:

Parameters

const TRgb& aColor

An RGB colour for the brush.

See also:


SetBrushStyle()

virtual void SetBrushStyle(TBrushStyle aBrushStyle)=0;

Description

Sets the brush style.

Ten brush styles are provided, including six built-in hatching patterns (see TBrushStyle).

Note:

Parameters

TBrushStyle aBrushStyle

A brush style.

See also:


SetBrushOrigin()

virtual void SetBrushOrigin(const TPoint& aOrigin)=0;

Description

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 file are then tiled 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, or a bitmap. To use a bitmap, the brush must have a pattern set and the brush style must be set to TBrushStyle::EPatternedBrush.

Notes

Parameters

const TPoint& aOrigin

An origin point for the brush.

See also:


UseBrushPattern()

virtual void UseBrushPattern(const CFbsBitmap* aBitmap)=0;

Description

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.

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:

Parameters

const CFbsBitmap* aBitmap

A bitmap pattern for the brush.

See also:


DiscardBrushPattern()

virtual void DiscardBrushPattern()=0;

Description

Discards a non-built-in brush pattern.

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

Notes:

[Top]


Text control


UseFont()

virtual void UseFont(const CFont* aFont)=0;

Description

Sets the device font to be used for text drawing.

If the font is already in memory, then that copy is shared.

Notes:

Parameters

const CFont* aFont

A device font

See also:


DiscardFont()

virtual void DiscardFont()=0;

Description

Discards a font.

This frees up the memory used, if the font is not being shared.

The function can be called when no font is in use.


SetWordJustification()

virtual void SetWordJustification(TInt aExcessWidth,TInt aNumGaps)=0;

Description

Adjusts the spaces between words to stretch or squeeze to a certain width.

The function is required by the Text Views API, and is not intended for regular use by developers.

The text line that is to be justified has a certain number of gaps (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 the gaps between the words to achieve full justification of the text line. Spaces become fat spaces to keep underlining/strikethrough consistent. Pixels are distributed to the inter-word gaps starting from the left end of the string. The spacing between characters in each word remains unchanged.

After a call to SetWordJustification(), subsequent calls to either of the two DrawText() functions are affected until the number of spaces specified by aNumSpaces is used up.

The easiest way to find out the excess width and number of spaces is to call CFont::MeasureText(). This function can also perform counting, which is finding how much of some text will fit into a given width.

Use CFont::TextCount() to return the excess width.

For example, in the string "To be, or not to be", there are five inter-word gaps. If there are six excess pixels they will be distributed in the proportion 2, 1, 1, 1, 1 between the words. If there are nine excess pixels they will be distributed in the proportion 2, 2, 2, 2, 1 between the words.

Notes:

Parameters

TInt aExcessWidth

The width (in pixels) to be distributed between the specified number of spaces. It may be positive, in which case the text is stretched, or negative, in which case it is shrunk.

TInt aNumGaps

The number of word spaces (characters with the code U+0020) over which the change in width is distributed.


SetCharJustification()

virtual void SetCharJustification(TInt aExcessWidth,TInt aNumChars)=0;

Description

Sets character justification.

This function is required by the Text Views API, and is not intended for regular use by developers.

It affects the strings of text used in the calls to DrawText() that follow, until the number of characters drawn equals aNumChars.

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.

Use CFont::TextCount() to return the excess width.

Notes:

In practice what you do in printer layout mode is:

Thus, in practice, character justification will only very rarely be used to expand a line of characters.

Parameters

TInt aExcessWidth

The excess width (in pixels) to be distributed between the specified number of characters.

TInt aNumChars

The number of characters involved.


JustificationInPixels()

static TInt JustificationInPixels(TInt& aExcessPixels,TInt& aTotalUnits);

Description

Gets the amount of space in pixels by which to adjust the current letter or word spacing, and also retrieves the number of excess pixels and word spaces remaining after the adjustment is performed.

The arguments are the number of remaining pixels (character groups) and units (word spaces) over which justification is to occur. The function can be called repetitively until the number of units is zero, and hence justification is complete. A panic occurs if the number of units is less than one or the amount of pixels is zero.

Parameters

TInt& aExcessPixels

The number of pixels by which the width of the text is to be changed. It may be positive, in which case the text is stretched, or negative, in which case it is shrunk. On return, this is equal to its old value minus the return value.

TInt& aTotalUnits

The number of word spaces over which the change in width is to be distributed. On return, this is reduced by one.

Return value

TInt

The number of pixels to be added to the width of the current unit.

See also:


JustificationInPixels()

static TInt JustificationInPixels(TInt aExcessPixels,TInt aTotalUnits,TInt aFirstUnit,TInt aNumUnits);

Description

Gets the amount of space in pixels by which to adjust letter or word spacing, given the total number of words and spaces, a start space, and the number of units to be adjusted.

The first two arguments are the number of pixels (character groups) and the number of units (word spaces) over which justification is to occur. The third argument specifies the current character group or word space, while the final argument specifies the number of units that are to be adjusted.

A panic occurs if aExcessPixels is 0, aTotalUnits is not greater than 0, or aFirstUnit is not less than aTotalUnits.

Parameters

TInt aExcessPixels

The number of pixels by which the width of the text is to be changed. It may be positive, in which case the text is stretched, or negative, in which case it is shrunk.

TInt aTotalUnits

The number of word spaces over which the change in width is to be distributed.

TInt aFirstUnit

The current unit — the character group or word space we are 'on'.

TInt aNumUnits

The number of units that are to be adjusted — starting at aFirstUnit.

Return value

TInt

The number of pixels to be added to the width of the current unit.

See also:

[Top]


Setting font styles


SetUnderlineStyle()

virtual void SetUnderlineStyle(TFontUnderline aUnderlineStyle)=0;

Description

Sets the underline style.

This is applied to all subsequently drawn text.

Parameters

TFontUnderline aUnderlineStyle

The underline style — on or off.


SetStrikethroughStyle()

virtual void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle)=0;

Description

Sets the strikethrough style.

This is applied to all subsequently drawn text.

Parameters

TFontStrikethrough aStrikethroughStyle

The strikethrough style — on or off.

[Top]


Point drawing


Plot()

virtual void Plot(const TPoint& aPoint)=0;

Description

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

Note:

Parameters

const TPoint& aPoint

The point to be drawn.

See also:

[Top]


Non-fillable shape drawing

Description

There are a number of important facts regarding all line drawing:

Straight lines can be drawn between two given points, to a single given point from the current internal drawing position, or by moving the internal drawing position by a given vector.

Functions are provided to draw straight lines, polylines (concatenated sequences of straight lines) and curved arcs.


DrawLine()

virtual void DrawLine(const TPoint& aPoint1,const TPoint& aPoint2)=0;

Description

Draws a straight line between two points.

Parameters

const TPoint& aPoint1

The point at the start of the line.

const TPoint& aPoint2

The point at the end of the line.


DrawLineTo()

virtual void DrawLineTo(const TPoint& aPoint)=0;

Description

Draws a straight line from the current drawing point to a specified point.

Parameters

const TPoint& aPoint

The point at the end of the line.

See also:


DrawLineBy()

virtual void DrawLineBy(const TPoint& aVector)=0;

Description

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

The start point of the line is the current drawing point. The specified vector is added to the drawing point to give the end point of the line

Parameters

const TPoint& aVector

The vector to add to the current internal drawing position, giving the end point of the line.

See also:


DrawPolyLine()

virtual void DrawPolyLine(const CArrayFix<TPoint>* aPointList)=0;

Description

Draws a polyline from a set of points in an array.

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

Parameters

const CArrayFix<TPoint>* aPointList

An array containing the points on the polyline.


DrawPolyLine()

virtual void DrawPolyLine(const TPoint* aPointList,TInt aNumPoints)=0;

Description

Draws a polyline from a set of points in a list.

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

Parameters

const TPoint* aPointList

Pointer to a set of points on the polyline.

TInt aNumPoints

Number of points in the list.


DrawArc()

virtual void DrawArc(const TRect& aRect,const TPoint& aStart,const TPoint& aEnd)=0;

Description

Draws an arc.

The arc is considered a portion of an ellipse. The ellipse is defined by the TRect argument.

The pixels at both the start point and the end point are drawn.

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

Notes:

Parameters

const TRect& aRect

A rectangle in which to draw the ellipse, of which the arc is a segment.

const TPoint& aStart

The point defining the start of the arc. It defines 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.

const TPoint& aEnd

The point defining the end of the arc. It defines 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.

See also:

[Top]


Fillable shape drawing

Description

All the fillable shape drawing primitives, except DrawPolygon(), either use a rectangle directly or use it to define the position of an ellipse. This rectangle is passed as an argument of type TRect.

The outlines are drawn with the pen, and the shapes are filled with the brush. Set the pen or brush to null to omit drawing of either component. All shapes are clipped to the current clipping region.

Shapes are filled using the brush, and thus subject to the brush style (colour, hash or pattern) and brush pattern origin. The effective fill colour depends on the drawing mode. The brush style should be set to TBrushStyle::ENullBrush if no fill is required.

The outlines of fillable shapes are drawn with the pen, and thus subject to pen colour, pen size and pen style settings. The effective outline colour depends on the drawing mode. Straight lines are drawn between vertexes in the same way that lines are drawn using DrawLine(), with each point being drawn only once, (see SetPenSize() for a discussion of line size effects). If the pen size has been set to greater than or equal to half the size of the shape then the shape will be filled with solid pen colour. The pen style should be set to TPenStyle::ENullPen if no outline is required.

There are five shape drawing primitives: pie slice, ellipse, rectangle, rounded rectangle, and polygon. All may be drawn with or without an outline.


DrawRect()

virtual void DrawRect(const TRect& aRect)=0;

Description

Draws and fills a rectangle.

Parameters

const TRect& aRect

The rectangle to be drawn.


DrawEllipse()

virtual void DrawEllipse(const TRect& aRect)=0;

Description

Draws and fills an ellipse.

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

Note:

Parameters

const TRect& aRect

The rectangle in which the ellipse is drawn.


DrawRoundRect()

virtual void DrawRoundRect(const TRect& aRect,const TSize& aCornerSize)=0;

Description

Draws and fills a rectangle with rounded corners.

The rounded corners are each constructed as an arc of an ellipse.

The line drawn by the pen, if any, goes inside the specified rectangle.

Notes:

Parameters

const TRect& aRect

The rectangle to be drawn.

const TSize& aCornerSize

The dimensions of each corner.

See also:


DrawPie()

virtual void DrawPie(const TRect& aRect,const TPoint& aStart,const TPoint& aEnd)=0;

Description

Draws and fills a pie slice.

The pie slice is an area bounded by:

Notes:

Parameters

const TRect& aRect

A rectangle in which to draw the ellipse bounding the pie slice.

const TPoint& aStart

A point defining the start of the arc bounding the pie slice. It defines one end of a line from the geometrical centre of the ellipse. The point of intersection between this line and the ellipse defines the start point of the arc.

const TPoint& aEnd

A point to define the end of the arc bounding the pie slice. It defines one end of a second line from the geometrical centre of the ellipse. The point of intersection between this line and the ellipse defines the end point of the arc.


DrawPolygon()

virtual TInt DrawPolygon(const CArrayFix<TPoint>* aPointList,TFillRule aFillRule=EAlternate)=0;

Description

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

The first point in the array defines the start of the first side of the polygon. The second point defines the second vertex (the end point of the first side and the start point of the second side).

The final side of the polygon is drawn using the last point from the array, and the line is drawn to the start point of the first side.

Self-crossing polygons are filled according to the specified fill rule.

Parameters

const CArrayFix<TPoint>* aPointList

An array of points, specifying the vertices of the polygon.

TFillRule aFillRule

The fill rule. By default, this is TFillRule::EAlternate.

Return value

TInt

KErrNone, if successful; otherwise, another of the system-wide error codes.


DrawPolygon()

virtual TInt DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule=EAlternate)=0;

Description

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

The first point in the list defines the start of the first side of the polygon. The second point defines the second vertex (the end point of the first side and the start point of the second side).

The final side of the polygon is drawn using the last point from the list, and the line is drawn to the start point of the first side.

Self-crossing polygons are filled according to the specified fill rule.

Parameters

const TPoint* aPointList

Pointer to list of points, specifying the vertices of the polygon.

TInt aNumPoints

The number of points in the list.

TFillRule aFillRule=EAlternate

The fill rule. By default this is TFillRule::EAlternate.

Return value

TInt

KErrNone, if successful; otherwise, another of the system-wide error codes.

[Top]


Text drawing


DrawText()

virtual void DrawText(const TDesC& aString,const TPoint& aPosition)=0;

Description

Draws text without a surrounding box.

The text baseline is aligned with the y co-ordinate of the specified point, and the left end of the text is aligned with the left end of the text.

Note:

Parameters

const TDesC& aString

The text string to be drawn.

const TPoint& aPosition

A point specifying the position of the left end of the text.


DrawText()

virtual void DrawText(const TDesC& aString,const TRect& aBox,TInt aBaselineOffset,TTextAlign aHoriz=ELeft,TInt aLeftMrg=0)=0;

Description

Draws text inside a box.

The surrounding box is filled with the current brush colour (not a pattern) and is drawn without any outline. The effective box colour depends on the drawing mode — if a brush colour has not been set then the brush defaults to white. The brush may be set to TBrushStyle::ENullBrush if text positioning relative to a box is required, but the box should not be filled.

The font used is that set by UseFont(). If no font is in use then a panic occurs.

The alignment of the text within the box can be specified.

Text drawn within a box is also clipped to that box. Unless you intend to clip the top off the text, aBaselineOffset should be greater than or equal to the ascent of the current font.

Offsets:

Margins:

Note:

Parameters

const TDesC& aString

The text string to be drawn.

const TRect& aBox

The box to draw the text in.

TInt aBaselineOffset

An offset from the top of the box to the text baseline.

TTextAlign aHoriz

The text alignment mode — default is left aligned.

TInt aLeftMrg

The left margin for left-aligned text, or the right margin for right-aligned text — default is zero.


DrawText()

virtual void DrawText(const TDesC& aString,const TPoint& aPosition,const TDrawTextParam& aParam);

Support

Supported from 6.0

Description

Reserved for future use.

[Top]


Bitmap drawing

Description

The actual ‘real world’ size of a bitmap is given in twips. A bitmap also has x and y dimensions in pixels. There are therefore two ways that a bitmap can be drawn to a graphics device:


DrawBitmap()

virtual void DrawBitmap(const TPoint& aTopLeft,const CFbsBitmap* aSource)=0;

Description

Draws a bitmap at the specified point.

The point specifies the top left hand corner of the bitmap. The bitmap is compressed or stretched based on its internally stored size in twips.

Notes:

Parameters

const TPoint& aTopLeft

The point where the top left pixel of the bitmap is to be drawn

const CFbsBitmap* aSource

A source bitmap

See also:


DrawBitmap()

virtual void DrawBitmap(const TRect& aDestRect,const CFbsBitmap* aSource)=0;

Description

Draws a bitmap to fit a given rectangle.

The bitmap is compressed or stretched based on its internally stored size in pixels.

Notes:

Parameters

const TRect& aDestRect

The rectangle within which the bitmap is to be drawn.

const CFbsBitmap* aSource

A source bitmap.

See also:


DrawBitmap()

virtual void DrawBitmap(const TRect& aDestRect,const CFbsBitmap* aSource,const TRect& aSourceRect)=0;

Description

Draws a specified rectangle of a source bitmap to fit into a given destination rectangle.

Notes:

Parameters

const TRect& aDestRect

The rectangle within which the bitmap is to be drawn.

const CFbsBitmap* aSource

A source bitmap.

const TRect& aSourceRect

The rectangle in the source bitmap that is copied to the destination rectangle.

See also:

[Top]


Enumerations


Enum TBrushStyle

TBrushStyle

Description

Brush styles.

ENullBrush

The brush fill has no effect (default).

ESolidBrush

The brush fills with a solid single colour, determined by SetBrushColor() and the drawing mode.

EPatternedBrush

The brush fills with a selected bitmap pattern, set by UseBrushPattern().

EVerticalHatchBrush

The brush fills with vertical hatching — lines going from top to bottom.

EForwardDiagonalHatchBrush

The brush fills with diagonal hatching — lines going from bottom left to top right.

EHorizontalHatchBrush

The brush fills with horizontal hatching — lines going from left to right.

ERearwardDiagonalHatchBrush

The brush fills with rearward diagonal hatching — lines going from top left to bottom right.

ESquareCrossHatchBrush

The brush fills with horizontal and vertical hatching — lines going from left to right plus lines going from top to bottom — giving the effect of a grid of small squares

EDiamondCrossHatchBrush

The brush fills with forward diagonal and rearward diagonal hatching — lines going from bottom left to top right plus lines going from top left to bottom right — giving the effect of a grid of small diamonds.


Enum TDrawModeComponents

TDrawModeComponents

Description

Drawing mode components.

This enum is not intended to be used directly, but provides components for the easy specification of drawing modes in the TDrawMode enum.

EInvertScreen

1

EXor

2

EOr

4

EAnd

8

ELogicalOp

14

EInvertPen

16

EPenmode

32


Enum TDrawMode

TDrawMode

Description

Drawing modes.

This enum builds on the drawing mode components in the TDrawModeComponents enum.

If the pen colour is p, brush colour is b and screen colour is s, the effect of TDrawMode::EDrawModeAND is P=p&s and B=b&s. In other words, the effective colour of the pen on the screen, P, is that produced by the bitwise ANDing of the current screen colour and the current pen colour. The effect is similar for the effective brush colour, B.

The effective pen and brush colour are given in the table using the key

EDrawModeAND

Bitwise ANDs the pen and brush colours with the screen colour. P=p&s, B=b&s

EDrawModeNOTAND

Inverts the pen and brush colours before ANDing. P=(~p)&s, B=(~b)&s

EDrawModePEN

Uses both pen and brush colour as they are. P=p, B=b

EDrawModeANDNOT

Inverts the screen colour before ANDing. P=p&(~s), B=b&(~s)

EDrawModeXOR

Bitwise XORs the pen and brush colours with the screen colour. P=p^s, B=b^s

EDrawModeOR

Bitwise ORs the pen and brush colours with the screen colour. P=p|s, B=b|s

EDrawModeNOTANDNOT

Inverts the screen and pen and brush colours before ANDing. P=(~p)&(~s), B=(~b)&(~s)

EDrawModeNOTXOR

Inverts the pen and brush colours before XORing. P=(~p)^s, B=(~b)^s

EDrawModeNOTSCREEN

Inverts the colour of each pixel that is drawn over, (pen and brush attributes are ignored). P=~s, B=~s

EDrawModeNOTOR

Inverts the pen and brush colours before ORing. P=(~p)|s, B=(~b)|s

EDrawModeNOTPEN

Inverts the pen and brush colours. P=~p, B=~b

EDrawModeORNOT

Inverts the screen, pen and brush colours before ORing. P=p|(~s), B=b|(~s)

EDrawModeNOTORNOT

NOT OR NOT mode. P=(~p)|(~s), B=(~b)|(~s)


Enum TFillRule

TFillRule

Description

Rules used to fill self crossing polygons.

The filling of a polygon proceeds as follows: for a given point in the polygon, then

EAlternate

Only fill areas with odd winding numbers.

EWinding

Fill areas with winding numbers greater than zero.


Enum TPenStyle

TPenStyle

Description

Pen styles. The screen pattern unit in each definition below describes the pattern drawn by the line — 1 represents a pixel drawn, 0 represents a pixel that is not affected.

ENullPen

The pen does not draw. Screen pattern unit = 00…

ESolidPen

A solid line (default). Screen pattern unit = 11…

EDottedPen

A dotted line. Screen pattern unit = 1000…

EDashedPen

A dashed line. Screen pattern unit = 111000…

EDotDashPen

A line of alternating dashes and dots. Screen pattern unit = 1111001100...

EDotDotDashPen

A line of alternating single dashes and pairs of dots. Screen pattern unit = 11110011001100...


Enum TTextAlign

TTextAlign

Description

Text alignment.

ELeft

Text is left-aligned.

ECenter

Text is centred.

ERight

Text is right-aligned.


Struct TDrawTextParam

TDrawTextParam

Support

Supported from 6.0

Description

Reserved for future use.