00001 // $Id: scanrr.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 // The Scanning Render region class 00099 00100 #ifndef INC_SCANRR 00101 #define INC_SCANRR 00102 00103 //#include "rndrgn.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00104 //#include "rrcaps.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00105 00106 /******************************************************************************************** 00107 00108 > class NodeListItemWithDocPtr : public NodeListItem 00109 00110 Author: Chris_Snook (Xara Group Ltd) <camelotdev@xara.com> 00111 Created: 10/7/2000 00112 Purpose: This is used to ensure that blends print correctly. If a particular 00113 NodeBlender was classified as simple, and is later used with a blend 00114 that is complex, then complex blend steps will not render. This class 00115 allows us to reclassify a simple node as a complex one. 00116 SeeAlso: - 00117 00118 ********************************************************************************************/ 00119 00120 class NodeListItemWithComplexity : public NodeListItem 00121 { 00122 public: 00123 CC_DECLARE_DYNAMIC( NodeListItemWithComplexity ) 00124 NodeListItemWithComplexity(); // will contain a NULL pointer 00125 NodeListItemWithComplexity(Node* WhichNode, BOOL val); // initialise pNode to be WhichNode 00126 ~NodeListItemWithComplexity() {} // Nothing to destruct 00127 00128 BOOL wasClassifiedSimple; // was the node classified as simple? 00129 INT32 RunLength; 00130 DocRect BoundsRect; 00131 }; 00132 00133 /******************************************************************************************** 00134 00135 > class ScanningRenderRegion : public RenderRegion 00136 00137 Author: Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com> 00138 Created: 6/4/95 00139 Purpose: The Scanning Render Region is a special sort of render region that simply 00140 scans the document and works out where abouts there are complex shapes that 00141 can not be rendered by a normal OSRenderRegion. Complex shapes are shapes 00142 that are transparant or any other attribute that we are unable to render 00143 to normally. The Scanning Render Region is used to help with things like 00144 printing, Renderable EPS export etc where transparancy is not available. 00145 00146 ********************************************************************************************/ 00147 00148 class ScanningRenderRegion : public RenderRegion 00149 { 00150 // Give my name in memory dumps 00151 CC_DECLARE_DYNAMIC(ScanningRenderRegion); 00152 00153 // Construction and destruction 00154 ScanningRenderRegion(BOOL Printing); 00155 ~ScanningRenderRegion(); 00156 00157 // Starting and stopping the rendering process 00158 virtual BOOL StartRender(); 00159 virtual BOOL StopRender(); 00160 00161 // Functions that are meant to do the drawing 00162 virtual void DrawPathToOutputDevice(Path *PathToRender, PathShape shapePath=PATHSHAPE_PATH); 00163 virtual void DrawRect(DocRect *RectToRender); 00164 virtual void DrawLine(const DocCoord &StartPoint, const DocCoord &EndPoint); 00165 virtual void DrawPixel(const DocCoord &Point); 00166 00167 // Functions that are supposed to draw bitmaps 00168 virtual void DrawBitmap(const DocCoord &Point, KernelBitmap* pBitmap); 00169 virtual void DrawBitmap(const DocCoord &Point, UINT32 BitmapID, UINT32 ToolID = NULL); 00170 virtual BOOL DrawTransformedBitmap(NodeBitmap *pNodeBitmap); 00171 00172 // Other Pure virtual drawing functions that have to be overidden 00173 virtual void DrawDragRect(DocRect *RectToRender); 00174 virtual void DrawBlob(DocCoord p, BlobType type); 00175 virtual void DrawCross(const DocCoord &Point, const UINT32 Size); 00176 virtual void DrawBitmapBlob(const DocCoord &Point, KernelBitmap* BlobShape); 00177 virtual void DrawBitmapBlob(const DocCoord &Point, ResourceID resID ); 00178 00179 // Pure Virtual functions that have to be overidden to use this class. 00180 // They all do nothing in this class 00181 virtual void InitClipping(); 00182 virtual void InitAttributes(); 00183 virtual void SetLineAttributes(); 00184 virtual void SetOSDrawingMode(); 00185 virtual void SetQualityLevel(); 00186 virtual MILLIPOINT CalcPixelWidth(); 00187 virtual MILLIPOINT CalcScaledPixelWidth(); 00188 00189 // Force this to return a sensible value so that the capture system 00190 // doesn't get horribly upset 00191 virtual double GetPixelsPerInch() { return 96.0; } 00192 00193 // Make sure that offscreen attrs are rendered when out of bounds 00194 virtual BOOL CheckOffscreenBounds() { return(FALSE); } 00195 00196 // Function to work out what things this type of render region is capable of rendering 00197 virtual void GetRenderRegionCaps(RRCaps* pCaps); 00198 00199 // Function to tell the scanning render region what the region it is scanning 00200 // for can render. 00201 void SetHostRRCaps(const RRCaps& pCaps); 00202 00203 // Functions to get at the info held by the scanning render regions 00204 Node* GetFirstComplexObject(); 00205 Node* GetLastComplexObject(); 00206 00207 // Find the number of nodes in various sections of the tree 00208 INT32 GetNumComplex(); 00209 00210 // Function to find out the size of the bounding rect that covers all complex shapes 00211 DocRect GetComplexBounds(); 00212 00213 // Function to find out if we are done yet 00214 BOOL IsFinished(); 00215 00216 // Functions to get at the list of runs etc 00217 BOOL IsFirstNodeComplex(); 00218 Node* FindFirstFromList(); 00219 Node* FindNextFromList(); 00220 BOOL IsThisNodeComplex(); 00221 DocRect GetSpanBounds(); 00222 00223 void SetRenderState(Node *RenderState); 00224 00225 protected: 00226 // Function that is called when a complex shape has been found 00227 void ComplexShapeFound() { bIsComplex = TRUE; }; 00228 void ComplexShapeFoundHelper(); // CGS (12/10/2000): MUST take NodeBlenders of compound nodes into account! 00229 void SimpleShapeFound() { bIsSimple = TRUE; }; 00230 void SimpleShapeFoundHelper(); // CGS (12/10/2000): MUST take NodeBlenders of compound nodes into account! 00231 00232 public: 00233 void ComplexShapeFoundWrapper(); // CGS (20/10/2000): allows us to access ComplexShapeFound directly. 00234 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 00235 // YOU SHOULD ONLY CALL THIS FUNCTION IF YOU KNOW WHAT YOU ARE DOING !!!!!!! 00236 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 00237 #ifdef _DEBUG 00238 void DumpNodeRuns(); 00239 #endif 00240 00241 00242 protected: 00243 // Vars that the Scanning render region uses 00244 // The first and last complex objects 00245 Node* pFirstComplex; 00246 Node* pLastComplex; 00247 00248 // The number of complex shapes in the region 00249 INT32 NumComplexShapes; 00250 00251 // a rectangle that holds the bounds of all the complex shapes in the render region 00252 DocRect ComplexBounds; 00253 DocRect SpanBounds; 00254 00255 // List of runs of complex and non-complex nodes 00256 List NodeRuns; 00257 NodeListItemWithComplexity* pCurrentListItem; 00258 BOOL IsFirstComplex; 00259 BOOL IsThisTheFirstNode; 00260 BOOL InComplexRun; 00261 INT32 RunLength; 00262 00263 BOOL bIsComplex; 00264 BOOL bIsSimple; 00265 ClipRegionAttribute* pLastClipAttr; 00266 00267 private: 00268 // A flag to say if we have finished rendering or not 00269 BOOL IsFinishedRendering; 00270 00271 // The Caps for the region we are scanning on behlaf of 00272 RRCaps HostCaps; 00273 }; 00274 00275 00276 00277 #endif // INC_SCANRR