03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Pen<br />

The pen defines draw modes (color and style). These are used for drawing lines, the<br />

outlines of filled shapes, and text.<br />

Draw mode options include Boolean operations on pixel color values – probably the only<br />

useful ones are solid (use the color specified), null (don't draw) and XOR with white (invert),<br />

which can be useful for cursor selection, rubber banding, and so on.<br />

Style options include solid, dotted, dashed, and also pen width. However, the BITGDI that<br />

draws screen graphics (that you saw in <strong>Chapter</strong> 9)doesn't support combinations of style and<br />

pen width – that is, it can't do thick dotted lines.<br />

Use the SetPenColor(), SetPenStyle(), and SetPenSize()member functions to<br />

control the pen. By default, the pen is black, solid, and one pixel thick.<br />

The brush defines fill and background color or pattern.<br />

Brush<br />

The brush can be null, solid, a hatching pattern, or a bitmap. For hatching and bitmaps, you<br />

can set an offset so that pattern fills on adjacent drawing primitives abut each other without<br />

odd edge effects. Use SetBrushStyle(), SetBrushColor(), SetBrushOrigin(),<br />

SetBrushPattern(), and DiscardBrushPattern() to control brush settings; defaults<br />

are null brush, zero origin.<br />

Font<br />

The font defines the font to be used for drawing text.<br />

You specify it by passing a CFont* to CGraphicsContext. We'll cover fonts properly in<br />

<strong>Chapter</strong> 15, but for now you note that the CONE environment has one font (iCoeEnv-<br />

>NormalFont()), while the Uikon environment contains several (iEikonEnv-<br />

>TitleFont(), LegendFont(), SymbolFont(), AnnotationFont(), and Dense-<br />

Font()). Use UseFont() to set a font, DiscardFont() to say you no longer wish to use<br />

that font, and SetUnderlineStyle() and Set-StrikethroughStyle() to set<br />

algorithmic enhancements to the font in use.<br />

By default, no font and no algorithmic enhancements are in use – you'll get panicked if you<br />

try to draw text without a font in use. You can find more information about the use of fonts in<br />

<strong>Chapter</strong> 15.<br />

Current position<br />

Current position is set by MoveTo() and various DrawXxxTo() member functions, and<br />

moved by MoveBy() and corresponding DrawXxxBy()functions. It is also affected by<br />

DrawPolyLine(). The XxxBy() functions support relative moving and drawing. By<br />

default, the current position is at (0, 0).<br />

Origin<br />

The origin defines the offset from the device origin that will be used for drawing and you can<br />

use SetOrigin() to control it. By default, the origin is (0, 0).<br />

Clipping region

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!