Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

pdf::graph::CPath Class Reference

a class represent a path in a PDF document More...

#include <Path.hh>

Collaboration diagram for pdf::graph::CPath:

Collaboration graph
[legend]
List of all members.

Public Types

Public Methods

Private Types

Private Attributes


Detailed Description

a class represent a path in a PDF document

a path is a line with specified properties, e.g. line colour, fill colour. it will contain vertices also.


Member Enumeration Documentation

enum pdf::graph::CPath::EPaintOp
 

an enum to specify how to paint the path.

Enumeration values:
stoke  stroke the path
close_stoke  close and stroke the path
fill_non_zero  fill the path, using the nonzero winding number rule to determine the region to fill.
fill_even_odd  fill the path,using the even-odd rule to determine the region to fill.
fill_stoke_non_zero  fill and then stroke the path, using the nonzero winding number rule to determine the region to fill.
fill_stoke_even_odd  fill and then stroke the path, using the even-odd rule to determine the region to fill.
close_fill_stoke_non_zero  close, fill,and then stroke the path, using the nonzero winding number rule to determine the region to fill.
close_fill_stoke_even_odd  close, fill,and then stroke the path, using the even-odd rule to determine the region to fill.
no_op  End the path object without lling or stroking it. this operator is a path-painting no-op, used primarily for the side effect of changing the current clipping path

00054     {
00055         stoke,                     
00056 
00057         close_stoke,               
00058 
00059         fill_non_zero,             
00060 
00061 
00062 
00063         fill_even_odd,             
00064 
00065 
00066         fill_stoke_non_zero,       
00067 
00068 
00069 
00070         fill_stoke_even_odd,       
00071 
00072 
00073         
00074         close_fill_stoke_non_zero, 
00075 
00076 
00077         
00078         close_fill_stoke_even_odd, 
00079 
00080 
00081 
00082         no_op 
00083 
00084 
00085     } ;


Constructor & Destructor Documentation

pdf::graph::CPath::CPath const CState   state = CState( ),
EPaintOp    op = stoke
[explicit]
 

initialize a path by setting the paint operation and the state of this path.

00052     : m_state( state ), m_paint_op( op )
00053 {
00054     assert( IsValid( ) ) ;
00055 }

pdf::graph::CPath::~CPath  
 

destructor does nothing

00060 {
00061     assert( IsValid( ) ) ;
00062 }


Member Function Documentation

void pdf::graph::CPath::MoveTo double    x,
double    y
 

begin a new subpath by moving the current point to coordinates (x y), omitting any connecting line segment.

00068 {
00069     assert( IsValid( ) ) ;
00070 
00071     m_nodes.push_back( CNodePtr( new CNode2( x, y, "m" ) ) ) ;
00072 
00073     assert( IsValid( ) ) ;
00074 }

void pdf::graph::CPath::LineTo double    x,
double    y
 

append a straight line segment from the current point to the point (x y). the new current point is (x y).

00080 {
00081     assert( IsValid( ) ) ;
00082 
00083     m_nodes.push_back( CNodePtr( new CNode2( x, y, "l" ) ) ) ;
00084 
00085     assert( IsValid( ) ) ;
00086 }

void pdf::graph::CPath::BezierCubic double    x1,
double    y1,
double    x2,
double    y2,
double    x3,
double    y3
 

append a cubic Bézier curve to the current path.The curve extends from the current point to the point (x3 ,y3), using (x1 ,y1) and (x2 ,y2) as the Bézier control points. the new current point is (x3, y3).

00134 {
00135     double array[6] = { x1, y1, x2, y2, x3, y3 } ;
00136     m_nodes.push_back( CNodePtr( new CNodes( array, array + 6, "c" ) ) ) ;
00137 }

void pdf::graph::CPath::BezierCubic1 double    x1,
double    y1,
double    x3,
double    y3
 

append a cubic Bézier curve to the current path.The curve extends from the current point to the point (x3, y3), using (x1, y1) and (x3, y3) as the Bézier control points. the new current point is (x3, y3).

00144 {
00145     double array[4] = { x1, y1, x3, y3 } ;
00146     m_nodes.push_back( CNodePtr( new CNodes( array, array + 4, "y" ) ) ) ;
00147 }

void pdf::graph::CPath::ReturnToStart  
 

close the current subpath by appending a straight line segment from the current point to the starting point of the subpath.

00109 {
00110     assert( IsValid( ) ) ;
00111 
00112     m_nodes.push_back( CNodePtr( new COperator( "h" ) ) ) ;
00113 
00114     assert( IsValid( ) ) ;
00115 }

void pdf::graph::CPath::PaintOp EPaintOp    op
 

change the paint operation.

00120 {
00121     assert( IsValid( ) ) ;
00122     
00123     m_paint_op = op ;
00124     
00125     assert( IsValid( ) ) ;
00126 }

std::ostream & pdf::graph::CPath::Write std::ostream &    os,
const CState   prev
const
 

write the path object to a output stream

00091 {
00092     assert( IsValid( ) ) ;
00093 
00094     using namespace boost::lambda ;
00095     using namespace std ;
00096 
00097     m_state.Print( os, prev ) ;
00098 
00099     transform( m_nodes.begin( ), m_nodes.end( ),
00100                ostream_iterator<CNode>( os, "\n" ), ret<const CNode&>( *_1 ) ) ;
00101 
00102     return os << paint_ops[m_paint_op] << '\n' ;
00103 }


Member Data Documentation

CNodeVec pdf::graph::CPath::m_nodes [private]
 

a vector of nodes, making the path.

CState pdf::graph::CPath::m_state [private]
 

the graphic state of the path.

EPaintOp pdf::graph::CPath::m_paint_op [private]
 

the paint operation


The documentation for this class was generated from the following files:
Generated on Sun Feb 2 09:17:27 2003 for libpdf++ by doxygen1.2.16