pathpcs.cpp

Go to the documentation of this file.
00001 // $Id: pathpcs.cpp 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // pathpcs - Definition of rendering PathProcessor class
00099 
00100 #include "camtypes.h"
00101 
00102 #include "pathpcs.h"
00103 
00104 //#include "paths.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 
00106 CC_IMPLEMENT_DYNAMIC(PathProcessor, CCObject);
00107 
00108 // Declare smart memory handling in Debug builds
00109 #define new CAM_DEBUG_NEW
00110 
00111 
00112 
00113 /********************************************************************************************
00114 
00115 >   PathProcessor::PathProcessor()
00116 
00117     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00118     Created:    20/12/96
00119 
00120     Purpose:    Constructor
00121 
00122 ********************************************************************************************/
00123 
00124 PathProcessor::PathProcessor()
00125 {
00126     NextProcessor = NULL;
00127     ParentAttr    = NULL;
00128     m_DisableMe   = FALSE;
00129 }
00130 
00131 
00132 
00133 /********************************************************************************************
00134 
00135 >   virtual PathProcessor::~PathProcessor()
00136 
00137     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00138     Created:    20/12/96
00139 
00140     Purpose:    Destructor
00141     
00142     Errors:     If this object still has a non-NULL Next pointer, it will ERROR3 in
00143                 an effort to get you to clean up properly before destruction.
00144 
00145 ********************************************************************************************/
00146 
00147 PathProcessor::~PathProcessor()
00148 {
00149     ERROR3IF(NextProcessor != NULL, "PathProcessor deleted while still possibly held in stack");
00150 }
00151 
00152 
00153 
00154 /********************************************************************************************
00155 
00156 >   virtual BOOL PathProcessor::WillChangeFillAndStrokeSeparately(void)
00157 
00158     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00159     Created:    20/12/96
00160 
00161     Purpose:    Called by the RenderRegion to determine if this PathProcessor affects
00162                 the "fill" and "stroke" portions of the path separately. (Generally
00163                 speaking, only fill/stroke providers will cause these two different
00164                 "bits" of a path to be rendered separately). This call is made BEFORE
00165                 this Processor's ProcessPath function will be called.
00166 
00167                 If the caller gets a TRUE back, the stroke and fill paths will be
00168                 rendered separately.
00169 
00170     Notes:      Base class implementation returns FALSE. Derived Stroke and Fill
00171                 processors should probably override this method to return TRUE.
00172 
00173 ********************************************************************************************/
00174 
00175 BOOL PathProcessor::WillChangeFillAndStrokeSeparately(void)
00176 {
00177     return(FALSE);
00178 }
00179 
00180 
00181 
00182 /********************************************************************************************
00183 
00184 >   virtual void PathProcessor::ProcessPath(Path *pPath, RenderRegion *pRender) = 0;
00185 
00186     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00187     Created:    20/12/96
00188 
00189     Purpose:    ABSTRACT FUNCTION - see derived classes
00190 
00191                 Called by the RenderRegion to apply the path processing operation to 
00192                 the given path.
00193 
00194     Notes:      * When rendering a path, always pass in your 'this' pointer to
00195                   RenderRegion::DrawPath, so that you don't start an infinite
00196                   recursion!
00197 
00198                 * To stop rendering of the path, simply return without calling the RR
00199 
00200                 * To render this path unchanged, simply call directly back to the RR:
00201                     pRender->DrawPath(pPath, this);
00202                 
00203                 * Only affect the fill of this path if pPath->IsFilled
00204 
00205                 * Only affect the stroke of this path if pPath->IsStroked
00206 
00207                 * If converting a path into a "filled path" for stroking, the output
00208                   path should be rendered with IsStroked=FALSE or it'll get a line
00209                   around the outside!               
00210 
00211                 * If you render any attributes, etc, then you should preserve the
00212                   render region state with calls to SaveContext() and RestoreContext()
00213 
00214 ********************************************************************************************/
00215 
00216 
00217 /********************************************************************************************
00218 
00219 >   virtual BOOL PathProcessor::DoesActuallyDoAnything(RenderRegion* pRender)
00220 
00221     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00222     Created:    1/10/2000
00223     Inputs:     pRender - pointer to the render region that we are about to render our path into
00224     Returns:    TRUE if it is anticipated that this path processor will alter the path in any
00225                 way, FALSE if not
00226     Purpose:    To determine whether or not our path processor is 'default' i.e. if does not 
00227                 change the path at all.  If so then the render region will be free to use
00228                 DrawPathToOutputDevice which will let us use dash patterns, arrowheads etc.
00229     
00230     Errors:     
00231 
00232 ********************************************************************************************/
00233 
00234 BOOL PathProcessor::DoesActuallyDoAnything(RenderRegion* pRender)
00235 {
00236     return !m_DisableMe;
00237 }
00238 
00239 
00240 /********************************************************************************************
00241 
00242 >   void PathProcessor::SetDisabled(BOOL Value)
00243 
00244     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00245     Created:    1/10/00
00246     Inputs:     Whether or not to disable this PPB
00247 
00248     Purpose:    Sets the flag which we use to determine whether or not we should do anything
00249                 when it comes to rendering.
00250 
00251 ********************************************************************************************/
00252 
00253 void PathProcessor::SetDisabled(BOOL Value)
00254 {
00255     m_DisableMe = Value;
00256 }
00257 
00258 
00259 /********************************************************************************************
00260 
00261 >   BOOL PathProcessor::IsDisabled()
00262 
00263     Author:     Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
00264     Created:    1/10/00
00265     Inputs:     -
00266     Returns:    Whether or not we are disabled
00267     Purpose:    
00268 
00269 ********************************************************************************************/
00270 
00271 BOOL PathProcessor::IsDisabled()
00272 {
00273     return m_DisableMe;
00274 }

Generated on Sat Nov 10 03:46:26 2007 for Camelot by  doxygen 1.4.4