00001 // $Id: ndbrshmk.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 00099 //Nodebrushmaker class 00100 00101 #ifndef INC_NDBRSHMK 00102 #define INC_NDBRSHMK 00103 00104 //#include "tranform.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00105 //#include "doccoord.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00106 //#include "docrect.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00107 //#include "ink.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00108 //#include "paths.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00109 #include "blendatt.h" 00110 #include "nodebldr.h" 00111 //#include "trans2d.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00112 #include "brushref.h" 00113 #include "brshcomp.h" 00114 00115 class RenderRegion; 00116 class GRenderBrush; 00117 class Spread; 00118 class BecomeA; 00119 class HandleBecomeA; 00120 class CCAttrMap; 00121 class Progress; 00122 class BaseCamelotFilter; 00123 00124 class NodeBrush; 00125 class NodeBrushPath; 00126 class CPathPointInfo; 00127 00128 /* 00129 enum PathOffset {OFFSET_NONE, 00130 OFFSET_ALTERNATE, 00131 OFFSET_LEFT, 00132 OFFSET_RIGHT, 00133 OFFSET_RANDOM}; 00134 00135 const MILLIPOINT MIN_BRUSH_SPACING = 10; 00136 const MILLIPOINT MAX_BRUSH_SPACING = 10000; 00137 const UINT32 MAX_BRUSH_OBJECTS = 20; 00138 */ 00139 00140 00141 00142 00143 00144 /******************************************************************************************** 00145 00146 > class NodeBrushMaker: public NodeRenderableInk 00147 00148 Author: Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com> 00149 Created: 2/10/99 00150 Purpose: The NodeBrushMaker class 00151 00152 ********************************************************************************************/ 00153 00154 class NodeBrushMaker : public NodeRenderableInk 00155 { 00156 CC_DECLARE_DYNCREATE(NodeBrushMaker); 00157 00158 public: 00159 typedef std::vector< CPathPointInfo > CListOfPointsToRender; 00160 00161 public: 00162 NodeBrushMaker(); 00163 NodeBrushMaker(Node* ContextNode, 00164 AttachNodeDirection Direction, 00165 BOOL Locked=FALSE, 00166 BOOL Mangled=FALSE, 00167 BOOL Marked=FALSE, 00168 BOOL Selected=FALSE 00169 ); 00170 00171 ~NodeBrushMaker(); 00172 00173 BOOL InitialiseInk(NodeRenderableInk** pInkNode, const UINT32 NumInkNodes = 1, Progress* pProgress = NULL); 00174 BOOL InitialisePath(NodeBrushPath* pBrushPath); 00175 void InitialiseBrushArray(UINT32 NumObjects); 00176 // get the bounding rect 00177 virtual DocRect GetBoundingRect(BOOL DontUseAttrs = FALSE, BOOL HitTest = FALSE); 00178 virtual DocRect GetBlobBoundingRect(); 00179 00180 // the main render function 00181 virtual void Render(RenderRegion* pRender); 00182 00183 // blob rendering 00184 // void RenderObjectBlobs(RenderRegion* pRender); 00185 00186 00187 virtual void RenderEorDrag( RenderRegion* ); 00188 // require transparency ? 00189 // virtual BOOL NeedsTransparency() const; 00190 00191 // virtual String Describe(BOOL Plural, BOOL Verbose = TRUE); 00192 00193 // transformation function 00194 virtual void Transform( TransformBase& Trans ); 00195 00196 // Version 2 file format functions 00197 // virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter); 00198 // virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter); 00199 00200 // Information functions 00201 virtual UINT32 GetNodeSize() const; // Returns size of node in bytes 00202 00203 00204 00205 // access functions 00206 BOOL SetPositionRandomness(double Value); 00207 BOOL SetAttributeRandomness(double Value); 00208 BOOL SetSizeRandomness(double Value); 00209 BOOL SetAlignmentRandomness(double Value); 00210 00211 double GetPositionRandomness(); 00212 double GetAttrRandomness(); 00213 double GetSizeRandomness(); 00214 double GetAlignmentRandomness(); 00215 00216 void SetGRenderBitmap(GRenderBrush* pGRenderBitmap); 00217 MILLIPOINT GetBrushSpacing(); 00218 BOOL SetBrushSpacing(MILLIPOINT Spacing); 00219 PathOffset GetPathOffsetType(); 00220 MILLIPOINT GetPathOffsetValue(); 00221 void SetPathOffsetType(PathOffset Offset); 00222 void SetPathOffsetValue(MILLIPOINT Value); 00223 void SetBlendRef(BlendRef* pBlendRef); 00224 BOOL GetRotated(); 00225 void SetRotated(BOOL Rotate); 00226 void SetUsePathCache(BOOL Value); 00227 00228 void SetNumberOfSteps(INT32 Steps); 00229 BOOL GetStartCoord(DocCoord* Coord); 00230 void SetStartCoord(DocCoord Coord); 00231 void RenderStep(INT32 StepNum, Spread* pSpread, CPathPointInfo Point); 00232 00233 NodeRenderableInk* GetInkNode(); 00234 BOOL PrepareToRender(Spread* pSpread); 00235 void FinishRender(); 00236 void RecalculateMaxStep(); 00237 void ClearListOfPointsToRender(); 00238 00239 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy); 00240 00241 protected: 00242 // return a copy of this node 00243 virtual Node* SimpleCopy(); 00244 void RenderAttributes(RenderRegion* pRender, CCAttrMap* pAttrMap); 00245 00246 void CopyNodeContents(NodeBrushMaker* pCopyOfNode); 00247 void ResetMembers(); 00248 void RandomizeShape(Trans2DMatrix* TransformMatrix); 00249 void RandomizeAttributes(); 00250 00251 DocCoord SetPosition( CPathPointInfo OriginalPoint, UINT32 AltValue, 00252 CListOfPointsToRender::iterator *ListPosition ); 00253 00254 BOOL GetGRenderBitmap(DocRect* pRenderRect, GRenderBrush** ppGRender, Spread* pSpread); 00255 BOOL DrawViewToRenderRegion(Spread* pSpread, RenderRegion* pRender); 00256 00257 void AddPointsInRectToList(DocRect Rect); 00258 void AddAllPointsToList(); 00259 void RenderBrushObjectAtPoint(CPathPointInfo Point, RenderRegion* pRender); 00260 00261 00262 // Debugging function 00263 #ifdef _DEBUG 00264 void ShowDebugTreeDetails() const; 00265 #endif 00266 void GetDebugDetails( StringBase* Str ); 00267 void GetDebugDetails( StringBase* Str,BlendRef* pBlendRef ); 00268 00269 00270 String_32 m_BrushMakerName; 00271 00272 NodeRenderableInk* m_pInkNode; // the node used to create the brush 00273 BlendRef* m_pBlendRef; // creates and stores the blendpath objects that are rendered 00274 NodeBrushPath* m_pNodeBrushPath; // the path along which to draw the brush 00275 GRenderBrush* m_pGRender; // the render region that we use to render the brush objects 00276 // with as they are being drawn 00277 00278 GRenderBrush *m_pGRenderDIB; 00279 CListOfPointsToRender m_ListOfPointsToRender; // used to store the list of points we need to render 00280 std::vector< BrushRef * > m_BrushRefPtrArray; // holds multiple blendrefs used to create the brush objects 00281 // (necessary to have an array in case we want to use it as an 00282 // object sprayer) 00283 00284 MILLIPOINT m_BrushSpacing; // the distance between each brush object 00285 00286 00287 // the amount of randomness in the brush objects 00288 double m_PositionRandomness; 00289 double m_AttrRandomness; 00290 double m_SizeRandomness; 00291 double m_AlignmentRandomness; 00292 UINT32 m_AltValue; 00293 PathOffset m_PathOffsetType; 00294 MILLIPOINT m_PathOffsetValue; 00295 CCAttrMap* m_pAttrMap; 00296 00297 INT32 m_BrushStep; // the current step that is rendering 00298 INT32 m_MaxStep; // the maximum step to render 00299 00300 MILLIPOINT m_CurrentDistance; // the distance along the path that we have reached whilst rendering 00301 DocCoord m_StartCoord; // the starting coordinate of the nodebrushpath 00302 00303 DocRect m_BrushBoundingRect; 00304 00305 00306 BOOL m_bRandomizeShape; 00307 BOOL m_JustTransformed; // has the node just been transformed? 00308 00309 BOOL m_bFirstRender; 00310 BOOL m_bRotate; 00311 00312 BOOL m_bTile; // do we tile our fills? 00313 BOOL m_bUsePathCache; // do we use the cached path processor of the nodebrushpath? 00314 00315 // the list of transformations from the centre of the blendpath to the centre of 00316 // the inknode. Only really used when making brushes from groups. 00317 std::vector< BlendPathOffset > m_OffsetList; 00318 private: 00319 00320 }; 00321 00322 #endif