GDrawIntf.h

Go to the documentation of this file.
00001 // $Id: GDrawIntf.h 882 2006-04-25 15:40:57Z gavin $
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 #ifndef INC_GDRAWASM
00100 #define INC_GDRAWASM
00101 
00102 #include "gdraw.h"
00103 #include "gdrawcon.h"
00104 
00105 class CriticalSection
00106 {
00107 public:
00108     CriticalSection()
00109     {
00110 #ifdef RALPH
00111         Temp = 0;
00112         ::EnterCriticalSection(&sm_Section);
00113 #endif
00114     }
00115 
00116     ~CriticalSection()
00117     {
00118 #ifdef RALPH
00119         ::LeaveCriticalSection(&sm_Section);
00120 #endif
00121     }
00122 
00123     static void Init()
00124     {
00125 #ifdef RALPH
00126         if (!sm_bInit)
00127         {
00128             ::InitializeCriticalSection(&sm_Section);
00129             sm_bInit = TRUE;
00130         }
00131 #endif
00132     }
00133 
00134     static void DeInit()
00135     {
00136 #ifdef RALPH
00137         if (sm_bInit)
00138         {
00139             ::DeleteCriticalSection(&sm_Section);
00140             sm_bInit = FALSE;
00141         }
00142 #endif
00143     }
00144 
00145 
00146 private:
00147     DWORD Temp;
00148     static CRITICAL_SECTION sm_Section;
00149     static BOOL sm_bInit;
00150 };
00151 
00152 /*******************************************************************************************
00153 
00154 >   class GDrawAsm : public GDrawContext
00155 
00156     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00157     Created:    14/7/94
00158     Purpose:    A C++ wrapped around the assembler in GDRAW.DLL.
00159 
00160                 The caller should only ever need one instance of one of these (really its
00161                 inherited brothers) and keep it around for the duration of the program.
00162                 The keeper of the pointer to this is GRenderRegion.
00163 
00164                 If real GDraw is not available (e.g. Win16) then this returns FALSE
00165                 from the Init function and all other member functions return failure codes.
00166 
00167     SeeAlso:    GDrawContext
00168 
00169 ********************************************************************************************/ 
00170 
00171 
00172 class GDrawAsm : public GDrawContext
00173 {
00174 public:
00175 
00176     GDrawAsm();
00177     GDrawAsm(DWORD ThreadID);
00178     ~GDrawAsm();
00179 
00180     virtual BOOL Init();
00181     virtual BOOL Init(GDrawAsm* pSource);
00182 
00183     virtual eError GetLastError();
00184 
00185     virtual INT32 GetGraduationTableSize();
00186     virtual INT32 GetGraduationTableLength();
00187     virtual INT32 GetLongGraduationTableSize();
00188     virtual INT32 GetLongGraduationTableLength();
00189     virtual INT32 GetTransparentGraduationTableSize();
00190     virtual INT32 GetTransparentGraduationTableLength();
00191     virtual INT32 GetLongTransparentGraduationTableSize();
00192     virtual INT32 GetLongTransparentGraduationTableLength();
00193 
00194     virtual void SetStackLimit( LPVOID );
00195     virtual void SetStackSize( DWORD );
00196 
00197     virtual BOOL SetupBitmap( INT32 Width, INT32 Height, INT32 Depth, LPBYTE Bits, DWORD Format, BOOL DoBiCompression = FALSE );
00198     virtual BOOL SetBitmap( CONST LPBITMAPINFOHEADER BitmapInfo, CONST LPBYTE Bitmap, DWORD BitmapFormat = 2);
00199     virtual BOOL SetMatrix( GMATRIX* );
00200     virtual void SetAntialiasFlag( BOOL );
00201     virtual void SetAntialiasQualityFlag( BOOL );
00202     virtual void SetTileSmoothingFlag( BOOL );
00203     virtual void SetTileFilteringFlag( BOOL );
00204     virtual void SetMaxFilterSize( UINT32 );
00205     virtual BOOL Sharpen( INT32 );
00206     virtual BOOL Blur( INT32 );
00207     virtual void SetHintingFlag( BOOL );
00208     virtual void SetFlatness( DWORD );
00209     virtual void TransformPath( LPPOINT, LPPOINT, DWORD, GMATRIX* );
00210 
00211     virtual INT32 MaxScale( CONST GMATRIX *Matrix, CONST RECT *BBox );
00212 
00213     // colour
00214     virtual void SetHalftoneOrigin( DWORD, DWORD );
00215     virtual BOOL SetDitherStyle(DitherStyle Style = DITHER_GREY_ORDERED);
00216     virtual BOOL AddToGraduationTable( COLORREF, BOOL, GraduationTable*, DWORD );
00217     virtual BOOL BuildGraduationTable( COLORREF, COLORREF, DWORD, GraduationTable* );
00218     virtual BOOL BuildTransparencyTable( DWORD, DWORD, TransparentGradTable* );
00219     virtual BOOL SetColour( COLORREF );
00220     virtual BOOL SetSolidColour( COLORREF, DWORD, DWORD);
00221     virtual BOOL SetWordColour( DWORD );
00222     virtual BOOL SetTransparency( COLORREF, TransparencyEnum );
00223     virtual BOOL ConvertBitmap( LPBITMAPINFOHEADER, LPBYTE, LPBITMAPINFOHEADER, LPBYTE, INT32 );
00224     virtual pcLOGPALETTE SelectPalette( INT32 );
00225     virtual BOOL SetGraduation(
00226         DWORD Style,
00227         CONST GraduationTable *Table,
00228         CONST POINT *PointA,
00229         CONST POINT *PointB,
00230         CONST POINT *PointC
00231     ) ;
00232     virtual BOOL SetTransparentGraduation(
00233         DWORD Style,
00234         CONST TranspGradTable *Table,
00235         CONST POINT *PointA,
00236         CONST POINT *PointB,
00237         CONST POINT *PointC
00238     ) ;
00239     virtual BOOL SetGraduation4(
00240         DWORD Style,
00241         CONST GraduationTable *Table,
00242         CONST POINT *PointA,
00243         CONST POINT *PointB,
00244         CONST POINT *PointC,
00245         CONST POINT *PointD
00246     );
00247     virtual BOOL SetTransparentGraduation4(
00248         DWORD Style,
00249         CONST TranspGradTable *Table,
00250         CONST POINT *PointA,
00251         CONST POINT *PointB,
00252         CONST POINT *PointC,
00253         CONST POINT *PointD
00254     );
00255     virtual BOOL SetBias(UINT32,double) ;
00256     virtual BOOL SetGain(UINT32,double) ;
00257     virtual BOOL SetBrightness(double) ;
00258     virtual BOOL SetContrast(double) ;
00259     virtual BOOL SetGamma(double) ;
00260     virtual BOOL SetPostGamma(double) ;
00261     virtual BOOL SetSaturation(double) ;
00262     virtual BOOL SetContone( UINT32, COLORREF, COLORREF );
00263     virtual BOOL SetInputRange( UINT32, BYTE, BYTE );
00264     virtual BOOL SetOutputRange( UINT32, BYTE, BYTE );
00265     virtual BOOL SetBitmapFill( LPBITMAPINFOHEADER, LPBYTE, DWORD, LPPOINT, COLORREF, LPRGBQUAD,
00266                                     LPBYTE, LPBYTE, LPBYTE, LPBYTE, DWORD );
00267 
00268     virtual BOOL SetTransparentBitmapFill( LPBITMAPINFOHEADER, LPBYTE, DWORD, LPPOINT, COLORREF, BYTE*, DWORD);
00269 
00270     virtual BOOL SetPerspectiveBitmapFill( LPBITMAPINFOHEADER, LPBYTE, DWORD, LPPOINT, COLORREF, LPRGBQUAD,
00271                                             LPBYTE, LPBYTE, LPBYTE, LPBYTE, DWORD );
00272 
00273     virtual BOOL SetPerspectiveTransparentBitmapFill( LPBITMAPINFOHEADER, LPBYTE, DWORD, LPPOINT, COLORREF, BYTE*, DWORD);
00274 
00275     virtual BOOL SetTransparencyLookupTable(CONST BYTE * Table);
00276     
00277     // rendering
00278     virtual BOOL StrokePath( LPPOINT, const BYTE *, UINT32, BOOL, DWORD, CapStyles, JoinStyles, const DashType* );
00279     virtual BOOL FillPath( LPPOINT, const BYTE *, UINT32, DWORD );
00280     virtual BOOL FillRectangle( LPRECT );
00281     virtual BOOL FillPoint( LPPOINT );
00282     virtual INT32 StrokePathToPath(
00283         CONST POINT *IPoints,
00284         CONST BYTE  *ITypes,
00285         DWORD ILength,
00286         POINT *OPoints,
00287         BYTE  *OTypes,
00288         DWORD OLength,
00289         BOOL Close,
00290         DWORD LineWidth,
00291         CapStyles LineCaps,
00292         JoinStyles LineJoin,
00293         CONST DashType *Dash);
00294     virtual BOOL GetStatistics( LPPOINT, const BYTE *, UINT32, DWORD, STATISTICS *);
00295 
00296     // misc
00297     virtual BOOL ClipRectangle( LPRECT );
00298     virtual void ClearChangedBBox();
00299     virtual BOOL GetChangedBBox( LPRECT );
00300     virtual BOOL SetChangedBBox( LPRECT );
00301 
00302     virtual COLORREF ConvertHSVtoRGB(COLORREF);
00303     virtual COLORREF ConvertRGBtoHSV(COLORREF);
00304 
00305     virtual DWORD GetMaxBitmapWidth(void);
00306     virtual DWORD GetMaxBitmapDepth(void);
00307 
00308     // New GDraw fill types
00309     virtual BOOL Set3WayGraduation(DWORD Style,
00310         COLORREF ColourA, COLORREF ColourB, COLORREF ColourD,
00311         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointD);
00312 
00313     virtual BOOL Set3WayGraduation4(DWORD Style,
00314         COLORREF ColourA, COLORREF ColourB, COLORREF ColourD,
00315         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointC, CONST POINT *PointD);
00316 
00317     virtual BOOL Set4WayGraduation(DWORD Style,
00318         COLORREF ColourA, COLORREF ColourB, COLORREF ColourC, COLORREF ColourD,
00319         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointD);
00320 
00321     virtual BOOL Set4WayGraduation4(DWORD Style,
00322         COLORREF ColourA, COLORREF ColourB, COLORREF ColourC, COLORREF ColourD,
00323         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointC, CONST POINT *PointD);
00324 
00325     virtual BOOL SetTransparent3WayGraduation(DWORD Style,
00326         BYTE ValueA, BYTE ValueB, BYTE ValueD,
00327         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointD);
00328 
00329     virtual BOOL SetTransparent3WayGraduation4(DWORD Style,
00330         BYTE ValueA, BYTE ValueB, BYTE ValueD,
00331         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointC, CONST POINT *PointD);
00332 
00333     virtual BOOL SetTransparent4WayGraduation(DWORD Style,
00334         BYTE ValueA, BYTE ValueB, BYTE ValueC, BYTE ValueD,
00335         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointD);
00336 
00337     virtual BOOL SetTransparent4WayGraduation4(DWORD Style,
00338         BYTE ValueA, BYTE ValueB, BYTE ValueC, BYTE ValueD,
00339         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointC, CONST POINT *PointD);
00340 
00341 
00342     virtual BOOL SaveContext(GCONTEXT *Context);
00343     virtual BOOL RestoreContext(CONST GCONTEXT *Context);
00344 
00345     // new ones
00346 
00347     virtual BOOL SetConversionPalette( PLOGPALETTE );
00348 
00349     virtual BOOL SetMiterLimit( DWORD );
00350     virtual BOOL SetMatrixIntFlag( BOOL );
00351     virtual BOOL SetDashAdjustmentFlag( BOOL );
00352 
00353     virtual BOOL SetInvert( DWORD );
00354     virtual BOOL InitialiseWithPalette( const LOGPALETTE* );
00355     virtual const BYTE* ReturnBrush();
00356     virtual const BYTE* ReturnBrushRGB();
00357 
00358     virtual BOOL SetSeparationTables(const BGR *CyanSepTable = NULL,
00359                                      const BGR *MagentaSepTable = NULL,
00360                                      const BGR *YellowSepTable = NULL,
00361                                      const BGR *BlackSepTable = NULL,
00362                                      const BYTE *UnderColourRemovalTable = NULL,
00363                                      const BYTE *BlackGenerationTable = NULL);
00364 
00365     virtual BOOL SetBitmapConversionTable( const BGR* BitmapConversionTable = NULL );
00366 
00367     virtual BOOL PlotBitmap( LPBITMAPINFOHEADER, LPBYTE, DWORD, LPPOINT, LPRGBQUAD,
00368                                     LPBYTE, LPBYTE, LPBYTE, LPBYTE);
00369 
00370     virtual BOOL PlotPerspectiveBitmap( LPBITMAPINFOHEADER, LPBYTE, DWORD, LPPOINT, LPRGBQUAD,
00371                                             LPBYTE, LPBYTE, LPBYTE, LPBYTE);
00372 
00373 
00374     virtual INT32 CalcStrokeBBox(
00375         CONST POINT *IPoints,
00376         CONST BYTE  *ITypes,
00377         DWORD ILength,
00378         LPRECT Rect,
00379         BOOL Close,
00380         DWORD LineWidth,
00381         CapStyles LineCaps,
00382         JoinStyles LineJoin,
00383         CONST DashType *Dash);
00384 
00385     virtual BOOL IsOverlap( LPPOINT, const BYTE *, UINT32, DWORD);
00386     virtual BOOL CalcBBox( LPPOINT, const BYTE *, DWORD, LPRECT, BOOL);
00387 
00388     virtual INT32 MakeRegion( LPPOINT, const BYTE *, UINT32, DWORD, REGION *, UINT32);
00389 
00390     virtual BOOL DeviceClipRectangle( LPRECT );
00391     virtual BOOL GetDeviceClipRectangle( LPRECT );
00392     virtual BOOL ClipRegion( const REGION* );
00393     virtual const REGION* GetClipRegion();
00394 
00395     virtual BOOL HintPath( 
00396         CONST POINT *Points,
00397         CONST BYTE  *Types,
00398         UINT32 Length,
00399         BOOL Close,
00400         DWORD LineWidth);
00401 
00402     virtual INT32 MakeUnclippedRegion( 
00403         CONST POINT *Points,
00404         CONST BYTE  *Types,
00405         UINT32 Length,
00406         DWORD Winding,
00407         REGION *ORegion,
00408         UINT32 OLength);
00409 
00410     virtual BOOL FillRegion( CONST REGION *Region, CONST POINT *Offset );
00411 
00412     virtual INT32 SetBevelContrast(UINT32 nContrast);
00413     virtual INT32 SetBevelLightness(UINT32 nContrast);
00414     virtual INT32 SetBevelDarkness(UINT32 nContrast);
00415     virtual INT32 TranslateBevelValue(BYTE nIndex, BYTE Colour);
00416 
00417 #if RALPH
00418     // Function to initialise a context from a static data block
00419 
00420 public:
00421     virtual BOOL InitContext(GCONTEXT *Context, INT32 Index = 0);
00422 
00423 #endif
00424 
00425 public:
00426     static GDrawAsm* GetContextForCurrentThread(void);
00427 
00428 
00429 protected:
00430     
00431     // some functions to save and restore context state
00432     static  INT32 GetContextLength();
00433     virtual BOOL MakeCurrent();
00434 
00435     // data members
00436     GCONTEXT* m_pContext;
00437     
00438     
00439     GCONTEXT * SaveArea;
00440     INT32 SaveAreaLength;
00441     DWORD m_ThreadID;
00442 
00443     GDrawAsm *m_pNext;
00444     GDrawAsm *m_pPrevious;
00445 
00446     // static members
00447     static GDrawAsm * Current;
00448     static INT32 Instance;
00449 
00450     static GDrawAsm *sm_pListHead;
00451 
00452 };
00453 #endif

Generated on Sat Nov 10 03:45:26 2007 for Camelot by  doxygen 1.4.4