03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The clipping region defines the region to which you want your graphics to be clipped.<br />

You can specify a simple rectangle or a region that may be arbitrarily complex. Use<br />

SetClippingRect() to set a rectangular clipping region and CancelClippingRect()<br />

to cancel it. By default, no clipping region (other than the device limits) applies.<br />

Justification<br />

Specialized justification settings for a variant of DrawText() can be set, although it's best<br />

not to call these directly from your own code. Instead, use the FORM component in Symbian<br />

OS to create text views for you.<br />

Use Reset() to set all contexts to default values.<br />

11.2.3 Drawing Functions<br />

Once you’ve set up the GC to your liking, there are numerous ways to draw to the screen. All<br />

GC functions are virtual so they can be implemented in derived classes. Furthermore, all GC<br />

functions are designed to succeed and so don’t return anything (in C++ declarations, they<br />

return void). This requirement is such that multiple GC commands can be batched into a<br />

single message and sent to a server for execution – this would not be possible if any GC<br />

command had a return value.<br />

Note that line drawing (including arcs and the last line in a polyline) excludes the last point of<br />

the line. As with the specification of TRect,this is a mixed blessing: sometimes it makes<br />

things easier, sometimes harder. If the last pixel was plotted automatically, it would be<br />

harder to unplot it in the cases in which this behavior was not desired. However, it's easy<br />

enough to fix tricky cases by using Plot().<br />

Check out the SDK for the interpretation of DrawArc() parameters. DrawPolyLine()<br />

starts at the current cursor position set with MoveTo(), any XxxTo() or XxxBy() function,<br />

or DrawPolyLine(). Effectively, DrawPolyLine() uses DrawLineTo() to draw to every<br />

point specified.<br />

Points and lines<br />

You can plot a single point or draw an arc, a line, or a polyline. These functions all use the<br />

current pen; here are their declarations in gdi.h:<br />

virtual void MoveTo(const TPoint& aPoint) = 0;<br />

virtual void MoveBy(const TPoint& aVector) = 0;<br />

virtual void Plot(const TPoint& aPoint) = 0;<br />

virtual void DrawArc(const TRect& aRect,<br />

const TPoint& aStart,<br />

const TPoint& aEnd) = 0;<br />

virtual void DrawLine(const TPoint& aPoint1,<br />

const TPoint& aPoint2) = 0;<br />

virtual void DrawLineTo(const TPoint& aPoint) = 0;<br />

virtual void DrawLineBy(const TPoint& aVector) = 0;<br />

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

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

Saved successfully!

Ooh no, something went wrong!