00001 // $Id: genv.h 751 2006-03-31 15:43: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 // Header for the envelope mould shapes implementation 00099 00100 #ifndef INC_GENVELOPE 00101 #define INC_GENVELOPE 00102 00103 #include "moldshap.h" 00104 00105 /******************************************************************************************** 00106 00107 > class GEnvelope 00108 00109 Author: Gavin_Theobald (Xara Group Ltd) <camelotdev@xara.com> 00110 Created: 21/2/94 00111 Purpose: The low level enveloper class. 00112 00113 ********************************************************************************************/ 00114 00115 /* 00116 00117 void Define( POINT *P, RECT *pBBox, DWORD pTolerance = 0 ) ; 00118 00119 Define the envelope with twelve control points P. The source path has bounding box pBBox. 00120 pTolerance defines the accuracy with which curves are moulded. If pTolerance is zero then 00121 curves are never split. 00122 00123 void Redefine( POINT *P ) ; 00124 00125 Redefines the mould after dragging the control points P. 00126 00127 00128 void FitPoint( POINT a, POINT& b ) ; 00129 00130 This will mould the point a returning the result in b. Note that a may be outside the 00131 original bounding box. 00132 00133 void FitPoint( DPOINT a, POINT& b ) ; 00134 00135 This will mould the point a specified as two values in the range 0 to 1. The result is 00136 returned in b. This call can be used for drawing grid points. 00137 00138 BOOL FitPath ( 00139 CONST POINT *IPoints, 00140 CONST BYTE *ITypes, 00141 DWORD ILength, 00142 LPPOINT OPoints, 00143 LPBYTE OTypes, 00144 INT32 OLength, 00145 BOOL Close = FALSE 00146 ) ; 00147 00148 This will mould a source path IPoints,ITypes,ILength returning the result in the destination 00149 path OPoints,OTypes,OLength. Curves may be split into several curves for greater accuracy if 00150 pTolerance was non-zero. If Close is non-zero then open paths are closed. 00151 00152 00153 */ 00154 00155 class GEnvelope : public GMould 00156 { 00157 CC_DECLARE_DYNAMIC(GEnvelope) 00158 00159 public: 00160 GEnvelope(); 00161 00162 virtual BOOL Redefine( POINT *P ) ; 00163 virtual BOOL FitPath ( 00164 CONST POINT *IPoints, 00165 CONST BYTE *ITypes, 00166 DWORD ILength, 00167 LPPOINT OPoints, 00168 LPBYTE OTypes, 00169 DWORD OLength, 00170 BOOL Close = FALSE 00171 ) ; 00172 virtual void CopyShape( POINT *P ) ; 00173 00174 private: 00175 virtual void ScaleView(); 00176 virtual void CalcViewBBox(); 00177 virtual void CalcViewConsts(); 00178 virtual void Transform( DPOINT a, DPOINT& b ) ; 00179 00180 private: 00181 POINT L0, L1, L2 ; 00182 POINT T0, T1, T2 ; 00183 POINT R0, R1, R2 ; 00184 POINT B0, B1, B2 ; 00185 DPOINT VL0, VL1, VL2 ; 00186 DPOINT VT0, VT1, VT2 ; 00187 DPOINT VR0, VR1, VR2 ; 00188 DPOINT VB0, VB1, VB2 ; 00189 DPOINT A, B, C, D, E, F, G, H, J, K, L, M ; 00190 } ; 00191 00192 00193 /******************************************************************************************** 00194 00195 > class GEnvelope2x2 00196 00197 Author: Gavin_Theobald (Xara Group Ltd) <camelotdev@xara.com> 00198 Created: 21/2/94 00199 Purpose: The low level enveloper class. 00200 00201 ********************************************************************************************/ 00202 00203 /* 00204 00205 void Define( POINT *P, RECT *pBBox, DWORD pTolerance = 0 ) ; 00206 00207 Define the envelope with twenty-four control points P. The source path has bounding box pBBox. 00208 pTolerance defines the accuracy with which curves are moulded. If pTolerance is zero then 00209 curves are never split. 00210 00211 void Redefine( POINT *P ) ; 00212 00213 Redefines the mould after dragging the control points P. 00214 00215 00216 void FitPoint( POINT a, POINT& b ) ; 00217 00218 This will mould the point a returning the result in b. Note that a may be outside the 00219 original bounding box. 00220 00221 void FitPoint( DPOINT a, POINT& b ) ; 00222 00223 This will mould the point a specified as two values in the range 0 to 1. The result is 00224 returned in b. This call can be used for drawing grid points. 00225 00226 BOOL FitPath ( 00227 CONST POINT *IPoints, 00228 CONST BYTE *ITypes, 00229 DWORD ILength, 00230 LPPOINT OPoints, 00231 LPBYTE OTypes, 00232 INT32 OLength, 00233 BOOL Close = FALSE 00234 ) ; 00235 00236 This will mould a source path IPoints,ITypes,ILength returning the result in the destination 00237 path OPoints,OTypes,OLength. Curves may be split into several curves for greater accuracy if 00238 pTolerance was non-zero. If Close is non-zero then open paths are closed. 00239 00240 */ 00242 00243 class GEnvelope2x2 : public GMould 00244 { 00245 CC_DECLARE_DYNAMIC(GEnvelope2x2) 00246 00247 public: 00248 GEnvelope2x2(); 00249 00250 virtual BOOL Redefine( POINT *P ) ; 00251 virtual BOOL FitPath ( 00252 CONST POINT *IPoints, 00253 CONST BYTE *ITypes, 00254 DWORD ILength, 00255 LPPOINT OPoints, 00256 LPBYTE OTypes, 00257 DWORD OLength, 00258 BOOL Close = FALSE 00259 ) ; 00260 virtual void CopyShape( POINT *P ) ; 00261 00262 private: 00263 virtual void ScaleView() ; 00264 virtual void CalcViewBBox() ; 00265 virtual void CalcViewConsts() ; 00266 virtual void Transform( DPOINT a, DPOINT& b ) ; 00267 00268 BOOL CalcConsts() ; 00269 BOOL GenLine( DPOINT P0, DPOINT P6, DPOINT T0, DPOINT T6 ) ; 00270 00271 private: 00272 POINT L0, L1, L2, L3, L4, L5 ; 00273 POINT T0, T1, T2, T3, T4, T5 ; 00274 POINT R0, R1, R2, R3, R4, R5 ; 00275 POINT B0, B1, B2, B3, B4, B5 ; 00276 POINT H1, H2, H4, H5 ; 00277 POINT V1, V2, V4, V5 ; 00278 POINT MM ; 00279 DPOINT VL0, VL1, VL2, VL3, VL4, VL5 ; 00280 DPOINT VT0, VT1, VT2, VT3, VT4, VT5 ; 00281 DPOINT VR0, VR1, VR2, VR3, VR4, VR5 ; 00282 DPOINT VB0, VB1, VB2, VB3, VB4, VB5 ; 00283 DPOINT VH1, VH2, VH4, VH5 ; 00284 DPOINT VV1, VV2, VV4, VV5 ; 00285 DPOINT VMM ; 00286 BOOL SmoothX, SmoothY ; 00287 DPOINT A00, B00, C00, D00, E00, F00, G00, H00, J00, K00, L00, M00 ; 00288 DPOINT A01, B01, C01, D01, E01, F01, G01, H01, J01, K01, L01, M01 ; 00289 DPOINT A10, B10, C10, D10, E10, F10, G10, H10, J10, K10, L10, M10 ; 00290 DPOINT A11, B11, C11, D11, E11, F11, G11, H11, J11, K11, L11, M11 ; 00291 } ; 00292 00293 #endif