Canvas Class Reference
[Basic Vector Graphics]

#include <Canvas.hpp>

Inheritance diagram for Canvas:

Inheritance graph
[legend]
Collaboration diagram for Canvas:

Collaboration graph
[legend]
List of all members.

Detailed Description

This is an abstract class for canvases in which you can draw.

This will be extended by VGImage and Frame.

Definition at line 53 of file Canvas.hpp.

Public Member Functions

 Canvas ()
 Constructors/Destructors.
 ~Canvas ()
void setLineStyle (const StrokeStyle &newStyle)
 Set the default line style.
void removeLineStyle (void)
 Removes default line style so lines are drawn in the default style for the stream.
virtual void setMarker (const Marker &newMarker)
 Sets the default marker style.
virtual void removeMarker (void)
 Removes default marker style so lines are drawn in the default style for the stream.
void setTextStyle (const TextStyle &newStyle)
 Sets the default text style.
void removeTextStyle (void)
 Removes default text style so text is drawn in the default style for the stream.
void setFillColor (const Color &newColor)
 Sets the default fill color.
void removeFillColor (void)
 Removes default fill color so shapes are drawn empty.
virtual void line (double x1, double y1, double x2, double y2)
 Draws a simple line segment connecting two points.
virtual void line (const Line &line)=0
 Draws a series of line segments, defined by the path variable.
virtual void rectangle (const Rectangle &rect)=0
 Draws a simple rectangle using two points.
virtual void circle (const Circle &circle)=0
 Draws a simple circle using a point and a radius.
virtual void text (const Text &text)=0
 Draws text.
virtual void polygon (const Polygon &polygon)=0
 Draws a polygon, defined by the path variable.
virtual void bitmap (const Bitmap &bitmap)=0
 Adds a bitmap.
virtual void comment (const Comment &comment)=0
 Adds a comment.
virtual void comment (const char *format,...)
 Adds a comment.
void push_state ()
 Pushes the current state information on the stack.
void pop_state ()
 Pops the topmost state off of the state stack and returns it to the current default settings.
double up ()
 newy = y + c.up()*dy
virtual bool isLL ()=0

Public Attributes

std::vector< VGState * > stateStack
 The state stack.
VGStatedefaults
 The current default state settings.

Friends

Canvasoperator<< (Canvas &canvas, const StrokeStyle &style)
 Changes the appearance of lines in the stream.
Canvasoperator<< (Canvas &canvas, const Marker &marker)
 Changes the appearance of line points in the stream.
Canvasoperator<< (Canvas &canvas, const TextStyle &style)
 Changes the appearance of text in the stream.
Canvasoperator<< (Canvas &canvas, const Color &color)
 Changes the fill color of objects in the stream.
Canvasoperator<< (Canvas &canvas, const Line &line)
 Outputs the specified line to the stream.
Canvasoperator<< (Canvas &canvas, const char *comment)
 Outputs a comment to the stream.
Canvasoperator<< (Canvas &canvas, const Comment &comment)
 Outputs a comment to the stream.
Canvasoperator<< (Canvas &canvas, const Rectangle &rect)
 Outputs the specified rectangle to the stream.
Canvasoperator<< (Canvas &canvas, const Circle &circle)
 Outputs the specified circle to the stream.
Canvasoperator<< (Canvas &canvas, const Text &text)
 Outputs the specified text to the stream.
Canvasoperator<< (Canvas &canvas, const Polygon &polygon)
 Outputs the specified polygon to the stream.
Canvasoperator<< (Canvas &canvas, const Bitmap &bitmap)
 Outputs the specified polygon to the stream.


Constructor & Destructor Documentation

Canvas  ) 
 

Constructors/Destructors.

Definition at line 40 of file Canvas.cpp.

References Canvas::defaults.

~Canvas  ) 
 

Definition at line 45 of file Canvas.cpp.

References Canvas::defaults, and Canvas::stateStack.


Member Function Documentation

virtual void bitmap const Bitmap bitmap  )  [pure virtual]
 

Adds a bitmap.

Parameters:
bitmap Rasterized image to be added to the file

virtual void circle const Circle circle  )  [pure virtual]
 

Draws a simple circle using a point and a radius.

Parameters:
circle Circle to draw

virtual void comment const char *  format,
  ...
[inline, virtual]
 

Adds a comment.

Parameters:
format Format string (printf style)
... Other arguments for printf.

Definition at line 266 of file Canvas.hpp.

virtual void comment const Comment comment  )  [pure virtual]
 

Adds a comment.

Parameters:
comment Comment to be added to the file

virtual bool isLL  )  [pure virtual]
 

Returns:
true if the origin is lower left, false otherwise

Implemented in VGImage.

virtual void line const Line line  )  [pure virtual]
 

Draws a series of line segments, defined by the path variable.

Parameters:
line Line containing list of points that define the line

virtual void line double  x1,
double  y1,
double  x2,
double  y2
[inline, virtual]
 

Draws a simple line segment connecting two points.

Parameters:
x1 x-coordinate of the starting point
y1 y-coordinate of the starting point
x2 x-coordinate of the end point
y2 y-coordinate of the end point

Definition at line 214 of file Canvas.hpp.

virtual void polygon const Polygon polygon  )  [pure virtual]
 

Draws a polygon, defined by the path variable.

Parameters:
polygon Polygon containing points that define the edges of the polygon

void pop_state  )  [inline]
 

Pops the topmost state off of the state stack and returns it to the current default settings.

If the state stack is empty, default is reset.

Definition at line 289 of file Canvas.hpp.

void push_state  )  [inline]
 

Pushes the current state information on the stack.

This is so helper methods and classes can push the state and pop the state in order to not interfere or accidentally use the defaults of the calling function.

Definition at line 279 of file Canvas.hpp.

virtual void rectangle const Rectangle rect  )  [pure virtual]
 

Draws a simple rectangle using two points.

Parameters:
rect Rectangle to draw

void removeFillColor void   )  [inline]
 

Removes default fill color so shapes are drawn empty.

Definition at line 204 of file Canvas.hpp.

void removeLineStyle void   )  [inline]
 

Removes default line style so lines are drawn in the default style for the stream.

Definition at line 160 of file Canvas.hpp.

virtual void removeMarker void   )  [inline, virtual]
 

Removes default marker style so lines are drawn in the default style for the stream.

Definition at line 175 of file Canvas.hpp.

void removeTextStyle void   )  [inline]
 

Removes default text style so text is drawn in the default style for the stream.

Definition at line 190 of file Canvas.hpp.

void setFillColor const Color newColor  )  [inline]
 

Sets the default fill color.

Doesn't necessarily generate output on the stream until something filled is drawn.

Parameters:
newColor New fill color

Definition at line 198 of file Canvas.hpp.

void setLineStyle const StrokeStyle newStyle  )  [inline]
 

Set the default line style.

Doesn't necessarily generate output on the stream until a new line is drawn.

Parameters:
newStyle New appearance of the line

Definition at line 153 of file Canvas.hpp.

virtual void setMarker const Marker newMarker  )  [inline, virtual]
 

Sets the default marker style.

Doesn't necessarily generate output on the stream until a new line is drawn.

Parameters:
newMarker New default marker appearance

Definition at line 168 of file Canvas.hpp.

void setTextStyle const TextStyle newStyle  )  [inline]
 

Sets the default text style.

Doesn't necessarily generate output on the stream until new text is drawn.

Parameters:
newStyle New appearance of the text

Definition at line 183 of file Canvas.hpp.

virtual void text const Text text  )  [pure virtual]
 

Draws text.

Parameters:
text Text to draw

double up  )  [inline]
 

newy = y + c.up()*dy

Returns:
a multiplier that is 1 if up is positive and -1 if not

Definition at line 305 of file Canvas.hpp.


Friends And Related Function Documentation

Canvas& operator<< Canvas canvas,
const Bitmap bitmap
[friend]
 

Outputs the specified polygon to the stream.

Definition at line 133 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const Polygon polygon
[friend]
 

Outputs the specified polygon to the stream.

Definition at line 126 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const Text text
[friend]
 

Outputs the specified text to the stream.

Definition at line 119 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const Circle circle
[friend]
 

Outputs the specified circle to the stream.

Definition at line 112 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const Rectangle rect
[friend]
 

Outputs the specified rectangle to the stream.

Definition at line 105 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const Comment comment
[friend]
 

Outputs a comment to the stream.

Definition at line 98 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const char *  comment
[friend]
 

Outputs a comment to the stream.

Definition at line 91 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const Line line
[friend]
 

Outputs the specified line to the stream.

Definition at line 84 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const Color color
[friend]
 

Changes the fill color of objects in the stream.

Definition at line 77 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const TextStyle style
[friend]
 

Changes the appearance of text in the stream.

Definition at line 70 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const Marker marker
[friend]
 

Changes the appearance of line points in the stream.

Definition at line 63 of file Canvas.hpp.

Canvas& operator<< Canvas canvas,
const StrokeStyle style
[friend]
 

Changes the appearance of lines in the stream.

Definition at line 56 of file Canvas.hpp.


Member Data Documentation

VGState* defaults
 

The current default state settings.

Definition at line 316 of file Canvas.hpp.

Referenced by Canvas::Canvas(), and Canvas::~Canvas().

std::vector<VGState*> stateStack
 

The state stack.

Definition at line 313 of file Canvas.hpp.

Referenced by Canvas::~Canvas().


The documentation for this class was generated from the following files:
Generated on Sun May 19 03:31:56 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1