00001 // $Id: gblend.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 // Gavin's blend code 00099 00101 // 00102 // GBlend.h 00103 // 00105 00106 /************************************************************************************************ 00107 00108 void Define( 00109 PPOINT Src0Points, First source path 00110 PBYTE Src0Types, 00111 UINT32 Src0Length, 00112 PPOINT Src1Points, Second source path 00113 PBYTE Src1Types, 00114 UINT32 Src1Length, 00115 BOOL Flag, Set for 1 to 1 blending 00116 UINT32 pFlatness, Flatness 00117 PUINT32 Buffer, Workspace 00118 UINT32 BufferLength Workspace length 00119 ) ; 00120 00121 This call should be made once in order to set up a blend. It will blend one subpath to one other 00122 subpath. Each subpath is treated as though it is unclosed. 00123 00124 Paths are expected to be in the form of a single subpath. ClosePath options are ignored. 00125 Workspace required is 4 bytes per path element per path. 00126 00127 Note that currently (04/11/94) there is a lack of error handling. Paths should be in the correct 00128 format. 00129 00131 00132 UINT32 Blend( 00133 double pRatio, Blend ratio of 1st path to 2nd path 00134 PPOINT DstPoints, Destination path 00135 PBYTE DstTypes, 00136 UINT32 DstLength Maximum length of destination path. 00137 ) ; 00138 00139 This call actually performs a blend. It should be called once for each required value of pRatio. 00140 00141 ************************************************************************************************/ 00142 00143 class GBlend 00144 { 00145 public: 00146 void Define( 00147 PPOINT Src0Points, 00148 PBYTE Src0Types, 00149 UINT32 Src0Length, 00150 PPOINT Src1Points, 00151 PBYTE Src1Types, 00152 UINT32 Src1Length, 00153 BOOL Flag, 00154 UINT32 pFlatness, 00155 PUINT32 Buffer, 00156 UINT32 BufferLength 00157 ) ; 00158 UINT32 Blend( 00159 double pRatio, 00160 PPOINT DstPoints, 00161 PBYTE DstTypes, 00162 INT32 DstLength 00163 ) ; 00164 private: 00165 BOOL Is1to1 ; 00166 UINT32 Flatness ; 00167 INT32 Ratio ; 00168 PPOINT S0Points ; PBYTE S0Types ; UINT32 S0Length ; PUINT32 LengthPtr0 ; PUINT32 EndLengthPtr0 ; 00169 PPOINT S1Points ; PBYTE S1Types ; UINT32 S1Length ; PUINT32 LengthPtr1 ; PUINT32 EndLengthPtr1 ; 00170 PPOINT OPoints ; PBYTE OTypes ; size_t OLength ; 00171 PPOINT IPoints0 ; PBYTE ITypes0 ; UINT32 ILength0 ; 00172 PPOINT IPoints1 ; PBYTE ITypes1 ; UINT32 ILength1 ; 00173 PUINT32 LPtr0 ; BYTE Type0 ; UINT32 Length0 ; INT32 Match0 ; UINT32 Total0 ; 00174 PUINT32 LPtr1 ; BYTE Type1 ; UINT32 Length1 ; INT32 Match1 ; UINT32 Total1 ; 00175 POINT P00,P01,P02,P03 ; 00176 POINT P10,P11,P12,P13 ; 00177 POINT L1,L2,M,R1,R2 ; 00178 00179 BOOL CalcPathLengths( 00180 PPOINT Points, 00181 PBYTE Types, 00182 UINT32 Length, 00183 PUINT32 Buffer, 00184 UINT32 BufferLength, 00185 PUINT32 &BufferEnd 00186 ) ; 00187 BOOL BlendNtoN() ; 00188 BOOL BlendMtoN() ; 00189 BOOL Blend1to1() ; 00190 BOOL BlendPoint( BYTE Type, POINT P0, POINT P1 ) ; 00191 BOOL BlendCurve( POINT P01,POINT P02,POINT P03, POINT P11,POINT P12,POINT P13 ) ; 00192 void Match ( PUINT32 Ptr, PUINT32 EndPtr, UINT32 Length, INT32 &Match, UINT32 &Total ) ; 00193 void MatchLast( PUINT32 Ptr, PUINT32 EndPtr, UINT32 Length, INT32 &Match, UINT32 &Total ) ; 00194 void ReadPath0() ; void ReadPathStart0() ; 00195 void ReadPath1() ; void ReadPathStart1() ; 00196 void Split( POINT P0,POINT P1,POINT P2,POINT P3, INT32 N,UINT32 D ) ; 00197 INT32 BezierLength( POINT P0, POINT P1, POINT P2, POINT P3 ) ; 00198 INT32 FlattenSplit( POINT P0, POINT P1, POINT P2, POINT P3 ) ; 00199 } ; 00200