Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS Vector C++ Class Library Help

LVectorBase::GetPalette

Show in webframe

#include "ltwrappr.h"

virtual HPALETTE LVectorBase::GetPalette(L_VOID)

Returns the palette associated with the specified vector handle.

Returns

Returns the handle to the logical palette

Comments

You can use this palette to allow proper drawing of vector image colors in a palletized system.

Required DLLs and Libraries

LVKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LVectorBase::SetPalette, LVectorBase::Paint

Topics:

Vector Images: Getting and Setting General Information

Example

L_INT LVectorBase__GetPaletteExample(HWND hWnd, LVectorBase &Vector)
{
   L_INT       nRet;
   HDC         hdc;
   PAINTSTRUCT ps;
   RECT        rect;
   HPALETTE    hOldPalette = NULL, hPal;
   hdc = BeginPaint (hWnd, &ps) ;
   GetClientRect(hWnd, &rect);
   nRet = Vector.SetViewport(&rect);
   if(nRet != SUCCESS)
      return nRet;
   if (Vector.IsAllocated())
   {
      // Create the palette that we will use to paint 
      hPal = Vector.GetPalette();
      if( hPal )
      {
         hOldPalette = ::SelectPalette( hdc, hPal, TRUE );
         ::RealizePalette( hdc );
      }
      nRet = Vector.Paint(hdc, TRUE);
      if(nRet != SUCCESS)
         return nRet;
      if (hOldPalette)
      {
         ::SelectPalette (hdc, hOldPalette, FALSE);
         DeleteObject(hPal);
      }
   }
   EndPaint (hWnd, &ps) ;
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.