blndhelp.h

Go to the documentation of this file.
00001 // $Id: blndhelp.h 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 // ppbevel - Definition of Blend helper class
00099 
00100 #ifndef INC_BLENDHELP
00101 #define INC_BLENDHELP
00102 
00103 //#include "becomea.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 #include "pathpcs.h"
00105 
00106 class BlendNodeParam;
00107 class NodeCompound;
00108 
00109 /********************************************************************************************
00110 
00111 >   class BlendHelpers : public CCObject
00112 
00113     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com> Mc
00114     Created:    23/2/2000
00115 
00116     Purpose:    This encapsulates the blend functions which are needed to blend compound
00117                 nodes (e.g. shadows etc)
00118 
00119     SeeAlso:    NodeRenderableInk::Blend
00120 
00121 ********************************************************************************************/
00122 class BlendHelpers : public CCObject
00123 {
00124     CC_DECLARE_DYNAMIC(BlendHelpers);
00125 
00126 public:
00127     BlendHelpers();
00128     ~BlendHelpers();
00129 
00130     // the blending code (stripped from NodeBlender)
00131     // get the attribute map at a particular blend step
00132     BOOL BlendAttributes(BlendNodeParam * pParam, CCAttrMap * pAttrMap);
00133 
00134     // gives the path at a particular blend step
00135     BOOL BlendPaths(BlendNodeParam * pParam, Path * pPath);
00136 
00137 private:
00138     Trans2DMatrix* GetRotateMatrix(NodeRenderableBounded* pNode,double Angle);
00139 
00141     // Access funcs for the path arrays
00142     // Straight out of the blender
00143     DocCoord*   GetCoordArray(UINT32 MinSize);
00144     PathVerb*   GetVerbArray(UINT32 MinSize);
00145     PathFlags*  GetFlagArray(UINT32 MinSize);
00146     UINT32*         GetGBlendBuff(UINT32 MinSize);
00147 
00148     BOOL        ReallocTempBuffers(UINT32 Size);
00149     void        DeallocTempBuffers();
00150 
00151     // The following set of vars deal with arrays that are set up by the PreBlend() routine
00152     // Also, these arrays can also change by calls to the access funcs GetCoordArray(), GetVerbArray() and GetFlagArray()
00153     UINT32      m_TempArraySize;
00154     DocCoord*   m_pTempCoords;
00155     PathVerb*   m_pTempVerbs;
00156     PathFlags*  m_pTempFlags;
00157     UINT32      m_GBlendBuffSize;
00158     UINT32*     m_pGBlendBuff;
00159     UINT32      m_ArrayLength;
00160 } ;
00161 
00162 /********************************************************************************************
00163 
00164 >   class CompoundNodeBlendBecomeA : public BecomeA
00165 
00166     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com> Mc
00167     Created:    23/2/2000
00168 
00169     Purpose:    Gets the compound node to wrap up any nodes passed to the passback in a
00170                 copy of its tree structure
00171 
00172     SeeAlso:    NodeRenderableInk::Blend
00173 
00174 ********************************************************************************************/
00175 class CompoundNodeBlendBecomeA : public BecomeA
00176 {
00177 public:
00178     // inputs -
00179     // pCompound    -   the compound node
00180     //
00181     CompoundNodeBlendBecomeA(BecomeAReason Reason,
00182                     CCRuntimeClass* pClass, 
00183                     UndoableOperation* pOp, 
00184                     BOOL Sel,
00185                     NodeCompound * pCompound,
00186                     BecomeA * pBecomeA) : BecomeA(Reason, pClass, pOp, Sel)
00187     {
00188         m_pCompound  = pCompound;
00189         m_pBecomeA   = pBecomeA;
00190 //      m_Count = 0;
00191         m_NumPathNodes = 0;
00192     }                   
00193 
00194     BOOL IsCompoundBlendBecomeA() { return TRUE; }
00195 
00196     BOOL PassBack(NodeRenderableInk* pNewNode,
00197         NodeRenderableInk* pCreatedByNode,
00198         CCAttrMap* pAttrMap=NULL);
00199 
00200 //  void ResetCount() { m_Count = 0; }
00201     void SetNumPathNodes(UINT32 NumPaths) { m_NumPathNodes = NumPaths; }
00202 
00203 
00204 private:
00205     NodeCompound      * m_pCompound;
00206     BecomeA           * m_pBecomeA;
00207 //  UINT32              m_Count; // how many nodes we have converted
00208     UINT32              m_NumPathNodes; // how many nodes we are going to convert on this pass
00209 } ;
00210 
00211 /********************************************************************************************
00212 
00213 >   class SumAllPathsElem : public ListItem
00214 
00215     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00216     Created:    22/2/2000
00217     Purpose:    Element for the list in SumAllPathsPathProcessor
00218 ********************************************************************************************/
00219 class SumAllPathsElem : public ListItem
00220 {
00221     CC_DECLARE_DYNCREATE(SumAllPathsElem);
00222 
00223 public:
00224     SumAllPathsElem()
00225     {
00226         m_pAttrMap = NULL;
00227         m_Path.Initialise();
00228     }
00229 
00230     SumAllPathsElem(Path * pPath, CCAttrMap * pAttrMap);
00231     ~SumAllPathsElem();
00232 
00233     Path * GetPath() { return &m_Path; }
00234     CCAttrMap * GetAttrMap() { return m_pAttrMap; }
00235 private:
00236     Path m_Path;
00237     CCAttrMap* m_pAttrMap;
00238 } ;
00239 
00240 /********************************************************************************************
00241 
00242 >   class SumAllPathsPathProcessor : public PathProcessor
00243 
00244     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00245     Created:    22/2/2000
00246     Purpose:    All paths are placed in the linked list, with their associated attribute
00247                 maps
00248 ********************************************************************************************/
00249 class SumAllPathsPathProcessor : public PathProcessor
00250 {
00251     CC_DECLARE_DYNAMIC(SumAllPathsPathProcessor);
00252 public:
00253     // inputs - whether we should draw the path passed into the ProcessPath or not
00254     SumAllPathsPathProcessor(BOOL bDrawOriginalPaths = FALSE);
00255     
00256     ~SumAllPathsPathProcessor();
00257 
00258     virtual void ProcessPath(Path *pPath,
00259                              RenderRegion *pRender,
00260                              PathShape ShapePath = PATHSHAPE_PATH);
00261 
00262     List * GetList() { return &PathList; }
00263 
00264     void SetEnabled(BOOL bEnabled) { m_bEnabled = bEnabled; }
00265 
00266     // CGS:  we need to be to insert paths into the list when doing convert to editable shapes
00267     // (this is due to the fact that we don't have a RenderRegion - and therefore cannot push
00268     // a path processor!)
00269     void InsertSumAllPathsElem (SumAllPathsElem* newElem);
00270 
00271 private:
00272     List PathList;
00273     BOOL m_bDrawPaths;
00274     BOOL m_bEnabled;
00275 } ;
00276 
00277 
00278 
00279 #endif
00280 

Generated on Sat Nov 10 03:44:24 2007 for Camelot by  doxygen 1.4.4