00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
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
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
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
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
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
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
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
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
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
00432 static INT32 GetContextLength();
00433 virtual BOOL MakeCurrent();
00434
00435
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
00447 static GDrawAsm * Current;
00448 static INT32 Instance;
00449
00450 static GDrawAsm *sm_pListHead;
00451
00452 };
00453 #endif