GDrawIntf.cpp

Go to the documentation of this file.
00001 // $Id: GDrawIntf.cpp 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 
00099 // C++ interface to GDraw in assembly-language (intel version) in DLL
00100 
00101 /*
00102 */
00103 
00104 #include "camtypes.h"
00105 // camconfig.h must be included immediately after camtypes.h
00106 #include "camconfig.h"
00107 
00108 #include "GDrawIntf.h"
00109 #include "XaDrwOld.h"
00110 #include "GVersion.h"
00111 //#include "fixmem.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00112 //#include "errors.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00113 #include "gradtbl.h"
00114 
00115 #include "grndrgn.h"
00116 
00117 #include "camprofile.h"
00118 
00119 // Andy - tell us if there's some subtle reason for not doing this. I wanted the memory tracking - Alex
00120 //#define   new CAM_DEBUG_NEW
00121 
00122 // statics
00123 GDrawAsm * GDrawAsm::Current = NULL;
00124 INT32 GDrawAsm::Instance = 0;
00125 GDrawAsm * GDrawAsm::sm_pListHead = NULL;
00126 
00127 //static GCONTEXT* s_pContext = NULL;
00128 
00129 CRITICAL_SECTION CriticalSection::sm_Section;
00130 BOOL CriticalSection::sm_bInit = FALSE;
00131 
00132 // trivial constructor
00133 
00134 GDrawAsm::GDrawAsm() : GDrawContext()
00135 {
00136     m_pContext = NULL;
00137     Instance++;
00138     SaveArea = NULL;
00139     SaveAreaLength = 0;
00140     m_pPrevious = NULL;
00141     m_pNext = NULL;
00142 
00143     m_ThreadID = 0;
00144 }
00145 
00146 
00147 GDrawAsm::GDrawAsm(DWORD ThreadID) : GDrawContext()
00148 {
00149     m_pContext = NULL;
00150     Instance++;
00151     SaveArea = NULL;
00152     SaveAreaLength = 0;
00153     m_pPrevious = NULL;
00154     m_pNext = NULL;
00155 
00156     if (ThreadID == 0)
00157         ThreadID = wxThread::GetCurrentId();
00158 
00159     // Insert this at the beginning of the list
00160     m_pNext = sm_pListHead;
00161     sm_pListHead = this;
00162 
00163     m_ThreadID = ThreadID;
00164 }
00165 
00166 
00167 /********************************************************************************************
00168 
00169 >   static GDrawAsm* GetContextForCurrentThread(void)
00170 
00171     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00172     Created:    11/9/96
00173     Inputs:     -
00174     Outputs:    -
00175     Returns:    A pointer to the first context in the list whose ThreadID matches
00176                 (NULL if no matches)
00177     Purpose:    Used by GRenderRegion to get a thread-safe context for rendering
00178     Errors:     -
00179     Scope:      Public static
00180     SeeAlso:    -
00181 
00182 ********************************************************************************************/
00183 
00184 GDrawAsm* GDrawAsm::GetContextForCurrentThread(void)
00185 {
00186     CriticalSection Ralph;
00187 
00188     GDrawAsm *pContext = sm_pListHead;
00189 
00190     DWORD ThreadID = wxThread::GetCurrentId();
00191 
00192     while (pContext && (ThreadID != pContext->m_ThreadID))
00193     {
00194         pContext = pContext->m_pNext;
00195     }
00196 
00197     TRACE( wxT("GetContextForCurrentThread = %p"), pContext );
00198 
00199     return(pContext);
00200 }
00201 
00202 // these are the allocation fns used by GDraw.dll
00203 extern "C" LPBYTE GDraw_Alloc(UINT32 Size)
00204 {
00205     LPBYTE Result = (LPBYTE)CCMalloc(Size);
00206 
00207     #ifdef _DEBUG
00208     if (Result==NULL)
00209         TRACEALL( _T("GDraw failed to get %ld bytes\n"), Size);
00210     #endif
00211 
00212     return Result;
00213 }
00214 
00215 extern "C" void GDraw_Free(LPBYTE ptr)
00216 {
00217     CCFree(ptr);
00218 }
00219 
00220 /********************************************************************************************
00221 
00222 >   BOOL GDrawAsm::Init()
00223 
00224     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00225     Created:    14/7/94
00226     Inputs:     -
00227     Outputs:    -
00228     Returns:    TRUE if the this pointer can be used to do some rendering, FALSE if cannot
00229                 e.g. platform not supported e.g. Win16. A FALSE return means the member
00230                 functions will return failure codes.
00231     Purpose:    Can the this pointer be used to render things.
00232     Errors:     -
00233     Scope:      Public
00234     SeeAlso:    -
00235 
00236 ********************************************************************************************/
00237 
00238 BOOL GDrawAsm::Init()
00239 {
00240 //  TRACEUSER( "Gerry", _T("Initialising GDrawAsm at 0x%08x\n"), this);
00241     DWORD GVer = XaDraw_GetVersion();
00242 
00243     // to be compatible, the major numbers must match and the minor number must be
00244     // at least the one we built this file with
00245     if ( ( HIWORD(GVer)  >  (WORD)GDRAW_VERSION_MAJOR ) ||
00246         (( HIWORD(GVer) ==  (WORD)GDRAW_VERSION_MAJOR ) 
00247 #if GDRAW_VERSION_MINOR>0 // Suppress compiler warning
00248 && ( LOWORD(GVer) >= (WORD)GDRAW_VERSION_MINOR)
00249 #endif
00250         )
00251        )
00252     {
00253         if (m_pContext)
00254         {
00255             XaDraw_Terminate(m_pContext);
00256 //          TRACEUSER( "Gerry", _T("Reusing context at 0x%08x\n"), m_pContext);
00257         }
00258 
00259         CamProfile cp(CAMPROFILE_GDRAW);
00260 
00261         // Create the context
00262         INT32 Len = XaDraw_ContextLength();
00263         if (Len > 0)
00264         {
00265             if (m_pContext == NULL)
00266                 m_pContext = (GCONTEXT*)CCMalloc(Len);
00267             if (m_pContext)
00268             {
00269 //              TRACEUSER( "Gerry", _T("Claimed context of %d bytes at 0x%08x\n"), Len, m_pContext);
00270 //              memset(m_pContext, 0x01, Len);
00271                 XaDraw_Initialise(m_pContext, NULL);
00272                 XaDraw_SetMemoryHandlers(m_pContext, GDraw_Alloc, GDraw_Free);
00273                 return TRUE;
00274             }
00275             else
00276             {
00277                 TRACEUSER( "Gerry", _T("Failed to claim context of %d bytes\n"), Len);
00278             }
00279         }
00280     }
00281 
00282     return FALSE;
00283 }
00284 
00285 
00286 BOOL GDrawAsm::Init(GDrawAsm* pSource)
00287 {
00288 //  TRACEUSER( "Gerry", _T("Initialising GDrawAsm at 0x%08x from 0x%08x\n"), this, pSource);
00289 
00290     if (pSource->m_pContext == NULL)
00291         return(FALSE);
00292 
00293     DWORD GVer = XaDraw_GetVersion();
00294 
00295     // to be compatible, the major numbers must match and the minor number must be
00296     // at least the one we built this file with
00297     if ( ( HIWORD(GVer)  >  (WORD)GDRAW_VERSION_MAJOR ) ||
00298         (( HIWORD(GVer) ==  (WORD)GDRAW_VERSION_MAJOR )
00299 #if GDRAW_VERSION_MINOR>0 // Suppress compiler warning
00300         && ( LOWORD(GVer) >= (WORD)GDRAW_VERSION_MINOR)
00301 #endif
00302         )
00303        )
00304     {
00305         if (m_pContext)
00306         {
00307             XaDraw_Terminate(m_pContext);
00308 //          TRACEUSER( "Gerry", _T("Reusing context at 0x%08x\n"), m_pContext);
00309         }
00310 
00311         // Create the context
00312         INT32 Len = XaDraw_ContextLength();
00313         if (Len > 0)
00314         {
00315             if (m_pContext == NULL)
00316                 m_pContext = (GCONTEXT*)CCMalloc(Len);
00317             if (m_pContext)
00318             {
00319 //              TRACEUSER( "Gerry", _T("Claimed context of %d bytes at 0x%08x\n"), Len, m_pContext);
00320                 XaDraw_CopyContext(pSource->m_pContext, m_pContext);
00321                 return TRUE;
00322             }
00323             else
00324             {
00325                 TRACEUSER( "Gerry", _T("Failed to claim context of %d bytes\n"), Len);
00326             }
00327         }
00328     }
00329 
00330     return FALSE;
00331 }
00332 
00333 
00334 /********************************************************************************************
00335 
00336 >   GDrawAsm::~GDrawAsm()
00337 
00338     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00339     Created:    14/7/94
00340     Inputs:     -
00341     Outputs:    -
00342     Returns:    -
00343     Purpose:    Destructor - performs required tidy up.
00344     Errors:     -
00345     Scope:      Public
00346     SeeAlso:    -
00347 
00348 ********************************************************************************************/
00349 
00350 GDrawAsm::~GDrawAsm()
00351 {
00352     CriticalSection Ralph;
00353 
00354 //  TRACEUSER( "Gerry", _T("Deleting GDrawAsm at 0x%08x\n"), this);
00355 
00356     if (Instance > 0)
00357         Instance--;
00358 
00359 //  if (Instance == 0)
00360 //      XaDrawOld_Terminate(); // only terminate when the last one goes
00361 
00362 //  if (Instance == 0)
00363 //  {
00364 //      XaDraw_Terminate(s_pContext); // only terminate when the last one goes
00365 //      CCFree(s_pContext);
00366 //      s_pContext = NULL;
00367 //  }
00368 
00369     if (this == GRenderRegion::GetStaticDrawContext())
00370     {
00371         TRACEUSER("Gerry", _T("Deleting current GDraw context at 0x%08x\n"), this);
00372         GRenderRegion::SetTempDrawContext(NULL);
00373     }
00374 
00375     if (m_pContext)
00376     {
00377         CamProfile cp(CAMPROFILE_GDRAW);
00378         XaDraw_Terminate(m_pContext);
00379         CCFree(m_pContext);
00380 //      TRACEUSER( "Gerry", _T("Released context at 0x%08x\n"), m_pContext);
00381         m_pContext = NULL;
00382     }
00383 
00384     // Make Current not point at this cos it's a bit dangerous
00385     if (Current == this)
00386         Current = NULL;
00387 
00388     if (SaveArea)
00389     {
00390 //      TRACEUSER( "Gerry", _T("Destruct context of %d bytes at 0x%08x\n"), SaveAreaLength, SaveArea);
00391         CCFree((LPBYTE)SaveArea);   // Oh well, can't return errors
00392         SaveArea=NULL;      // For tidyness
00393         SaveAreaLength = 0;
00394     }
00395 
00396     // If we have a thread id
00397     if (m_ThreadID != 0)
00398     {
00399         // Remove this from the list
00400 
00401         if (m_pPrevious == NULL || sm_pListHead == this)
00402         {
00403             // We are the first item so make the head point to the next item
00404             sm_pListHead = m_pNext;
00405         }
00406         else
00407         {
00408             // Not the first so make the previous item point to the next item
00409             m_pPrevious->m_pNext = m_pNext;
00410         }
00411 
00412         // If we are not the last item
00413         if (m_pNext != NULL)
00414         {
00415             // Make the next item point to the previous item
00416             m_pNext->m_pPrevious = m_pPrevious;
00417         }
00418     }
00419 }
00420 
00421 
00422 
00423 /********************************************************************************************
00424 
00425 >   DWORD GDrawAsm::GetMaxBitmapWidth(void)
00426 
00427     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00428     Created:    8/10/96
00429     Inputs:     -
00430     Outputs:    -
00431     Returns:    Max width of off screen bitmap supported
00432     Scope:      Public
00433     SeeAlso:    GDrawAsm::GetMaxBitmapDepth()
00434 
00435 ********************************************************************************************/
00436 
00437 DWORD GDrawAsm::GetMaxBitmapWidth(void)
00438 {
00439     CamProfile cp(CAMPROFILE_GDRAW);
00440     return(XaDraw_GetMaxBitmapWidth());
00441 }
00442 
00443 
00444 
00445 /********************************************************************************************
00446 
00447 >   DWORD GDrawAsm::GetMaxBitmapDepth(void)
00448 
00449     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00450     Created:    8/10/96
00451     Inputs:     -
00452     Outputs:    -
00453     Returns:    Max depth of off screen bitmap supported
00454     Scope:      Public
00455     SeeAlso:    GDrawAsm::GetMaxBitmapWidth()
00456 
00457 ********************************************************************************************/
00458 
00459 DWORD GDrawAsm::GetMaxBitmapDepth(void)
00460 {
00461     CamProfile cp(CAMPROFILE_GDRAW);
00462     return(XaDraw_GetMaxBitmapDepth());
00463 }
00464 
00465 
00466 
00467 #ifdef RALPH
00468 
00469 /********************************************************************************************
00470 
00471 >   BOOL GDrawAsm::InitContext(GCONTEXT *Context, INT32 Index = 0)
00472 
00473     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00474     Created:    5/9/96
00475     Inputs:     Context - ptr to GDraw context data to use
00476                 Index - the number of the context (only for DEFCONS code)
00477     Outputs:    -
00478     Returns:    TRUE if no error
00479     Purpose:    Initialises the GDraw context
00480                 The DEFCONS code is used to generate new default context tables
00481     Errors:     -
00482     Scope:      Public
00483     SeeAlso:    -
00484 
00485 ********************************************************************************************/
00486 
00487 BOOL GDrawAsm::InitContext(GCONTEXT *Context, INT32 Index)
00488 {
00489     CriticalSection Ralph;
00490 
00491     // Make sure this is current (so others are saved)
00492     if (!MakeCurrent())
00493         return(FALSE);
00494 
00495 // DEFCONS: This is a marker for updating the default context tables
00496 //          Change the following #if FALSE to TRUE
00497 #if FALSE
00498     // Just use a static block
00499     // You will need to increase this if contexts get bigger
00500     INT32 Length = GetContextLength();
00501     LPBYTE pBlock = CCMalloc(Length);
00502 
00503     if (pBlock == NULL)
00504         return(FALSE);
00505 
00506     // Save the context into our block
00507     SaveContext((GCONTEXT*)pBlock);
00508 
00509     // Open the relevant file
00510     FILE *f = NULL;
00511 
00512     switch (Index)
00513     {
00514     case 0:
00515         f = fopen("c:\\context\\normal.con", "wb");
00516         break;
00517 
00518     case 1:
00519         f = fopen("c:\\context\\errord.con", "wb");
00520         break;
00521     }
00522 
00523     if (f != NULL)
00524     {
00525         // Write the data to the file
00526         fwrite(&pBlock, Length, 1, f);
00527 
00528         // Close the file
00529         fclose(f);
00530     }
00531 
00532     return(TRUE);
00533 
00534 #else
00535     // Set this context to the passed in data
00536     CamProfile cp(CAMPROFILE_GDRAW);
00537     return(XaDrawOld_RestoreContext(Context)==0);
00538 #endif
00539 }
00540 
00541 #endif
00542 
00543 
00544 /********************************************************************************************
00545 
00546 >   INT32 GDrawAsm::GetContextLength()
00547 
00548     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00549     Created:    27/10/94
00550     Inputs:     None
00551     Outputs:    -
00552     Returns:    Length of this GDraw context
00553     Purpose:    Gets the length of a GDraw context
00554     Errors:     -
00555     Scope:      Protected
00556     SeeAlso:    -
00557 
00558 ********************************************************************************************/
00559 
00560 INT32 GDrawAsm::GetContextLength()
00561 {
00562     CamProfile cp(CAMPROFILE_GDRAW);
00563     return(XaDraw_ContextLength());
00564 }
00565 
00566 /********************************************************************************************
00567 
00568 >   BOOL GDrawAsm::SaveContext(GCONTEXT *Context)
00569 
00570     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00571     Created:    27/10/94
00572     Inputs:     ptr to GDraw context to save
00573     Outputs:    -
00574     Returns:    TRUE if no error
00575     Purpose:    Saves the GDraw context
00576     Errors:     -
00577     Scope:      Protected
00578     SeeAlso:    -
00579 
00580 ********************************************************************************************/
00581 
00582 BOOL GDrawAsm::SaveContext(GCONTEXT *Context)
00583 {
00584 //  return(XaDrawOld_SaveContext(Context)==0);
00585     CamProfile cp(CAMPROFILE_GDRAW);
00586     return(XaDraw_CopyContext(m_pContext, Context)==0);
00587 //  return(TRUE);
00588 }
00589 
00590 /********************************************************************************************
00591 
00592 >   BOOL GDrawAsm::RestoreContext(CONST GCONTEXT *Context)
00593 
00594     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00595     Created:    27/10/94
00596     Inputs:     ptr to GDraw context to restore
00597     Outputs:    -
00598     Returns:    TRUE if no error
00599     Purpose:    Restores the GDraw context
00600     Errors:     -
00601     Scope:      Protected
00602     SeeAlso:    -
00603 
00604 ********************************************************************************************/
00605 
00606 BOOL GDrawAsm::RestoreContext(CONST GCONTEXT *Context)
00607 {
00608 //  return(XaDrawOld_RestoreContext(Context)==0);
00609     CamProfile cp(CAMPROFILE_GDRAW);
00610     return(XaDraw_CopyContext(Context, m_pContext)==0);
00611 //  return(TRUE);
00612 }
00613 
00614 /********************************************************************************************
00615 
00616 >   BOOL GDrawAsm::SwapContext(GCONTEXT *Context)
00617 
00618     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00619     Created:    27/10/94
00620     Inputs:     ptr to GDraw context to swap
00621     Outputs:    -
00622     Returns:    TRUE if no error
00623     Purpose:    Swaps the GDraw context
00624     Errors:     -
00625     Scope:      Protected
00626     SeeAlso:    -
00627 
00628 ********************************************************************************************/
00629 
00630 //BOOL GDrawAsm::SwapContext(GCONTEXT *Context)
00631 //{
00632 //  return(GDraw_SwapContext(Context)==0);
00633 //}
00634 
00635 /********************************************************************************************
00636 
00637 >   BOOL GDrawAsm::MakeCurrent()
00638 
00639     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00640     Created:    27/10/94
00641     Inputs:     None
00642     Outputs:    -
00643     Returns:    TRUE if no error
00644     Purpose:    Makes the GDraw context passed the current one
00645     Errors:     -
00646     Scope:      Protected
00647     SeeAlso:    -
00648 
00649 ********************************************************************************************/
00650 
00651 BOOL GDrawAsm::MakeCurrent()
00652 {
00653     // Check we're not already the current context
00654     if (this == Current)
00655         return(TRUE); // that was easy
00656 
00657 #if FALSE
00658     if (Current != NULL) // then we need to do a save 1st
00659     {
00660         if (Current->SaveAreaLength != Current->GetContextLength())
00661         {
00662             if (Current->SaveArea != NULL) // free old one if it exists
00663             {
00664                 TRACEUSER( "Gerry", _T("Freeing context of %d bytes at 0x%08x\n"), Current->SaveAreaLength, Current->SaveArea);
00665                 CCFree((LPBYTE)(Current->SaveArea));
00666                 Current->SaveArea = NULL;       // For tidyness
00667                 Current->SaveAreaLength = 0;
00668             }
00669 
00670             Current->SaveAreaLength = Current->GetContextLength();
00671             Current->SaveArea = (GCONTEXT *) CCMalloc(Current->SaveAreaLength);
00672             TRACEUSER( "Gerry", _T("Claimed context of %d bytes at 0x%08x\n"), Current->SaveAreaLength, Current->SaveArea);
00673         }
00674 
00675         if (Current->SaveArea == NULL)
00676         {
00677             // Can't save the current context so return false
00678             Current->SaveAreaLength = 0;
00679             return(FALSE);
00680         }
00681 
00682         if (!(Current->SaveContext(Current->SaveArea)))
00683             return(FALSE);
00684     }
00685 
00686     // If this context has a saved state then restore it
00687     if (SaveArea != NULL)
00688         RestoreContext(SaveArea); // Ignore errors
00689 #endif
00690 
00691     // Set current context
00692     Current = this;
00693 
00694     // It worked
00695     return (TRUE);
00696 }
00697 
00698 
00699 /********************************************************************************************
00700 
00701 >   virtual eError GDrawAsm::GetLastError()
00702 
00703     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00704     Created:    16/10/96
00705     Inputs:     -
00706     Outputs:    -
00707     Returns:    The GDraw error code
00708     Errors:     See eError enum in gconsts.h
00709     Scope:      Public
00710 
00711 ********************************************************************************************/
00712 
00713 eError GDrawAsm::GetLastError()
00714 {
00715     CamProfile cp(CAMPROFILE_GDRAW);
00716     if (!MakeCurrent())
00717         return(GERROR_OUT_OF_MEMORY);
00718     else
00719         return(XaDraw_GetLastError(m_pContext));
00720 }
00721 
00722 
00723 /********************************************************************************************
00724 
00725 >   virtual INT32 GDrawAsm::GetGraduationTableSize()
00726 
00727     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00728     Created:    16/10/96
00729     Inputs:     -
00730     Outputs:    -
00731     Returns:    The size in bytes of the graduation table
00732     Scope:      Public
00733 
00734 ********************************************************************************************/
00735 
00736 INT32 GDrawAsm::GetGraduationTableSize()
00737 {
00738     CriticalSection Ralph;
00739 
00740     if (!MakeCurrent())
00741         return(0);
00742 
00743     CamProfile cp(CAMPROFILE_GDRAW);
00744 
00745     return(XaColour_GetGraduationTableSize(m_pContext));
00746 }
00747 
00748 
00749 /********************************************************************************************
00750 
00751 >   virtual INT32 GDrawAsm::GetGraduationTableLength()
00752 
00753     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00754     Created:    16/10/96
00755     Inputs:     -
00756     Outputs:    -
00757     Returns:    The number of entries in the graduation table
00758     Scope:      Public
00759 
00760 ********************************************************************************************/
00761 
00762 INT32 GDrawAsm::GetGraduationTableLength()
00763 {
00764     CamProfile cp(CAMPROFILE_GDRAW);
00765     return(XaColour_GetGraduationTableLength());
00766 }
00767 
00768 
00769 /********************************************************************************************
00770 
00771 >   virtual INT32 GDrawAsm::GetLongGraduationTableSize()
00772 
00773     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00774     Created:    16/10/96
00775     Inputs:     -
00776     Outputs:    -
00777     Returns:    The size in bytes of the long graduation table
00778     Scope:      Public
00779 
00780 ********************************************************************************************/
00781 
00782 INT32 GDrawAsm::GetLongGraduationTableSize()
00783 {
00784     CriticalSection Ralph;
00785 
00786     if (!MakeCurrent())
00787         return(0);
00788 
00789     CamProfile cp(CAMPROFILE_GDRAW);
00790     return(XaColour_GetLongGraduationTableSize(m_pContext));
00791 }
00792 
00793 
00794 /********************************************************************************************
00795 
00796 >   virtual INT32 GDrawAsm::GetLongGraduationTableLength()
00797 
00798     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00799     Created:    16/10/96
00800     Inputs:     -
00801     Outputs:    -
00802     Returns:    The number of entries in the long graduation table
00803     Scope:      Public
00804 
00805 ********************************************************************************************/
00806 
00807 INT32 GDrawAsm::GetLongGraduationTableLength()
00808 {
00809     CamProfile cp(CAMPROFILE_GDRAW);
00810     return(XaColour_GetLongGraduationTableLength());
00811 }
00812 
00813 
00814 /********************************************************************************************
00815 
00816 >   virtual INT32 GDrawAsm::GetTransparentGraduationTableSize()
00817 
00818     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00819     Created:    16/10/96
00820     Inputs:     -
00821     Outputs:    -
00822     Returns:    The size in bytes of the transparent graduation table
00823     Scope:      Public
00824 
00825 ********************************************************************************************/
00826 
00827 INT32 GDrawAsm::GetTransparentGraduationTableSize()
00828 {
00829     CriticalSection Ralph;
00830 
00831     if (!MakeCurrent())
00832         return(0);
00833 
00834     CamProfile cp(CAMPROFILE_GDRAW);
00835     return(XaColour_GetTransparentGraduationTableSize());
00836 }
00837 
00838 
00839 /********************************************************************************************
00840 
00841 >   virtual INT32 GDrawAsm::GetTransparentGraduationTableLength()
00842 
00843     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00844     Created:    16/10/96
00845     Inputs:     -
00846     Outputs:    -
00847     Returns:    The number of entries in the transparent graduation table
00848     Scope:      Public
00849 
00850 ********************************************************************************************/
00851 
00852 INT32 GDrawAsm::GetTransparentGraduationTableLength()
00853 {
00854     CamProfile cp(CAMPROFILE_GDRAW);
00855     return(XaColour_GetTransparentGraduationTableLength());
00856 }
00857 
00858 
00859 /********************************************************************************************
00860 
00861 >   virtual INT32 GDrawAsm::GetLongTransparentGraduationTableSize()
00862 
00863     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00864     Created:    16/10/96
00865     Inputs:     -
00866     Outputs:    -
00867     Returns:    The size in bytes of the long transparent graduation table
00868     Scope:      Public
00869 
00870 ********************************************************************************************/
00871 
00872 INT32 GDrawAsm::GetLongTransparentGraduationTableSize()
00873 {
00874     CriticalSection Ralph;
00875 
00876     if (!MakeCurrent())
00877         return(0);
00878 
00879     CamProfile cp(CAMPROFILE_GDRAW);
00880     return(XaColour_GetLongTransparentGraduationTableSize());
00881 }
00882 
00883 
00884 /********************************************************************************************
00885 
00886 >   virtual INT32 GDrawAsm::GetLongTransparentGraduationTableLength()
00887 
00888     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00889     Created:    16/10/96
00890     Inputs:     -
00891     Outputs:    -
00892     Returns:    The number of entries in the long transparent graduation table
00893     Scope:      Public
00894 
00895 ********************************************************************************************/
00896 
00897 INT32 GDrawAsm::GetLongTransparentGraduationTableLength()
00898 {
00899     CamProfile cp(CAMPROFILE_GDRAW);
00900     return(XaColour_GetLongTransparentGraduationTableLength());
00901 }
00902 
00903 
00904 /********************************************************************************************
00905 
00906 >   void GDrawAsm::SetStackLimit( LPVOID stack )
00907 
00908     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00909     Created:    14/7/94
00910     Inputs:     Pointer to minimum address the stack can be permitted to be used when
00911                 recursively flattening paths.
00912     Outputs:    -
00913     Returns:    -
00914     Purpose:    Stops bad paths form using all stack space up.
00915     Errors:     -
00916     Scope:      Public
00917     SeeAlso:    -
00918 
00919 ********************************************************************************************/
00920 
00921 void GDrawAsm::SetStackLimit( LPVOID stack )
00922 {
00923     CriticalSection Ralph;
00924 
00925     ERROR3("SetStackLimit() is not thread safe!!! Use SetStackSize() instead.");
00926 
00927     if (!(MakeCurrent())) return;
00928     CamProfile cp(CAMPROFILE_GDRAW);
00929     XaDraw_SetStackLimit(m_pContext, stack);
00930 }
00931 
00932 
00933 /********************************************************************************************
00934 
00935 >   void GDrawAsm::SetStackSize(INT32 StackSize)
00936 
00937     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00938     Created:    9/10/94
00939     Inputs:     Maximum size of stack for path flattening
00940     Outputs:    -
00941     Returns:    -
00942     Purpose:    Stops bad paths form using all stack space up.
00943     Errors:     -
00944     Scope:      Public
00945     SeeAlso:    -
00946 
00947 ********************************************************************************************/
00948 
00949 void GDrawAsm::SetStackSize(DWORD StackSize)
00950 {
00951     CriticalSection Ralph;
00952 
00953     if (!(MakeCurrent())) return;
00954     CamProfile cp(CAMPROFILE_GDRAW);
00955     XaDraw_SetStackSize(m_pContext, StackSize);
00956 }
00957 
00958 /********************************************************************************************
00959 
00960 >   BOOL GDrawAsm::SetupBitmap( INT32 Width, INT32 Height, INT32 Depth, LPBYTE Bits, DWORD Format = 2 )
00961 
00962     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00963     Created:    14/7/94
00964     Inputs:     Bitmap size & depth and pointer to actual bitmap bytes.
00965     Outputs:    -
00966     Returns:    TRUE if OK, FALSE if didn't like bitmap for some reason.
00967     Purpose:    This is the bitmap that will be drawn into with rendering calls.
00968     Errors:     -
00969     Scope:      Public
00970     SeeAlso:    -
00971 
00972 ********************************************************************************************/
00973 
00974 BOOL GDrawAsm::SetupBitmap( INT32 Width, INT32 Height, INT32 Depth, LPBYTE Bits, DWORD Format, BOOL DoBiCompression )
00975 {
00976     CriticalSection Ralph;
00977 
00978     if (!(MakeCurrent())) return(FALSE);
00979     // build a Windows-like structure because thats what Gavin wants.
00980 
00981     BITMAPINFOHEADER bmInfo;
00982 
00983     bmInfo.biSize = sizeof(BITMAPINFOHEADER);
00984     bmInfo.biWidth = Width;
00985     bmInfo.biHeight = Height;
00986     bmInfo.biPlanes = 1;
00987     bmInfo.biBitCount = (WORD)Depth;
00988 
00989     if(DoBiCompression == TRUE)
00990     {
00991         // In GDraw 2.008 Docs it says that 32 bit BMPs need this setting to this value
00992         // if they are to use the Transparency channel.
00993         bmInfo.biCompression = 0x80000001;
00994     }
00995     else
00996     {
00997         bmInfo.biCompression = BI_RGB;
00998     }
00999 
01000     bmInfo.biSizeImage = 0L;
01001     bmInfo.biXPelsPerMeter = 1000;
01002     bmInfo.biYPelsPerMeter = 1000;
01003     bmInfo.biClrUsed = 0;
01004     bmInfo.biClrImportant = 0;
01005 
01006     // Set up bitmap, but preserve the changed bounding box...
01007     RECT BBox;
01008     GetChangedBBox(&BBox);
01009 
01010     if(DoBiCompression == TRUE && Bits != NULL)
01011     {
01012         // Another point stated in the GDraw 2.008 Docs is that the 32bit BMP should be
01013         // Initialized to 00,00,00,FF for every pixel!
01014 
01015         DWORD* pSetBits = (DWORD*)Bits;
01016         DWORD BMPSIZE = (Width * Height);// >> 2;       // Ilan - why was there a ">> 2"??
01017         DWORD Index = 0;
01018 
01019         while(Index < BMPSIZE)
01020         {
01021             pSetBits[Index++] = 0xFF000000;
01022         }
01023     }
01024 
01025     if ( Depth == 8 )
01026     {
01027         //  If the bitmap is 8 bit then we must use a format of 0 for Gavin to avoid using his new greyscale bitmap stuff
01028         //  This is quite horrible as we are corrupting an entry parameter to this function
01029         //  but as nothing seems to be setting this correctly in 8 bit modes there is little easy alternative
01030         Format = 0;
01031     }
01032 
01033     CamProfile cp(CAMPROFILE_GDRAW);
01034 #if defined(__WXMSW__) || !USE_wxBITMAP
01035     BOOL Result = XaDraw_SetDIBitmap(m_pContext, &bmInfo, Bits, Format) ? FALSE : TRUE;
01036 #else
01037     BOOL Result = XaDraw_SetInvertedDIBitmap(m_pContext, &bmInfo, Bits, Format) ? FALSE : TRUE;
01038 #endif  
01039 
01040     // Bodged out until this is implemented...
01041 //  SetChangedBBox(&BBox);
01042 
01043     return Result;
01044 }
01045 
01046 
01047 
01048 /********************************************************************************************
01049 
01050 >   BOOL GDrawAsm::SetBitmap( CONST LPBITMAPINFO BitmapInfo, CONST LPBYTE Bitmap, DWORD BitmapFormat = 2)
01051 
01052     Author:     Ilan_Copelyn (Xara Group Ltd) <camelotdev@xara.com>
01053     Created:    9/5/00
01054     Inputs:     Bitmap info and bits
01055     Outputs:    -
01056     Returns:    TRUE if OK, FALSE if didn't like bitmap for some reason.
01057 
01058 ********************************************************************************************/
01059 
01060 
01061 BOOL GDrawAsm::SetBitmap( CONST LPBITMAPINFOHEADER BitmapInfo, CONST LPBYTE Bitmap, DWORD BitmapFormat )
01062 {
01063     CriticalSection Ralph;
01064     CamProfile cp(CAMPROFILE_GDRAW);
01065 
01066 #if defined(__WXMSW__) || !USE_wxBITMAP
01067     return (MakeCurrent() && (XaDraw_SetDIBitmap(m_pContext, BitmapInfo,Bitmap, BitmapFormat) ? FALSE : TRUE));
01068 #else
01069     return (MakeCurrent() && (XaDraw_SetInvertedDIBitmap(m_pContext, BitmapInfo,Bitmap, BitmapFormat) ? FALSE : TRUE));
01070 #endif  
01071 }
01072 
01073 /********************************************************************************************
01074 
01075 >   BOOL GDrawAsm::SetMatrix( GMATRIX* GMat)
01076 
01077     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01078     Created:    14/7/94
01079     Inputs:     A GMatrix.
01080     Outputs:    -
01081     Returns:    TRUE if worked, FALSE if failed.
01082     Purpose:    Sets the matrix to be used during rendering.
01083     Errors:     -
01084     Scope:      Public
01085     SeeAlso:    -
01086 
01087 ********************************************************************************************/
01088 
01089 BOOL GDrawAsm::SetMatrix( GMATRIX* GMat)
01090 {
01091     CriticalSection Ralph;
01092     CamProfile cp(CAMPROFILE_GDRAW);
01093 
01094     return (MakeCurrent() && (XaDraw_SetMatrix(m_pContext, GMat) ? FALSE : TRUE));
01095 }
01096 
01097 /********************************************************************************************
01098 
01099 >   void GDrawAsm::SetAntialiasFlag( BOOL Flag )
01100 
01101     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01102     Created:    14/7/94
01103     Inputs:     Flag determines whether output should be antialiased or not.
01104     Outputs:    -
01105     Returns:    -
01106     Purpose:    Sets the matrix to be used during rendering.
01107     Errors:     -
01108     Scope:      Public
01109     SeeAlso:    -
01110 
01111 ********************************************************************************************/
01112 
01113 void GDrawAsm::SetAntialiasFlag( BOOL Flag )
01114 {
01115     CriticalSection Ralph;
01116     CamProfile cp(CAMPROFILE_GDRAW);
01117 
01118     if (MakeCurrent()) XaDraw_SetAntialiasFlag(m_pContext, FALSE != Flag );
01119 }
01120 
01121 /********************************************************************************************
01122 
01123 >   void GDrawAsm::SetAntialiasQualityFlag( BOOL Flag )
01124 
01125     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01126     Created:    14/7/94
01127     Inputs:     Flag determines whether antialiasing should be high quality or standard
01128     Outputs:    -
01129     Returns:    -
01130     Purpose:    -
01131     Errors:     -
01132     Scope:      Public
01133     SeeAlso:    -
01134 
01135 ********************************************************************************************/
01136 
01137 void GDrawAsm::SetAntialiasQualityFlag( BOOL Flag )
01138 {
01139     CriticalSection Ralph;
01140     CamProfile cp(CAMPROFILE_GDRAW);
01141 
01142     if (MakeCurrent()) XaDraw_SetAntialiasQualityFlag(m_pContext, FALSE != Flag );
01143 }
01144 
01145 /********************************************************************************************
01146 
01147 >   void GDrawAsm::SetTileSmoothingFlag( BOOL Flag )
01148 
01149     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> H
01150     Created:    13/9/99
01151     Inputs:     Flag determines whether output should be Smoothed or not.
01152     Purpose:    Sets smoother rendering of Bitmap Plotting, but does not work
01153                 with perspectivised!
01154 
01155 ********************************************************************************************/
01156 void GDrawAsm::SetTileSmoothingFlag( BOOL Flag )
01157 {
01158     CriticalSection Ralph;
01159     CamProfile cp(CAMPROFILE_GDRAW);
01160 
01161     if (MakeCurrent()) XaColour_SetTileSmoothingFlag(m_pContext, FALSE != Flag );
01162 }
01163 
01164 /********************************************************************************************
01165 
01166 >   void GDrawAsm::SetTileFilteringFlag( BOOL Flag )
01167 
01168     Author:     Andy_Hills (Xara Group Ltd) <camelotdev@xara.com>
01169     Created:    27/10/00
01170     Inputs:     Flag determines whether output should be rendered using maximum quality.
01171     Purpose:    Sets smoothest rendering of bitmaps - rotation & scaling.
01172 
01173 ********************************************************************************************/
01174 void GDrawAsm::SetTileFilteringFlag( BOOL Flag )
01175 {
01176     CriticalSection Ralph;
01177     CamProfile cp(CAMPROFILE_GDRAW);
01178 
01179     if (MakeCurrent()) XaColour_SetTileFilteringFlag(m_pContext, FALSE != Flag );
01180 }
01181 
01182 /********************************************************************************************/
01183 
01184 void GDrawAsm::SetMaxFilterSize( UINT32 uSize )
01185 {
01186     CriticalSection Ralph;
01187     CamProfile cp(CAMPROFILE_GDRAW);
01188 
01189     if ( MakeCurrent() )
01190         XaBitmap_SetMaxFilterSize(m_pContext,uSize);
01191 }
01192 
01193 /********************************************************************************************/
01194 
01195 BOOL GDrawAsm::Blur( INT32 nBlur )
01196 {
01197     CriticalSection Ralph;
01198     CamProfile cp(CAMPROFILE_GDRAW);
01199 
01200     return MakeCurrent() && (XaBitmap_Blur(m_pContext,nBlur) ? FALSE : TRUE);
01201 }
01202 
01203 /********************************************************************************************/
01204 
01205 BOOL GDrawAsm::Sharpen( INT32 nSharpen )
01206 {
01207     CriticalSection Ralph;
01208     CamProfile cp(CAMPROFILE_GDRAW);
01209 
01210     return MakeCurrent() && (XaBitmap_Sharpen(m_pContext,nSharpen) ? FALSE : TRUE);
01211 }
01212 
01213 /********************************************************************************************
01214 
01215 >   void GDrawAsm::SetHintingFlag( BOOL Flag )
01216 
01217     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
01218     Created:    09/01/95
01219     Inputs:     Flag determines whether output should be hinted or not.
01220     Outputs:    -
01221     Returns:    -
01222     Purpose:    Sets the flag in GDraw which forces all exactly horizontal and vertical line
01223                 segments to be hinted onto pixel centres.
01224     Errors:     -
01225     Scope:      Public
01226     SeeAlso:    -
01227 
01228 ********************************************************************************************/
01229 
01230 void GDrawAsm::SetHintingFlag( BOOL Flag )
01231 {
01232     CriticalSection Ralph;
01233     CamProfile cp(CAMPROFILE_GDRAW);
01234 
01235     if (MakeCurrent()) XaDraw_SetHintingFlag(m_pContext, FALSE != Flag );
01236 }
01237 
01238 /********************************************************************************************
01239 
01240 >   void GDrawAsm::SetFlatness( DWORD Flat )
01241 
01242     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01243     Created:    14/7/94
01244     Inputs:     How much beziers should be flattened.
01245     Outputs:    -
01246     Returns:    -
01247     Purpose:    Sets the flattening.
01248     Errors:     -
01249     Scope:      Public
01250     SeeAlso:    -
01251 
01252 ********************************************************************************************/
01253 
01254 void GDrawAsm::SetFlatness( DWORD Flat )
01255 {
01256     CriticalSection Ralph;
01257     CamProfile cp(CAMPROFILE_GDRAW);
01258 
01259     if (MakeCurrent()) XaDraw_SetFlatness(m_pContext, Flat );
01260 }
01261 
01262 /********************************************************************************************
01263 
01264 >   void GDrawAsm::TransformPath( LPPOINT IPoints, LPPOINT OPoints, DWORD Length, GMATRIX*GMat )
01265 
01266     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01267     Created:    14/7/94
01268     Inputs:     IPoints is the path to be transformed. Length is how many points. GMatrix is the
01269                 matrix which wants to be used.
01270     Outputs:    OPoints is where the converted path goes (can be the same as IPoints).
01271     Returns:    -
01272     Purpose:    Convert any number of points using a GMatrix.
01273     Errors:     -
01274     Scope:      Public
01275     SeeAlso:    -
01276 
01277 ********************************************************************************************/
01278 
01279 void GDrawAsm::TransformPath( LPPOINT IPoints, LPPOINT OPoints, DWORD Length, GMATRIX*GMat )
01280 {
01281     CriticalSection Ralph;
01282     CamProfile cp(CAMPROFILE_GDRAW);
01283 
01284     if (MakeCurrent()) XaDraw_TransformPath(m_pContext, IPoints, OPoints, Length, GMat );
01285 }
01286 
01287 /********************************************************************************************
01288 
01289 >   INT32 GDrawAsm::MaxScale( CONST GMATRIX *Matrix, CONST RECT *BBox )
01290 
01291     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01292     Created:    26/4/95
01293     Inputs:     -
01294     Returns:    The scale factor that should be safe to use.
01295 
01296     Purpose:    This returns a scale factor that should be safe to use for a drawing
01297                 of the size of the given bounding box. Currently only the translation
01298                 values of the matrix are used. To convert this maximum scale factor
01299                 to a zoom value, divide by the scale factor required for 100% zoom.
01300 
01301                 It is assumed that the required matrix is of the form
01302 
01303                                                         +-S,0,0,+-S,Tx,Ty
01304 
01305                 where S is the value returned and Tx,Ty are the translation values
01306                 of the given matrix.
01307 
01308     Errors:     returns -1, on failure.
01309     Scope:      Public
01310     SeeAlso:    -
01311 
01312 ********************************************************************************************/
01313 
01314 INT32 GDrawAsm::MaxScale( CONST GMATRIX *Matrix, CONST RECT *BBox )
01315 {
01316     CriticalSection Ralph;
01317     CamProfile cp(CAMPROFILE_GDRAW);
01318 
01319     if (!MakeCurrent()) return -1;
01320     return XaDraw_MaxScale(m_pContext, Matrix, BBox );
01321 }
01322 
01324 // colour
01326 
01327 /********************************************************************************************
01328 
01329 >   void GDrawAsm::SetHalftoneOrigin( DWORD x, DWORD y )
01330 
01331     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01332     Created:    14/7/94
01333     Inputs:     X and Y offsets.
01334     Outputs:    -
01335     Returns:    -
01336     Purpose:    Sets the origin of the dither patterns.
01337     Errors:     -
01338     Scope:      Public
01339     SeeAlso:    -
01340 
01341 ********************************************************************************************/
01342 
01343 void GDrawAsm::SetHalftoneOrigin( DWORD x, DWORD y )
01344 {
01345     CriticalSection Ralph;
01346     CamProfile cp(CAMPROFILE_GDRAW);
01347 
01348     if (MakeCurrent()) XaColour_SetHalftoneOrigin(m_pContext, x, y );
01349 }
01350 
01351 /********************************************************************************************
01352 
01353 >   BOOL GDrawAsm::SetConversionPalette( PLOGPALETTE pPalette )
01354 
01355     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01356     Created:    20/5/96
01357     Inputs:     The Palette to use for ConvertBitmap.
01358     Outputs:    -
01359     Returns:    TRUE if worked, FALSE if failed.
01360     Purpose:    Sets the Palette that is to be used for ConvertBitmap.
01361     Errors:     -
01362     Scope:      Public
01363     SeeAlso:    -
01364 
01365 ********************************************************************************************/
01366 
01367 BOOL GDrawAsm::SetConversionPalette( PLOGPALETTE pPalette )
01368 {
01369     CriticalSection Ralph;
01370     CamProfile cp(CAMPROFILE_GDRAW);
01371 
01372     return (MakeCurrent() && (XaColour_SetConversionPalette(m_pContext, pPalette ) ? FALSE : TRUE));
01373 }
01374 
01375 /********************************************************************************************
01376 
01377 >   virtual BOOL GDrawAsm::SetDitherStyle(DitherStyle Style = DITHER_GREY_ORDERED)
01378 
01379     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
01380     Created:    2/5/96
01381 
01382     Inputs:     DitherStyle - Indicates the new DitherStyle to be used, from:
01383                         DITHER_ORDERED,
01384                         DITHER_GREY_ORDERED,
01385                         DITHER_NONE
01386     Returns:    TRUE if it worked, else FALSE
01387 
01388     Purpose:    Sets the style of the dither patterns.
01389 
01390     Scope:      Public
01391 
01392 ********************************************************************************************/
01393 
01394 BOOL GDrawAsm::SetDitherStyle(DitherStyle Style)
01395 {
01396     CriticalSection Ralph;
01397     CamProfile cp(CAMPROFILE_GDRAW);
01398 
01399     return (MakeCurrent() && (XaColour_SetDitherStyle(m_pContext,Style) ? FALSE : TRUE));
01400 }
01401 
01402 
01403 
01404 /********************************************************************************************
01405 
01406 >   BOOL GDrawAsm::AddToGraduationTable( COLORREF Colour, BOOL HSV, GraduationTable* Table, DWORD Index)
01407 
01408     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01409     Created:    14/9/94
01410     Inputs:     A colour to add. If HSV is TRUE then the colour is coverted to RGB
01411                 in HSV space, else in RGB space.
01412     Outputs:    GraduationTable is updated to include the new colour.
01413     Returns:    TRUE if worked, FALSE if failed.
01414     Purpose:    Adds a colour to a grad table at the specified point.
01415     Errors:     -
01416     Scope:      Public
01417     SeeAlso:    -
01418 
01419 ********************************************************************************************/
01420 
01421 BOOL GDrawAsm::AddToGraduationTable( COLORREF Colour, BOOL HSV, GraduationTable* Table, DWORD Index)
01422 {
01423     CriticalSection Ralph;
01424     CamProfile cp(CAMPROFILE_GDRAW);
01425 
01426     return (MakeCurrent() && (XaColour_AddToGraduationTable(m_pContext, Colour, HSV, Table, Index ) ? FALSE : TRUE));
01427 }
01428 
01429 /********************************************************************************************
01430 
01431 >   BOOL GDrawAsm::BuildGraduationTable( COLORREF Start, COLORREF End, BOOL HSV, GraduationTable* Table)
01432 
01433     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01434     Created:    14/7/94
01435     Inputs:     A start and end colour. If HSV is TRUE then intermediate colours generated
01436                 in HSV space, else in RGB space.
01437     Outputs:    GraduationTable is filled as required (defined in gconsts.h).
01438     Returns:    TRUE if worked, FALSE if failed.
01439     Purpose:    Gets table ready for grad fills.
01440     Errors:     -
01441     Scope:      Public
01442     SeeAlso:    -
01443 
01444 ********************************************************************************************/
01445 
01446 BOOL GDrawAsm::BuildGraduationTable( COLORREF Start, COLORREF End, DWORD HSV, GraduationTable* Table)
01447 {
01448     CriticalSection Ralph;
01449     CamProfile cp(CAMPROFILE_GDRAW);
01450 
01451     return (MakeCurrent() && (XaColour_BuildGraduationTable(m_pContext, Start, End, HSV, Table ) ? FALSE : TRUE));
01452 }
01453 
01454 /********************************************************************************************
01455 
01456 >   BOOL GDrawAsm::BuildTransparencyTable( DWORD Start, DWORD End, TransparentGradTable* Table)
01457 
01458     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01459     Created:    23/8/94
01460     Inputs:     A start and end transparency.
01461     Outputs:    TransparentGradTable is filled as required (defined in gconsts.h).
01462     Returns:    TRUE if worked, FALSE if failed.
01463     Purpose:    Gets table ready for transparent grad fills.
01464     Errors:     -
01465     Scope:      Public
01466     SeeAlso:    -
01467 
01468 ********************************************************************************************/
01469 
01470 BOOL GDrawAsm::BuildTransparencyTable( DWORD Start, DWORD End, TransparentGradTable* Table)
01471 {
01472     CriticalSection Ralph;
01473     CamProfile cp(CAMPROFILE_GDRAW);
01474 
01475     return (MakeCurrent() && (XaColour_BuildTransparencyTable(m_pContext, Start, End, Table ) ? FALSE : TRUE));
01476 }
01477 
01478 /********************************************************************************************
01479 
01480 >   BOOL GDrawAsm::SetColour( COLORREF Colour )
01481 
01482     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01483     Created:    14/7/94
01484     Inputs:     A colour.
01485     Outputs:    -
01486     Returns:    TRUE if worked, FALSE if failed.
01487     Purpose:    Sets drawing colour to be used in subsequent rendering.
01488     Errors:     -
01489     Scope:      Public
01490     SeeAlso:    -
01491 
01492 ********************************************************************************************/
01493 
01494 BOOL GDrawAsm::SetColour( COLORREF Colour )
01495 {
01496     CriticalSection Ralph;
01497     CamProfile cp(CAMPROFILE_GDRAW);
01498 
01499     return (MakeCurrent() && (XaColour_SetColour(m_pContext, Colour ) ? FALSE : TRUE));
01500 }
01501 
01502 /********************************************************************************************
01503 
01504 >   BOOL GDrawAsm::SetSolidColour( COLORREF Colour, DWORD BPP = 0, DWORD Format = 2 )
01505 
01506     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01507     Created:    12/4/95
01508     Inputs:     A colour.
01509     Outputs:    -
01510     Returns:    TRUE if worked, FALSE if failed.
01511     Purpose:    Sets drawing colour to be used in subsequent rendering.
01512     Errors:     -
01513     Scope:      Public
01514     SeeAlso:    -
01515 
01516 ********************************************************************************************/
01517 
01518 BOOL GDrawAsm::SetSolidColour( COLORREF Colour, DWORD BPP, DWORD Format )
01519 {
01520     CriticalSection Ralph;
01521     CamProfile cp(CAMPROFILE_GDRAW);
01522 
01523     return (MakeCurrent() && (XaColour_SetSolidColour(m_pContext, Colour, BPP, Format ) ? FALSE : TRUE));
01524 }
01525 
01526 /********************************************************************************************
01527 
01528 >   BOOL GDrawAsm::SetWordColour( DWORD Colour )
01529 
01530     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01531     Created:    12/4/95
01532     Inputs:     A colour.
01533     Outputs:    -
01534     Returns:    TRUE if worked, FALSE if failed.
01535     Purpose:    Sets drawing colour to be used in subsequent rendering.
01536     Errors:     -
01537     Scope:      Public
01538     SeeAlso:    -
01539 
01540 ********************************************************************************************/
01541 
01542 BOOL GDrawAsm::SetWordColour( DWORD Colour )
01543 {
01544     CriticalSection Ralph;
01545     CamProfile cp(CAMPROFILE_GDRAW);
01546 
01547     return (MakeCurrent() && (XaColour_SetWordColour(m_pContext, Colour ) ? FALSE : TRUE));
01548 }
01549 
01550 /********************************************************************************************
01551 
01552 >   BOOL GDrawAsm::SetTransparency( COLORREF Colour, TransparencyEnum Trans)
01553 
01554     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01555     Created:    14/7/94
01556     Inputs:     A colour and a transparency method.
01557     Outputs:    -
01558     Returns:    TRUE if worked, FALSE if failed.
01559     Purpose:    Sets drawing colour to be used in subsequent rendering with transparency.
01560                 Only has effect if output device can do transparency, else falls into
01561                 SetColour.
01562     Errors:     -
01563     Scope:      Public
01564     SeeAlso:    -
01565 
01566 ********************************************************************************************/
01567 
01568 BOOL GDrawAsm::SetTransparency( COLORREF Colour, TransparencyEnum Trans)
01569 {
01570     CriticalSection Ralph;
01571     CamProfile cp(CAMPROFILE_GDRAW);
01572 
01573     return (MakeCurrent() && (XaColour_SetTransparency(m_pContext, Colour, Trans ) ? FALSE : TRUE));
01574 }
01575 
01576 /********************************************************************************************
01577 
01578 >   BOOL GDrawAsm::ConvertBitmap( LPBITMAPINFO SInfo, LPBYTE SBytes, LPBITMAPINFO DInfo,
01579                                     LPBYTE DBytes, INT32 Dither )
01580 
01581     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01582     Created:    14/7/94
01583     Inputs:     SInfo and SBytes are the source bitmap. Dither is the type of dithering
01584                 required (currently 0=ordered dither, 1=error diffused).
01585     Outputs:    DInfo and DBytes are the destination bitmap.
01586     Returns:    TRUE if worked, FALSE if failed (e.g. unsupported bitmap depth(s))
01587     Purpose:    Converts bitmaps from one format to another. Currently supported modes are:
01588                 16->8 and 32->8.
01589     Errors:     -
01590     Scope:      Public
01591     SeeAlso:    -
01592 
01593 ********************************************************************************************/
01594 
01595 BOOL GDrawAsm::ConvertBitmap( LPBITMAPINFOHEADER SInfo, LPBYTE SBytes, LPBITMAPINFOHEADER DInfo,
01596                                     LPBYTE DBytes, INT32 Dither )
01597 {
01598     CriticalSection Ralph;
01599     CamProfile cp(CAMPROFILE_GDRAW);
01600 
01601     return (MakeCurrent() && (XaColour_ConvertBitmap(m_pContext, SInfo, SBytes, DInfo, DBytes, Dither ) ? FALSE : TRUE));
01602 }
01603 
01604 /********************************************************************************************
01605 
01606 >   LPLOGPALETTE GDrawAsm::SelectPalette( INT32 WhichPal )
01607 
01608     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01609     Created:    14/7/94
01610     Inputs:     A palette number. 0 is greyscale, 1=normal, for other numbers see Gavins
01611                 documentation.
01612     Outputs:    -
01613     Returns:    Pointer to a recommended logical palette, or NULL if cannot.
01614     Purpose:    Returns a 256 colour logical palette that should be used in 8-bit modes.
01615     Errors:     -
01616     Scope:      Public
01617     SeeAlso:    -
01618 
01619 ********************************************************************************************/
01620 
01621 const LOGPALETTE* GDrawAsm::SelectPalette( INT32 WhichPal )
01622 {
01623     CriticalSection Ralph;
01624     CamProfile cp(CAMPROFILE_GDRAW);
01625 
01626     if (!MakeCurrent()) return NULL;
01627     return XaColour_SelectPalette(m_pContext, FALSE != WhichPal );
01628 }
01629 
01630 /********************************************************************************************
01631 
01632 >   BOOL GDrawAsm::SetGraduation(
01633         DWORD Style,
01634         CONST GraduationTable *Table,
01635         CONST POINT *PointA,
01636         CONST POINT *PointB,
01637         CONST POINT *PointC
01638     )
01639 
01640     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01641     Created:    14/7/94
01642     Inputs:     Sets the current fill style to a colour graduation. The low bytes of Style
01643                 should be 0 for linear, 1 for elliptical and 2 for conical. Style & 0xFF
01644                 defines the transparency type (see SetTransparency). Table should have been
01645                 set up either manually or with BuildGraduationTable. The points are used
01646                 to define where the fill is (see Gavins docs).
01647     Outputs:    -
01648     Returns:    TRUE if worked, FALSE if failed.
01649     Purpose:    Reads the currently selected palette and builds internal tables based upon
01650                 the results. Should be called after a palette change. Note that this may take
01651                 a few seconds to execute and should be called sparingly.
01652     Errors:     -
01653     Scope:      Public
01654     SeeAlso:    SetTransparency;BuildGraduationTable
01655 
01656 ********************************************************************************************/
01657 
01658 BOOL GDrawAsm::SetGraduation(
01659         DWORD Style,
01660         CONST GraduationTable *Table,
01661         CONST POINT *PointA,
01662         CONST POINT *PointB,
01663         CONST POINT *PointC
01664     )
01665 {
01666     CriticalSection Ralph;
01667     CamProfile cp(CAMPROFILE_GDRAW);
01668 
01669     return (MakeCurrent() && (XaColour_SetGraduation(m_pContext, Style, Table, PointA, PointB, PointC ) ? FALSE : TRUE));
01670 }
01671 
01672 /********************************************************************************************
01673 
01674 >   BOOL GDrawAsm::SetTransparentGraduation(
01675         DWORD Style,
01676         CONST TranspGradTable *Table,
01677         CONST POINT *PointA,
01678         CONST POINT *PointB,
01679         CONST POINT *PointC
01680     )
01681 
01682     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01683     Created:    23/8/94
01684     Inputs:     Sets the current fill style to a transparent graduation. The low bytes of Style
01685                 should be 0 for linear, 1 for elliptical and 2 for conical. Style & 0xFF
01686                 defines the transparency type (see SetTransparency). Table should have been
01687                 set up either manually or with BuildTransparencyTable. The points are used
01688                 to define where the fill is (see Gavins docs).
01689     Outputs:    -
01690     Returns:    TRUE if worked, FALSE if failed.
01691     Purpose:    Reads the currently selected palette and builds internal tables based upon
01692                 the results. Should be called after a palette change. Note that this may take
01693                 a few seconds to execute and should be called sparingly.
01694     Errors:     -
01695     Scope:      Public
01696     SeeAlso:    SetTransparency;BuildTransparencyTable
01697 
01698 ********************************************************************************************/
01699 
01700 BOOL GDrawAsm::SetTransparentGraduation(
01701         DWORD Style,
01702         CONST TranspGradTable *Table,
01703         CONST POINT *PointA,
01704         CONST POINT *PointB,
01705         CONST POINT *PointC
01706     )
01707 {
01708     CriticalSection Ralph;
01709     CamProfile cp(CAMPROFILE_GDRAW);
01710 
01711     Style = Style & 0xFFFF00FF;
01712     if (Table->IsLarge())
01713         Style |= 0x0100;
01714 
01715     return (MakeCurrent() && (XaColour_SetTransparentGraduation(m_pContext, Style, Table->GetTable(), PointA, PointB, PointC ) ? FALSE : TRUE));
01716 }
01717 
01718 
01719 /********************************************************************************************
01720 
01721 >   BOOL GDrawAsm::SetGraduation(
01722         DWORD Style,
01723         CONST GraduationTable *Table,
01724         CONST POINT *PointA,
01725         CONST POINT *PointB,
01726         CONST POINT *PointC
01727     )
01728 
01729     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01730     Created:    14/7/94
01731     Inputs:     Sets the current fill style to a colour graduation. The low bytes of Style
01732                 should be 0 for linear, 1 for elliptical and 2 for conical. Style & 0xFF
01733                 defines the transparency type (see SetTransparency). Table should have been
01734                 set up either manually or with BuildGraduationTable. The points are used
01735                 to define where the fill is (see Gavins docs).
01736     Outputs:    -
01737     Returns:    TRUE if worked, FALSE if failed.
01738     Purpose:    Reads the currently selected palette and builds internal tables based upon
01739                 the results. Should be called after a palette change. Note that this may take
01740                 a few seconds to execute and should be called sparingly.
01741     Errors:     -
01742     Scope:      Public
01743     SeeAlso:    SetTransparency;BuildGraduationTable
01744 
01745 ********************************************************************************************/
01746 
01747 BOOL GDrawAsm::SetGraduation4(
01748         DWORD Style,
01749         CONST GraduationTable *Table,
01750         CONST POINT *PointA,
01751         CONST POINT *PointB,
01752         CONST POINT *PointC,
01753         CONST POINT *PointD
01754     )
01755 {
01756     CriticalSection Ralph;
01757     CamProfile cp(CAMPROFILE_GDRAW);
01758 
01759     return (MakeCurrent() && (XaColour_SetGraduation4(m_pContext, Style, Table, PointA, PointB, PointC, PointD ) ? FALSE : TRUE));
01760 }
01761 
01762 /********************************************************************************************
01763 
01764 >   BOOL GDrawAsm::SetTransparentGraduation(
01765         DWORD Style,
01766         CONST TranspGradTable *Table,
01767         CONST POINT *PointA,
01768         CONST POINT *PointB,
01769         CONST POINT *PointC
01770     )
01771 
01772     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
01773     Created:    23/8/94
01774     Inputs:     Sets the current fill style to a transparent graduation. The low bytes of Style
01775                 should be 0 for linear, 1 for elliptical and 2 for conical. Style & 0xFF
01776                 defines the transparency type (see SetTransparency). Table should have been
01777                 set up either manually or with BuildTransparencyTable. The points are used
01778                 to define where the fill is (see Gavins docs).
01779     Outputs:    -
01780     Returns:    TRUE if worked, FALSE if failed.
01781     Purpose:    Reads the currently selected palette and builds internal tables based upon
01782                 the results. Should be called after a palette change. Note that this may take
01783                 a few seconds to execute and should be called sparingly.
01784     Errors:     -
01785     Scope:      Public
01786     SeeAlso:    SetTransparency;BuildTransparencyTable
01787 
01788 ********************************************************************************************/
01789 
01790 BOOL GDrawAsm::SetTransparentGraduation4(
01791         DWORD Style,
01792         CONST TranspGradTable *Table,
01793         CONST POINT *PointA,
01794         CONST POINT *PointB,
01795         CONST POINT *PointC,
01796         CONST POINT *PointD
01797     )
01798 {
01799     CriticalSection Ralph;
01800     CamProfile cp(CAMPROFILE_GDRAW);
01801 
01802     Style = Style & 0xFFFF00FF;
01803     if (Table->IsLarge())
01804         Style |= 0x0100;
01805 
01806     return (MakeCurrent() && (XaColour_SetTransparentGraduation4(m_pContext, Style, Table->GetTable(), PointA, PointB, PointC, PointD ) ? FALSE : TRUE));
01807 }
01808 
01809 /********************************************************************************************/
01810 
01811 BOOL GDrawAsm::SetBias( UINT32 uChannel,double fBias )
01812 {
01813     CriticalSection Ralph;
01814     CamProfile cp(CAMPROFILE_GDRAW);
01815 
01816     return MakeCurrent() && (XaBitmap_SetBias(m_pContext,uChannel,fBias) ? FALSE : TRUE);
01817 }
01818 
01819 /********************************************************************************************/
01820 
01821 BOOL GDrawAsm::SetGain( UINT32 uChannel,double fGain )
01822 {
01823     CriticalSection Ralph;
01824     CamProfile cp(CAMPROFILE_GDRAW);
01825 
01826     return MakeCurrent() && (XaBitmap_SetGain(m_pContext,uChannel,fGain) ? FALSE : TRUE);
01827 }
01828 
01829 /********************************************************************************************/
01830 
01831 BOOL GDrawAsm::SetBrightness( double fBrightness )
01832 {
01833     CriticalSection Ralph;
01834     CamProfile cp(CAMPROFILE_GDRAW);
01835 
01836     return MakeCurrent() && (XaBitmap_SetBrightness(m_pContext,fBrightness) ? FALSE : TRUE);
01837 }
01838 
01839 /********************************************************************************************/
01840 
01841 BOOL GDrawAsm::SetContrast( double fContrast )
01842 {
01843     CriticalSection Ralph;
01844     CamProfile cp(CAMPROFILE_GDRAW);
01845 
01846     return MakeCurrent() && (XaBitmap_SetContrast(m_pContext,fContrast) ? FALSE : TRUE);
01847 }
01848 
01849 /********************************************************************************************/
01850 
01851 BOOL GDrawAsm::SetGamma( double fGamma )
01852 {
01853     CriticalSection Ralph;
01854     CamProfile cp(CAMPROFILE_GDRAW);
01855 
01856     return MakeCurrent() && (XaBitmap_SetGamma(m_pContext,fGamma) ? FALSE : TRUE);
01857 }
01858 
01859 /********************************************************************************************/
01860 
01861 BOOL GDrawAsm::SetPostGamma( double fPostGamma )
01862 {
01863     CriticalSection Ralph;
01864     CamProfile cp(CAMPROFILE_GDRAW);
01865 
01866     return MakeCurrent() && (XaBitmap_SetPostGamma(m_pContext,fPostGamma) ? FALSE : TRUE);
01867 }
01868 
01869 /********************************************************************************************/
01870 
01871 BOOL GDrawAsm::SetSaturation( double fSaturation )
01872 {
01873     CriticalSection Ralph;
01874     CamProfile cp(CAMPROFILE_GDRAW);
01875 
01876     return MakeCurrent() && (XaBitmap_SetSaturation(m_pContext,fSaturation) ? FALSE : TRUE);
01877 }
01878 
01879 /********************************************************************************************/
01880 
01881 BOOL GDrawAsm::SetContone( UINT32 uContoneStyle, COLORREF rgbStart, COLORREF rgbEnd )
01882 {
01883     CriticalSection Ralph;
01884     CamProfile cp(CAMPROFILE_GDRAW);
01885 
01886     return MakeCurrent() && (XaBitmap_SetContone(m_pContext,uContoneStyle,rgbStart,rgbEnd) ? FALSE : TRUE);
01887 }
01888 
01889 /*******************************************************************************************/
01890 
01891 BOOL GDrawAsm::SetInputRange( UINT32 uChannel, BYTE uStart, BYTE uEnd )
01892 {
01893     CriticalSection Ralph;
01894     CamProfile cp(CAMPROFILE_GDRAW);
01895 
01896     return MakeCurrent() && (XaBitmap_SetInputRange(m_pContext,uChannel,uStart,uEnd) ? FALSE : TRUE);
01897 }
01898 /*******************************************************************************************/
01899 
01900 BOOL GDrawAsm::SetOutputRange( UINT32 uChannel, BYTE uStart, BYTE uEnd )
01901 {
01902     CriticalSection Ralph;
01903     CamProfile cp(CAMPROFILE_GDRAW);
01904 
01905     return MakeCurrent() && (XaBitmap_SetOutputRange(m_pContext,uChannel,uStart,uEnd) ? FALSE : TRUE);
01906 }
01907 
01908 /*******************************************************************************************/
01909 
01910 BOOL GDrawAsm::SetBitmapFill( LPBITMAPINFOHEADER bmInfo, LPBYTE lpBytes, DWORD Style, LPPOINT Points,
01911                                     COLORREF DefaultColour, LPRGBQUAD ColourTable,
01912                                     LPBYTE Red, LPBYTE Green, LPBYTE Blue, LPBYTE Trans, DWORD Offset)
01913 {
01914     CriticalSection Ralph;
01915     CamProfile cp(CAMPROFILE_GDRAW);
01916 
01917     return (MakeCurrent() && (XaColour_SetTilePattern(m_pContext, bmInfo, lpBytes, Style, Points, Points+1, Points+2,
01918                                     DefaultColour, (CONST BGRT*)ColourTable, Red, Green, Blue, NULL, Offset)
01919                 ? FALSE : TRUE));
01920 }
01921 
01922 BOOL GDrawAsm::SetTransparentBitmapFill( LPBITMAPINFOHEADER bmInfo, LPBYTE lpBytes, DWORD Style, LPPOINT Points,
01923                                             COLORREF DefaultColour,  BYTE* pTable, DWORD Offset)
01924 {
01925     CriticalSection Ralph;
01926     CamProfile cp(CAMPROFILE_GDRAW);
01927 
01928     return (MakeCurrent() && (XaColour_SetTransparentTilePattern(m_pContext, bmInfo, lpBytes, Style, Points, Points+1, Points+2,
01929                                                 DefaultColour, pTable, Offset)
01930                 ? FALSE : TRUE));
01931 }
01932 
01933 BOOL GDrawAsm::SetPerspectiveBitmapFill( LPBITMAPINFOHEADER bmInfo, LPBYTE lpBytes, DWORD Style, LPPOINT Points,
01934                                         COLORREF DefaultColour, LPRGBQUAD ColourTable,
01935                                         LPBYTE Red, LPBYTE Green, LPBYTE Blue, LPBYTE Trans, DWORD Offset)
01936 {
01937     CriticalSection Ralph;
01938     CamProfile cp(CAMPROFILE_GDRAW);
01939 
01940     return (MakeCurrent() && (XaColour_SetTilePattern4(m_pContext, bmInfo, lpBytes, Style, Points, Points+1, Points+2, Points+3,
01941                                     DefaultColour, (CONST BGRT*)ColourTable, Red, Green, Blue, Trans, Offset)
01942                 ? FALSE : TRUE));
01943 }
01944 
01945 BOOL GDrawAsm::SetPerspectiveTransparentBitmapFill( LPBITMAPINFOHEADER bmInfo, LPBYTE lpBytes, DWORD Style, LPPOINT Points,
01946                                                     COLORREF DefaultColour, BYTE* pTable, DWORD Offset)
01947 {
01948     CriticalSection Ralph;
01949     CamProfile cp(CAMPROFILE_GDRAW);
01950 
01951     return (MakeCurrent() && (XaColour_SetTransparentTilePattern4(m_pContext, bmInfo, lpBytes, Style, Points, Points+1, Points+2, Points+3,
01952                                                 DefaultColour, pTable, Offset)
01953                 ? FALSE : TRUE));
01954 }
01955 
01956 /********************************************************************************************
01957 
01958 >   BOOL GDrawAsm::SetTransparencyLookupTable(CONST BYTE * Table)
01959 
01960     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
01961     Created:    02/11/94
01962     Inputs:     Pointer to a table
01963     Outputs:    GDraw set up
01964     Returns:    TRUE if worked, FALSE if failed.
01965     Purpose:    Sets the table for type 12 transparency
01966     Errors:     -
01967     Scope:      Public
01968     SeeAlso:    -
01969 
01970 ********************************************************************************************/
01971 BOOL GDrawAsm::SetTransparencyLookupTable(CONST BYTE * Table)
01972 {
01973     CriticalSection Ralph;
01974     CamProfile cp(CAMPROFILE_GDRAW);
01975 
01976     return (MakeCurrent() && (XaColour_SetTransparencyLookupTable(m_pContext,Table)
01977                 ? FALSE : TRUE));
01978 }
01979 
01980 
01982 // rendering
01984 
01985 /********************************************************************************************
01986 
01987 >   BOOL GDrawAsm::StrokePath( LPPOINT Points, const BYTE *Verbs, DWORD Len, BOOL Close,
01988                                 DWORD LineWidth, CapStyles LineCaps, JoinStyles LineJoin,
01989                                 CONST DashType *Dash )
01990 
01991     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
01992     Created:    14/7/94
01993     Inputs:     Points is the list of co-ords of the path. Verbs is the PC_xx verb list.
01994                 Len is how many points there are. Close controls whether open paths are
01995                 closed. Dash can be NULL for solid lines.
01996     Outputs:    -
01997     Returns:    TRUE if worked, FALSE if failed.
01998     Purpose:    Strokes the path using the current fill style. Zero width lines are plotted
01999                 as single pixel lnies and never anti-aliased.
02000     Errors:     -
02001     Scope:      Public
02002     SeeAlso:    -
02003 
02004 ********************************************************************************************/
02005 
02006 BOOL GDrawAsm::StrokePath( LPPOINT Points, const BYTE *Verbs, UINT32 Len, BOOL Close,
02007                                 DWORD LineWidth, CapStyles LineCaps, JoinStyles LineJoin,
02008                                 CONST DashType *Dash )
02009 {
02010     CriticalSection Ralph;
02011     CamProfile cp(CAMPROFILE_GDRAW);
02012 
02013     return (MakeCurrent() && (XaDraw_StrokePath(m_pContext, Points, Verbs, Len, FALSE != Close, LineWidth, 
02014         LineCaps, LineJoin, Dash ) ? FALSE : TRUE));
02015 }
02016 
02017 /********************************************************************************************
02018 
02019 >   BOOL GDrawAsm::FillPath( LPPOINT Points, const BYTE *Verbs, size_t Length, DWORD Winding )
02020 
02021     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
02022     Created:    14/7/94
02023     Inputs:     Points is the list of co-ords of the path. Verbs is the PC_xx verb list.
02024                 Length is how many points there are.
02025     Outputs:    -
02026     Returns:    TRUE if worked, FALSE if failed.
02027     Purpose:    Fills the path using the current fill style.
02028     Errors:     -
02029     Scope:      Public
02030     SeeAlso:    -
02031 
02032 ********************************************************************************************/
02033 
02034 BOOL GDrawAsm::FillPath( LPPOINT Points, const BYTE *Verbs, UINT32 Length, DWORD Winding )
02035 {
02036     CriticalSection Ralph;
02037     CamProfile cp(CAMPROFILE_GDRAW);
02038 
02039     return (MakeCurrent() && (XaDraw_FillPath(m_pContext, Points, Verbs, Length, Winding ) ? FALSE : TRUE));
02040 }
02041 
02042 /********************************************************************************************
02043 
02044 >   BOOL GDrawAsm::GetStatistics( LPPOINT Points, const BYTE *Verbs, size_t Length, DWORD Winding,
02045                                   STATISTICS * Stats )
02046 
02047     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
02048     Created:    27/01/95
02049     Inputs:     Points is the list of co-ords of the path. Verbs is the PC_xx verb list.
02050                 Length is how many points there are.
02051     Outputs:    Stats filled in with statistics
02052     Returns:    TRUE if worked, FALSE if failed.
02053     Purpose:    Fills the path counting various things about it
02054     Errors:     -
02055     Scope:      Public
02056     SeeAlso:    -
02057 
02058 ********************************************************************************************/
02059 
02060 BOOL GDrawAsm::GetStatistics( LPPOINT Points, const BYTE *Verbs, UINT32 Length, DWORD Winding,
02061                               STATISTICS * Stats )
02062 {
02063     CriticalSection Ralph;
02064     CamProfile cp(CAMPROFILE_GDRAW);
02065 
02066     return (MakeCurrent() && ((XaDraw_GetStatistics(m_pContext, Points, Verbs, Length, Winding, Stats )) ? (FALSE || 1 ) : TRUE));
02067 }
02068 
02069 /********************************************************************************************
02070 
02071 >   BOOL GDrawAsm::FillRectangle( LPRECT Rect )
02072 
02073     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
02074     Created:    14/7/94
02075     Inputs:     Rect is the rectangle.
02076     Outputs:    -
02077     Returns:    TRUE if worked, FALSE if failed.
02078     Purpose:    Fills the rectangle with the current fill style.
02079     Errors:     -
02080     Scope:      Public
02081     SeeAlso:    -
02082 
02083 ********************************************************************************************/
02084 
02085 BOOL GDrawAsm::FillRectangle( LPRECT Rect )
02086 {
02087     CriticalSection Ralph;
02088     CamProfile cp(CAMPROFILE_GDRAW);
02089 
02090     return (MakeCurrent() && (XaDraw_FillRectangle(m_pContext, Rect ) ? FALSE : TRUE));
02091 }
02092 
02093 /********************************************************************************************
02094 
02095 >   BOOL GDrawAsm::FillPoint( LPPOINT Point )
02096 
02097     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
02098     Created:    14/7/94
02099     Inputs:     Point is a coord.
02100     Outputs:    -
02101     Returns:    TRUE if worked, FALSE if failed.
02102     Purpose:    Sets one device pixel to the curent fill colour.
02103     Errors:     -
02104     Scope:      Public
02105     SeeAlso:    -
02106 
02107 ********************************************************************************************/
02108 
02109 BOOL GDrawAsm::FillPoint( LPPOINT Point )
02110 {
02111     CriticalSection Ralph;
02112     CamProfile cp(CAMPROFILE_GDRAW);
02113 
02114     return (MakeCurrent() && (XaDraw_FillPoint(m_pContext, Point ) ? FALSE : TRUE));
02115 }
02116 
02117 /********************************************************************************************
02118 
02119 >   INT32 GDrawAsm::StrokePathToPath(
02120         CONST POINT *IPoints,
02121         CONST BYTE  *ITypes,
02122         DWORD ILength,
02123         POINT *OPoints,
02124         BYTE  *OTypes,
02125         DWORD OLength,
02126         BOOL Close,
02127         DWORD LineWidth,
02128         CapStyle LineCaps,
02129         JoinStyle LineJoin,
02130         CONST DashType *Dash)
02131 
02132     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
02133     Created:    14/7/94
02134     Inputs:     A lot. See Gavins docs.
02135     Outputs:    -
02136     Returns:    Length of the resulting path, or -1L if errored (or maybe zero?).
02137     Purpose:    Converts a path into another path by sort-of stroking in toto another data
02138                 structure.
02139     Errors:     -
02140     Scope:      Public
02141     SeeAlso:    -
02142 
02143 ********************************************************************************************/
02144 
02145 INT32 GDrawAsm::StrokePathToPath(
02146         CONST POINT *IPoints,
02147         CONST BYTE  *ITypes,
02148         DWORD ILength,
02149         POINT *OPoints,
02150         BYTE  *OTypes,
02151         DWORD OLength,
02152         BOOL Close,
02153         DWORD LineWidth,
02154         CapStyles LineCaps,
02155         JoinStyles LineJoin,
02156         CONST DashType *Dash)
02157 {
02158     CriticalSection Ralph;
02159     CamProfile cp(CAMPROFILE_GDRAW);
02160 
02161     if (!MakeCurrent()) return -1;
02162     return XaDraw_StrokePathToPath(m_pContext, IPoints, ITypes, ILength, OPoints, OTypes, OLength,
02163                                     FALSE != Close, LineWidth, LineCaps, LineJoin, Dash );
02164 }
02165 
02166 /********************************************************************************************
02167 
02168 >   BOOL GDrawAsm::ClipRectangle( LPRECT Rect )
02169 
02170     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
02171     Created:    14/7/94
02172     Inputs:     A rectangle (in logical coordinates).
02173     Outputs:    -
02174     Returns:    TRUE if worked, FALSE if failed.
02175     Purpose:    Sets clip rectangle of subsequent rendering.
02176     Errors:     -
02177     Scope:      Public
02178     SeeAlso:    -
02179 
02180 ********************************************************************************************/
02181 
02182 BOOL GDrawAsm::ClipRectangle( LPRECT Rect )
02183 {
02184     CriticalSection Ralph;
02185     CamProfile cp(CAMPROFILE_GDRAW);
02186 
02187     return (MakeCurrent() && (XaDraw_ClipRectangle(m_pContext, Rect ) ? FALSE : TRUE));
02188 }
02189 
02190 /********************************************************************************************
02191 
02192 >   void GDrawAsm::ClearChangedBBox()
02193 
02194     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
02195     Created:    25/7/94
02196     Inputs:     -
02197     Outputs:    -
02198     Returns:    -
02199     Purpose:    Resets 'changed' rectangle. Should be called before anything is drawn,
02200                 then drawn areas will be accumulated into the BBox.
02201     Errors:     -
02202     Scope:      Public
02203     SeeAlso:    GetChangedBBox
02204 
02205 ********************************************************************************************/
02206 
02207 void GDrawAsm::ClearChangedBBox()
02208 {
02209     CriticalSection Ralph;
02210     CamProfile cp(CAMPROFILE_GDRAW);
02211 
02212     if (MakeCurrent()) XaDraw_ClearChangedBBox(m_pContext);
02213 }
02214 
02215 /********************************************************************************************
02216 
02217 >   BOOL GDrawAsm::GetChangedBBox( LPRECT Rect )
02218 
02219     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
02220     Created:    25/7/94
02221     Inputs:     -
02222     Outputs:    A rectangle in pixel co-ordinates.
02223     Returns:    TRUE if worked, FALSE if failed.
02224     Purpose:    Gets size of 'changed' rectangle where pixels have been plotted.
02225     Errors:     -
02226     Scope:      Public
02227     SeeAlso:    -
02228 
02229 ********************************************************************************************/
02230 
02231 BOOL GDrawAsm::GetChangedBBox( LPRECT Rect )
02232 {
02233     CriticalSection Ralph;
02234     CamProfile cp(CAMPROFILE_GDRAW);
02235 
02236     return (MakeCurrent() && (XaDraw_GetChangedBBox(m_pContext, Rect ) ? FALSE : TRUE));
02237 }
02238 
02239 /********************************************************************************************
02240 
02241 >   BOOL GDrawAsm::SetChangedBBox( LPRECT Rect )
02242 
02243     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
02244     Created:    27/1/94
02245     Inputs:     A rectangle in pixel co-ordinates.
02246     Outputs:    -
02247     Returns:    TRUE if worked, FALSE if failed.
02248     Purpose:    Sets size of 'changed' rectangle where pixels have been plotted.
02249     Errors:     -
02250     Scope:      Public
02251     SeeAlso:    -
02252 
02253 ********************************************************************************************/
02254 
02255 BOOL GDrawAsm::SetChangedBBox( LPRECT Rect )
02256 {
02257     CriticalSection Ralph;
02258     CamProfile cp(CAMPROFILE_GDRAW);
02259 
02260     return (MakeCurrent() && (XaDraw_SetChangedBBox(m_pContext, Rect ) ? FALSE : TRUE));
02261 }
02262 
02263 COLORREF GDrawAsm::ConvertHSVtoRGB(COLORREF hsv)
02264 {
02265     CriticalSection Ralph;
02266     CamProfile cp(CAMPROFILE_GDRAW);
02267 
02268     MakeCurrent(); // Oooerr, should really not call GDraw if this fails
02269     return XaColour_ConvertHSVtoRGB(hsv );
02270 }
02271 
02272 COLORREF GDrawAsm::ConvertRGBtoHSV(COLORREF rgb)
02273 {
02274     CriticalSection Ralph;
02275     CamProfile cp(CAMPROFILE_GDRAW);
02276 
02277     MakeCurrent(); // Oooerr, should really not call GDraw if this fails
02278     return XaColour_ConvertRGBtoHSV( rgb );
02279 }
02280 
02281 
02282 
02283 
02284 
02285 
02286 BOOL GDrawAsm::SetMiterLimit( DWORD MiterLimit)
02287 {
02288     CriticalSection Ralph;
02289     CamProfile cp(CAMPROFILE_GDRAW);
02290 
02291     return (MakeCurrent() && (XaDraw_SetMiterLimit(m_pContext,MiterLimit) ? FALSE : TRUE));
02292 }
02293 
02294 BOOL GDrawAsm::SetMatrixIntFlag( BOOL Flag)
02295 {
02296     return FALSE;
02297 }
02298 
02299 BOOL GDrawAsm::SetDashAdjustmentFlag( BOOL Flag )
02300 {
02301     CriticalSection Ralph;
02302     CamProfile cp(CAMPROFILE_GDRAW);
02303 
02304     return (MakeCurrent() && (XaDraw_SetDashAdjustmentFlag(m_pContext, FALSE != Flag) ? FALSE : TRUE));
02305 }
02306 
02307 BOOL GDrawAsm::SetInvert( DWORD Colour )
02308 {
02309     CriticalSection Ralph;
02310     CamProfile cp(CAMPROFILE_GDRAW);
02311 
02312     return (MakeCurrent() && (XaColour_SetInvert(m_pContext,Colour) ? FALSE : TRUE));
02313 }
02314 
02315 BOOL GDrawAsm::InitialiseWithPalette( const LOGPALETTE* Palette )
02316 {
02317     CriticalSection Ralph;
02318     CamProfile cp(CAMPROFILE_GDRAW);
02319 
02320     return (MakeCurrent() && (XaColour_InitialiseWithPalette(m_pContext,Palette) ? FALSE : TRUE));
02321 }
02322 
02323 const BYTE* GDrawAsm::ReturnBrush()
02324 {
02325     CriticalSection Ralph;
02326     CamProfile cp(CAMPROFILE_GDRAW);
02327 
02328     if (!MakeCurrent()) return NULL;
02329     return XaColour_ReturnBrush(m_pContext);
02330 }
02331 
02332 const BYTE* GDrawAsm::ReturnBrushRGB()
02333 {
02334     CriticalSection Ralph;
02335     CamProfile cp(CAMPROFILE_GDRAW);
02336 
02337     if (!MakeCurrent()) return NULL;
02338     return XaColour_ReturnBrushRGB(m_pContext);
02339 }
02340 
02341 
02342 /********************************************************************************************
02343 
02344 >   virtual BOOL GDrawAsm::SetSeparationTables( const BGR *CyanSepTable = NULL,
02345                                                 const BGR *MagentaSepTable = NULL,
02346                                                 const BGR *YellowSepTable = NULL,
02347                                                 const BGR *BlackSepTable = NULL,
02348                                                 const BYTE *UnderColourRemovalTable = NULL,
02349                                                 const BYTE *BlackGenerationTable = NULL)
02350     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
02351     Created:    2/5/96
02352 
02353     Inputs:     CyanSepTable, MagentaSepTable, YellowSepTable, BlackSepTable
02354                     These point to separation tables for C,M,Y, and K
02355                     Each table is an array of 256 BGR triples
02356                     Pass in a NULL pointer to use the default (linear) tables
02357 
02358                 UnderColourRemovalTable, BlackGenerationTable
02359                     These point to tables specifying UCR/BG
02360                     Each table is an array of 256 BYTEs
02361                     Pass in a NULL pointer to use the default (linear) tables
02362 
02363     Outputs:    -
02364     Returns:    TRUE if worked, FALSE if failed.
02365 
02366     Purpose:    Sets process colour separation tables to be used in the future by
02367                 various GDraw calls. See the GDraw documentation for details.
02368 
02369     Notes:      IMPORTANT: GDraw does not copy the tables - it retains the pointers
02370                 that you pass in, so it is up to you to deallocate the memory (after
02371                 restoring the separation tables to the defaults of course).
02372 
02373                 Call with all parameters == NULL to restore the defaults.
02374 
02375 ********************************************************************************************/
02376 
02377 BOOL GDrawAsm::SetSeparationTables(const BGR *CyanSepTable,
02378                                     const BGR *MagentaSepTable,
02379                                     const BGR *YellowSepTable,
02380                                     const BGR *BlackSepTable,
02381                                     const BYTE *UnderColourRemovalTable,
02382                                     const BYTE *BlackGenerationTable)
02383 {
02384     CriticalSection Ralph;
02385     CamProfile cp(CAMPROFILE_GDRAW);
02386 
02387     return(MakeCurrent() &&
02388             (XaColour_SetSeparationTables(m_pContext,CyanSepTable, MagentaSepTable,
02389                                          YellowSepTable, BlackSepTable,
02390                                          UnderColourRemovalTable, BlackGenerationTable)
02391             ? FALSE : TRUE));
02392 }
02393 
02394 /********************************************************************************************
02395 
02396 >   virtual BOOL GDrawAsm::SetBitmapConversionTable( const BGR* BitmapConversionTable )
02397 
02398     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
02399     Created:    11/7/96
02400 
02401     Inputs:     Ptr to the conversion table to use.
02402 
02403     Outputs:    -
02404     Returns:    TRUE if worked, FALSE if failed.
02405 
02406     Purpose:    This function will set up the bitmap conversion table for use by the
02407                 following plotting functions:
02408 
02409                     XaColourOld_Set3WayGraduation
02410                     XaColourOld_Set3WayGraduation4
02411                     XaColourOld_Set4WayGraduation
02412                     XaColourOld_Set4WayGraduation4
02413                     XaColourOld_SetGourand
02414                     XaColourOld_SetMultiRadial
02415                     XaColourOld_SetTilePattern
02416                     XaColourOld_SetTilePattern4
02417                     XaSpriteOld_PlotTile
02418                     XaSpriteOld_PlotTile4.
02419 
02420                 This table is used to convert BGR values. It should be a 128K dword table
02421                 indexed by a 17 bit index :
02422                                             bbbbbgggggrrrrr00.
02423 
02424                 Bits must be set in the separation style of the above functions in order to
02425                 make use of this table.
02426 
02427 ********************************************************************************************/
02428 
02429 BOOL GDrawAsm::SetBitmapConversionTable( const BGR* BitmapConversionTable )
02430 {
02431     CriticalSection Ralph;
02432     CamProfile cp(CAMPROFILE_GDRAW);
02433 
02434     return(MakeCurrent() &&
02435             (XaColour_SetBitmapConversionTable(m_pContext,BitmapConversionTable)
02436             ? FALSE : TRUE));
02437 }
02438 
02439 
02440 BOOL GDrawAsm::PlotBitmap( LPBITMAPINFOHEADER bmInfo, LPBYTE lpBytes, DWORD Style, LPPOINT Points,
02441                                     LPRGBQUAD ColourTable,
02442                                     LPBYTE Red, LPBYTE Green, LPBYTE Blue, LPBYTE Trans)
02443 {
02444     CriticalSection Ralph;
02445     CamProfile cp(CAMPROFILE_GDRAW);
02446 
02447     return (MakeCurrent() && (XaBitmap_PlotTile(m_pContext, bmInfo, lpBytes, Style, Points, Points+1, Points+2,
02448                                     (CONST BGRT*)ColourTable, Red, Green, Blue, Trans)
02449                 ? FALSE : TRUE));
02450 }
02451 
02452 BOOL GDrawAsm::PlotPerspectiveBitmap( LPBITMAPINFOHEADER bmInfo, LPBYTE lpBytes, DWORD Style, LPPOINT Points,
02453                                     LPRGBQUAD ColourTable,
02454                                     LPBYTE Red, LPBYTE Green, LPBYTE Blue, LPBYTE Trans)
02455 {
02456     CriticalSection Ralph;
02457     CamProfile cp(CAMPROFILE_GDRAW);
02458 
02459     return (MakeCurrent() && (XaBitmap_PlotTile4(m_pContext, bmInfo, lpBytes, Style, Points, Points+1, Points+2, Points+3,
02460                                     (CONST BGRT*)ColourTable, Red, Green, Blue, Trans)
02461                 ? FALSE : TRUE));
02462 }
02463 
02464 INT32 GDrawAsm::CalcStrokeBBox(
02465         CONST POINT *IPoints,
02466         CONST BYTE  *ITypes,
02467         DWORD ILength,
02468         LPRECT Rect,
02469         BOOL Close,
02470         DWORD LineWidth,
02471         CapStyles LineCaps,
02472         JoinStyles LineJoin,
02473         CONST DashType *Dash)
02474 {
02475     CriticalSection Ralph;
02476     CamProfile cp(CAMPROFILE_GDRAW);
02477 
02478     if (!MakeCurrent()) return -1;
02479     return XaDraw_CalcStrokeBBox(m_pContext, IPoints, ITypes, ILength, Rect,
02480                                     FALSE != Close, LineWidth, LineCaps, LineJoin, Dash );
02481 }
02482 
02483 BOOL GDrawAsm::IsOverlap( LPPOINT Points, const BYTE *Verbs, UINT32 Length, DWORD Winding )
02484 {
02485     CriticalSection Ralph;
02486     CamProfile cp(CAMPROFILE_GDRAW);
02487 
02488     return (MakeCurrent() && (XaDraw_IsOverlap(m_pContext, Points, Verbs, Length, Winding ) ? FALSE : TRUE));
02489 }
02490 
02491 BOOL GDrawAsm::CalcBBox( LPPOINT Points, const BYTE *Verbs, DWORD Length, LPRECT Rect, BOOL Flatten)
02492 {
02493     CriticalSection Ralph;
02494     CamProfile cp(CAMPROFILE_GDRAW);
02495 
02496     return (MakeCurrent() && (XaDraw_CalcBBox(m_pContext, Points, Verbs, Length, Rect, FALSE != Flatten ) ? FALSE: TRUE));
02497 }
02498 
02499 INT32 GDrawAsm::MakeRegion( LPPOINT Points, const BYTE *Verbs, UINT32 Length, DWORD Winding, REGION *ORegion, UINT32 OLength)
02500 {
02501     CriticalSection Ralph;
02502     CamProfile cp(CAMPROFILE_GDRAW);
02503 
02504     if (!MakeCurrent()) return -1;
02505     return XaDraw_MakeRegion(m_pContext, Points, Verbs, Length, Winding, ORegion, OLength );
02506 }
02507 
02508 BOOL GDrawAsm::DeviceClipRectangle( LPRECT Rect)
02509 {
02510     CriticalSection Ralph;
02511     CamProfile cp(CAMPROFILE_GDRAW);
02512 
02513     return (MakeCurrent() && (XaDraw_DeviceClipRectangle(m_pContext, Rect ) ? FALSE: TRUE));
02514 }
02515 
02516 BOOL GDrawAsm::GetDeviceClipRectangle( LPRECT  Rect)
02517 {
02518     CriticalSection Ralph;
02519     CamProfile cp(CAMPROFILE_GDRAW);
02520 
02521     return (MakeCurrent() && (XaDraw_GetDeviceClipRectangle(m_pContext, Rect ) ? FALSE: TRUE));
02522 }
02523 
02524 BOOL GDrawAsm::ClipRegion( const REGION* Region)
02525 {
02526     CriticalSection Ralph;
02527     CamProfile cp(CAMPROFILE_GDRAW);
02528 
02529     return (MakeCurrent() && (XaDraw_ClipRegion(m_pContext, Region ) ? FALSE: TRUE));
02530 }
02531 
02532 CONST REGION* GDrawAsm::GetClipRegion()
02533 {
02534     CriticalSection Ralph;
02535     CamProfile cp(CAMPROFILE_GDRAW);
02536 
02537     return MakeCurrent() ? XaDraw_GetClipRegion(m_pContext) : NULL;
02538 }
02539 
02540 BOOL GDrawAsm::HintPath(
02541         CONST POINT *Points,
02542         CONST BYTE  *Types,
02543         UINT32 Length,
02544         BOOL Close,
02545         DWORD LineWidth)
02546 {
02547 //  return (MakeCurrent() && (XaDraw_HintPath(m_pContext, Points, Types, Length, Close, LineWidth ) ? FALSE: TRUE));
02548     return FALSE;
02549 }
02550 
02551 INT32 GDrawAsm::MakeUnclippedRegion(
02552         CONST POINT *Points,
02553         CONST BYTE  *Types,
02554         UINT32 Length,
02555         DWORD Winding,
02556         REGION *ORegion,
02557         UINT32 OLength)
02558 {
02559     CriticalSection Ralph;
02560     CamProfile cp(CAMPROFILE_GDRAW);
02561 
02562     if (!MakeCurrent()) return -1;
02563     return XaDraw_MakeUnclippedRegion(m_pContext, Points, Types, Length, Winding, ORegion, OLength );
02564 }
02565 
02566 
02567 BOOL GDrawAsm::FillRegion( CONST REGION *Region, CONST POINT *Offset )
02568 {
02569     CriticalSection Ralph;
02570     CamProfile cp(CAMPROFILE_GDRAW);
02571 
02572     return (MakeCurrent() && (XaDraw_FillRegion(m_pContext, Region, Offset ) ? FALSE: TRUE));
02573 }
02574 
02575 INT32 GDrawAsm::SetBevelContrast(UINT32 nContrast)
02576 {
02577     CriticalSection Ralph;
02578     CamProfile cp(CAMPROFILE_GDRAW);
02579 
02580     if (!MakeCurrent())
02581         return -1;
02582 
02583     return XaDraw_SetBevelContrast(m_pContext,nContrast) ? FALSE : TRUE;
02584 }
02585 
02586 INT32 GDrawAsm::SetBevelLightness(UINT32 nContrast)
02587 {
02588     CriticalSection Ralph;
02589     CamProfile cp(CAMPROFILE_GDRAW);
02590 
02591     if (!MakeCurrent())
02592         return -1;
02593 
02594     return XaDraw_SetBevelLightness(m_pContext,nContrast);
02595 }
02596 
02597 INT32 GDrawAsm::SetBevelDarkness(UINT32 nContrast)
02598 {
02599     CriticalSection Ralph;
02600     CamProfile cp(CAMPROFILE_GDRAW);
02601 
02602     if (!MakeCurrent())
02603         return -1;
02604 
02605     return XaDraw_SetBevelDarkness(m_pContext,nContrast);
02606 }
02607 
02608 INT32 GDrawAsm::TranslateBevelValue(BYTE nIndex, BYTE Colour)
02609 {
02610     CriticalSection Ralph;
02611     CamProfile cp(CAMPROFILE_GDRAW);
02612 
02613     if (!MakeCurrent())
02614         return -1;
02615 
02616     return XaDraw_TranslateBevelValue(m_pContext,nIndex, Colour);
02617 }
02618 
02619 BOOL GDrawAsm::Set3WayGraduation(DWORD Style,
02620         COLORREF ColourA, COLORREF ColourB, COLORREF ColourD,
02621         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointD)
02622 {
02623     CriticalSection Ralph;
02624     CamProfile cp(CAMPROFILE_GDRAW);
02625 
02626     return (MakeCurrent() && (
02627             XaColour_Set3WayGraduation(m_pContext,Style, ColourA, ColourB, ColourD, PointA, PointB, PointD)
02628             ? FALSE : TRUE) );
02629 }
02630 
02631 
02632 BOOL GDrawAsm::Set3WayGraduation4(DWORD Style,
02633         COLORREF ColourA, COLORREF ColourB, COLORREF ColourD,
02634         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointC, CONST POINT *PointD)
02635 {
02636     CriticalSection Ralph;
02637     CamProfile cp(CAMPROFILE_GDRAW);
02638 
02639     return (MakeCurrent() && (
02640             XaColour_Set3WayGraduation4(m_pContext,Style, ColourA, ColourB, ColourD, PointA, PointB, PointC, PointD)
02641             ? FALSE : TRUE) );
02642 }
02643 
02644 
02645 BOOL GDrawAsm::Set4WayGraduation(DWORD Style,
02646         COLORREF ColourA, COLORREF ColourB, COLORREF ColourC, COLORREF ColourD,
02647         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointD)
02648 {
02649     CriticalSection Ralph;
02650     CamProfile cp(CAMPROFILE_GDRAW);
02651 
02652     return (MakeCurrent() && (
02653             XaColour_Set4WayGraduation(m_pContext,Style, ColourA, ColourB, ColourC, ColourD, PointA, PointB, PointD)
02654             ? FALSE : TRUE) );
02655 }
02656 
02657 
02658 BOOL GDrawAsm::Set4WayGraduation4(DWORD Style,
02659         COLORREF ColourA, COLORREF ColourB, COLORREF ColourC, COLORREF ColourD,
02660         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointC, CONST POINT *PointD)
02661 {
02662     CriticalSection Ralph;
02663     CamProfile cp(CAMPROFILE_GDRAW);
02664 
02665     return (MakeCurrent() && (
02666             XaColour_Set4WayGraduation4(m_pContext,Style, ColourA, ColourB, ColourC, ColourD, PointA, PointB, PointC, PointD)
02667             ? FALSE : TRUE) );
02668 }
02669 
02670 
02671 BOOL GDrawAsm::SetTransparent3WayGraduation(DWORD Style,
02672         BYTE ValueA, BYTE ValueB, BYTE ValueD,
02673         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointD)
02674 {
02675     CriticalSection Ralph;
02676     CamProfile cp(CAMPROFILE_GDRAW);
02677 
02678     return (MakeCurrent() && (
02679             XaColour_SetTransparent3WayGraduation(m_pContext,Style, ValueA, ValueB, ValueD, PointA, PointB, PointD)
02680             ? FALSE : TRUE) );
02681 }
02682 
02683 
02684 BOOL GDrawAsm::SetTransparent3WayGraduation4(DWORD Style,
02685         BYTE ValueA, BYTE ValueB, BYTE ValueD,
02686         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointC, CONST POINT *PointD)
02687 {
02688     CriticalSection Ralph;
02689     CamProfile cp(CAMPROFILE_GDRAW);
02690 
02691     return (MakeCurrent() && (
02692             XaColour_SetTransparent3WayGraduation4(m_pContext,Style, ValueA, ValueB, ValueD, PointA, PointB, PointC, PointD)
02693             ? FALSE : TRUE) );
02694 }
02695 
02696 
02697 BOOL GDrawAsm::SetTransparent4WayGraduation(DWORD Style,
02698         BYTE ValueA, BYTE ValueB, BYTE ValueC, BYTE ValueD,
02699         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointD)
02700 {
02701     CriticalSection Ralph;
02702     CamProfile cp(CAMPROFILE_GDRAW);
02703 
02704     return (MakeCurrent() && (
02705             XaColour_SetTransparent4WayGraduation(m_pContext,Style, ValueA, ValueB, ValueC, ValueD, PointA, PointB, PointD)
02706             ? FALSE : TRUE) );
02707 }
02708 
02709 
02710 BOOL GDrawAsm::SetTransparent4WayGraduation4(DWORD Style,
02711         BYTE ValueA, BYTE ValueB, BYTE ValueC, BYTE ValueD,
02712         CONST POINT *PointA, CONST POINT *PointB, CONST POINT *PointC, CONST POINT *PointD)
02713 {
02714     CriticalSection Ralph;
02715     CamProfile cp(CAMPROFILE_GDRAW);
02716 
02717     return (MakeCurrent() && (
02718             XaColour_SetTransparent4WayGraduation4(m_pContext,Style, ValueA, ValueB, ValueC, ValueD, PointA, PointB, PointC, PointD)
02719             ? FALSE : TRUE) );
02720 }

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