00001 // $Id: swfrndr.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 #ifndef INC_FLASH_RENDER_H 00099 #define INC_FLASH_RENDER_H 00100 00101 #include "fillramp.h" 00102 //#include "rndrgn.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00103 #include "vectrndr.h" 00104 #include "nodetext.h" 00105 #include "nodeshad.h" 00106 #include "swfbitmp.h" 00107 #include "swftext.h" 00108 #include "swffont.h" 00109 #include "swfshape.h" 00110 #include "swfbuttn.h" 00111 #include "swfplace.h" 00112 #include "swfsprit.h" 00113 00114 class NodeBevel; 00115 class NodeBevelBegin; 00116 00117 // The following functions perform the same role as many of the macros defined in the 00118 // older Camelot code, but since they're based around templates, incorporate type 00119 // checking, and are thus safer to use. 00120 00121 /******************************************************************************************** 00122 00123 > template < class T > T Max ( T InputA, T InputB ) 00124 00125 Author: Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com> 00126 Created: 24/8/99 00127 Purpose: Replacement for the Max macro. It's type safe, and can operate on any C++ 00128 data type. 00129 Returns: The maximum of either InputA or InputB. 00130 SeeAlso: - 00131 00132 ********************************************************************************************/ 00133 00134 template < class T > T Max ( T InputA, T InputB ) 00135 { 00136 if ( InputA > InputB ) 00137 return InputA; 00138 else 00139 return InputB; 00140 } 00141 00142 /******************************************************************************************** 00143 00144 > template < class T > T Max ( T InputA, T InputB, T InputC, T InputD ) 00145 00146 Author: Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com> 00147 Created: 24/8/99 00148 Purpose: Wrapper around the Max function to return the maximum value from four 00149 values. (Used for finding the maximum value for the extends of a bounding 00150 rectangle. 00151 Returns: The maximum value of the four inputs. 00152 SeeAlso: - 00153 00154 ********************************************************************************************/ 00155 00156 template < class T > T Max ( T InputA, T InputB, T InputC, T InputD ) 00157 { 00158 return Max ( Max ( InputA, InputB ), Max ( InputC, InputD ) ); 00159 } 00160 00161 /******************************************************************************************** 00162 00163 > template < class T > T Min ( T InputA, T InputB ) 00164 00165 Author: Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com> 00166 Created: 24/11/99 00167 Purpose: Replacement for the Min macro. It's type safe, and can operate on any C++ 00168 data type. 00169 Returns: The minimum of either InputA or InputB. 00170 SeeAlso: - 00171 00172 ********************************************************************************************/ 00173 00174 template < class T > T Min ( T InputA, T InputB ) 00175 { 00176 if ( ( InputA ) < ( InputB ) ) 00177 return InputA; 00178 else 00179 return InputB; 00180 } 00181 00182 /******************************************************************************************** 00183 00184 > template < class T > T Min ( T InputA, T InputB, T InputC, T InputD ) 00185 00186 Author: Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com> 00187 Created: 24/11/99 00188 Purpose: Wrapper around the Min function to return the minimum value from four 00189 values. (Used for finding the minimum value for the extends of a bounding 00190 rectangle. 00191 Returns: The minimum value of the four inputs. 00192 SeeAlso: - 00193 00194 ********************************************************************************************/ 00195 00196 template < class T > T Min ( T InputA, T InputB, T InputC, T InputD ) 00197 { 00198 return Min ( Min ( InputA, InputB ), Min ( InputC, InputD ) ); 00199 } 00200 00201 /******************************************************************************************** 00202 00203 > template < class T > T Absol ( T a ) 00204 00205 Author: Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com> 00206 Created: 24/8/99 00207 Purpose: Replacement for the Abs macro. It's got the advantage of being easier 00208 to debug, and fully type safe. 00209 Returns: The maximum of either a or b. 00210 SeeAlso: - 00211 00212 ********************************************************************************************/ 00213 00214 template < class T > T Absol ( T a ) 00215 { 00216 if ( a < 0 ) 00217 return -a; 00218 else 00219 return a; 00220 } 00221 00222 /******************************************************************************************** 00223 00224 > class FlashRenderRegion : public VectorFileRenderRegion 00225 00226 Author: Graeme_Sutherland (Xara Group Ltd) <camelotdev@xara.com> 00227 Created: 24/8/99 00228 Purpose: Provides the necessary functions to convert image data stored in the 00229 Camelot tree into the correct values for exporting to the Flash 4 format, 00230 and output these to the relevant device context. 00231 00232 ********************************************************************************************/ 00233 00234 class FlashRenderRegion : public VectorFileRenderRegion 00235 { 00236 public: 00237 CC_DECLARE_DYNAMIC( FlashRenderRegion ) 00238 00239 // Constructors. 00240 FlashRenderRegion ( void ); 00241 FlashRenderRegion ( DocRect ClipRect, 00242 Matrix ConvertMatrix, 00243 FIXED16 ViewScale ); 00244 00245 // Destructor. 00246 ~FlashRenderRegion( void ); 00247 00248 // Normal functions. 00249 BOOL ExportCharacter ( TextChar *pTheLetter ); 00250 BOOL ExportBevel ( NodeBevel *pBevel ); 00251 BOOL ExportBevelBegin ( NodeBevelBegin *pBevel ); 00252 BOOL ExportShadow ( Path *pShadowPath, 00253 OILBitmap *pBitmap, 00254 UINT32 Darkness ); 00255 BOOL ExportRenderableNode ( NodeRenderableInk *pInk ); 00256 00257 BOOL ExportAll ( void ); 00258 00259 // These set layer and button IDs used to export roll-over states. 00260 void SetButtonName ( TCHAR *pButtonName ); 00261 void SetLayerState ( LayerState State ); 00262 00263 protected: 00264 00265 void DrawPathToOutputDevice ( Path *PathToRender, 00266 PathShape shapePath = PATHSHAPE_PATH ); 00267 00268 // Extra functionality. 00269 void InitPointers ( void ); 00270 00271 BOOL ProcessPath ( Path *pPath ); 00272 BOOL ProcessFill ( FillGeometryAttribute *pFill, 00273 TranspFillAttribute *pTransparency ); 00274 BOOL ProcessColour ( FillGeometryAttribute *pFill ); 00275 BOOL ProcessTransparency ( TranspFillAttribute *pTransparency, 00276 FillGeometryAttribute *pFill ); 00277 BOOL CreateTextRecord ( TextChar *pTheLetter ); 00278 BOOL ProcessFlatFill ( DocColour *pColour ); 00279 BOOL ProcessGradientFill ( DocColour *pStartColour, 00280 DocColour *pMidColour, 00281 DocColour *pEndColour, 00282 ColourRamp *pRamp, 00283 DocCoord *pStartPoint, 00284 DocCoord *pEndPoint, 00285 DocCoord *pEndPoint2, 00286 BYTE FillType ); 00287 BOOL ProcessBitmapFill ( FillGeometryAttribute *pFill ); 00288 BOOL RecordBitmapFill ( BitmapFillAttribute *pFill, 00289 WORD BitmapID ); 00290 WORD GetBitmapID ( OILBitmap *pBitmap, 00291 DocColour *pStartColour, 00292 DocColour *pEndColour, 00293 UINT32 Transparency ); 00294 BOOL ProcessFlatTransp ( UINT32 Transparency ); 00295 BOOL ProcessGradientTransp ( UINT32 *pStartTransparency, 00296 UINT32 *pMidTransparency, 00297 UINT32 *pEndTransparency, 00298 DocCoord *pStartPoint, 00299 DocCoord *pEndPoint, 00300 DocCoord *pEndPoint2, 00301 BYTE FillType ); 00302 BOOL ProcessBitmapTransp ( TranspFillAttribute *pTransparency, 00303 FillGeometryAttribute *pFill ); 00304 00305 UINT32 BlendTransparencies ( UINT32 *pStart, 00306 UINT32 *pEnd1, 00307 UINT32 *pEnd2, 00308 UINT32 *pEnd3 ); 00309 00310 DocColour BlendColours ( DocColour *pStart, 00311 DocColour *pEnd1, 00312 DocColour *pEnd2, 00313 DocColour *pEnd3, 00314 ColourRamp *pRamp ); 00315 00316 FlashButtonRecord* ProcessURL ( WebAddressAttribute *pWebAddress ); 00317 00318 BOOL ExportButtonState ( FlashButtonRecord *pButton ); 00319 00320 FlashButtonRecord* MatchButton ( void ); 00321 00322 FlashSprite* MatchSprite ( FlashButtonRecord *pButton ); 00323 00324 BOOL PlaceObject ( WORD ID, 00325 FlashType ToRender, 00326 DocCoord *pPosition = NULL, 00327 BOOL DoTransform = FALSE ); 00328 00329 // Member variables. 00330 FlashBitmapRecord *mpBitmap; 00331 FlashBitmapRecord *mpBitmapTail; 00332 FlashTextRecord *mpText; 00333 FlashTextRecord *mpTextTail; 00334 FlashFontRecord *mpFont; 00335 FlashFontRecord *mpFontTail; 00336 FlashShapeRecord *mpShape; 00337 FlashShapeRecord *mpShapeTail; 00338 FlashShapeRecord *mpShapeLast; 00339 FlashButtonRecord *mpButton; 00340 FlashButtonRecord *mpButtonTail; 00341 FlashSprite *mpSprite; 00342 FlashSprite *mpSpriteTail; 00343 FlashPlaceObject *mpPlace; 00344 FlashPlaceObject *mpPlaceTail; 00345 String_256 mButtonName; 00346 LayerState mButtonState; 00347 BOOL mSupressLines; 00348 BOOL mExportStroke; 00349 }; 00350 00351 #endif // #ifndef