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

Path.hh

Go to the documentation of this file.
00001 /*
00002     libpdf++: a C++ Free library to generate PDF file
00003     Copyright (C) 2002 Nestal Wan
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2.1 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00026 #ifndef __PDF_GRAPH_PATH_HEADER_INCLUDED__
00027 #define __PDF_GRAPH_PATH_HEADER_INCLUDED__
00028 
00029 #ifndef __PDF_GRAPH_STATE_HEADER_INCLUDED__
00030 #include "State.hh"
00031 #endif
00032 
00033 #include <boost/smart_ptr.hpp>
00034 #include <vector>
00035 #include <iosfwd>
00036 
00037 namespace pdf { namespace graph {
00038 
00039 // forward declarations
00040 class CNode ;
00041 
00048 class CPath
00049 {
00050 public :
00051 
00053     enum EPaintOp
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     } ;
00086     
00087 private :
00088     typedef boost::shared_ptr<CNode> CNodePtr ;
00089     typedef std::vector<CNodePtr>    CNodeVec ;
00090     
00091     CNodeVec m_nodes ;          
00092     CState   m_state ;          
00093 
00094     EPaintOp m_paint_op ;       
00095     
00096 public :
00097     explicit CPath( const CState& state = CState( ), EPaintOp op = stoke ) ;
00098     ~CPath( ) ;
00099 
00100     // attributes
00101     const CState& State( ) const { return m_state ; }
00102 
00103     // path operations  
00104     void MoveTo( double x, double y ) ;
00105     void LineTo( double x, double y ) ;
00106     void BezierCubic( double x1, double y1, double x2, double y2,
00107                       double x3, double y3 ) ;
00108     void BezierCubic1( double x1, double y1, double x3, double y3 ) ;
00109     void BezierCubic2( double x2, double y2, double x3, double y3 ) ;
00110 
00111     void ReturnToStart( ) ;
00112 
00113     void PaintOp( EPaintOp op ) ;
00114     
00115     std::ostream& Write( std::ostream& os, const CState& prev ) const ;
00116 
00117 private :
00118 #ifdef _DEBUG
00119     bool IsValid( ) const ;
00120 #endif
00121 } ;
00122 
00123 } } // end of namespace
00124 
00125 #endif

Generated on Sun Feb 2 09:16:05 2003 for libpdf++ by doxygen1.2.16