L_VecSetPalette

#include "ltvkrn.h"

L_LTVKRN_API L_INT L_VecSetPalette(pVector, hPalette)

Sets the palette handle associated with the specified vector.

Parameters

pVECTORHANDLE pVector

Pointer to the vector handle.

L_HPALETTE hPalette

Handle to the new palette to set.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function makes a copy of hPalette, so you can delete the object if you don't need it anymore.

Required DLLs and Libraries

See Also

Functions

Example

L_LTVKRNTEX_API L_INT VecSetPaletteExample( 
   pVECTORHANDLE pVector, 
   COLORREF* pColors, 
   L_UINT16 uClrCount) 
{ 
   L_INT          nRet; 
   L_UINT16       i; 
   HPALETTE       hPalette; 
   LPLOGPALETTE   pLogPalette; 
 
   if( uClrCount > 0 ) 
   { 
      pLogPalette = (LPLOGPALETTE) malloc( sizeof( LOGPALETTE ) + sizeof( PALETTEENTRY ) * ( uClrCount - 1 ) ); 
      if( NULL == pLogPalette  ) 
         return ERROR_NO_MEMORY; 
 
      pLogPalette->palVersion    = 0x300; 
      pLogPalette->palNumEntries = uClrCount; 
      for( i = 0 ; i < pLogPalette->palNumEntries ; i++ ) 
      { 
         pLogPalette->palPalEntry[ i ].peRed   = GetRValue( pColors[ i ] ); 
         pLogPalette->palPalEntry[ i ].peGreen = GetGValue( pColors[ i ] ); 
         pLogPalette->palPalEntry[ i ].peBlue  = GetBValue( pColors[ i ] );  
         pLogPalette->palPalEntry[ i ].peFlags = 0; 
      } 
 
      hPalette = CreatePalette( pLogPalette ); 
      free( pLogPalette ); 
      if( NULL != hPalette ) 
      { 
         nRet = L_VecSetPalette( pVector, hPalette ); 
         DeleteObject( hPalette ); 
      } 
      else 
         nRet = FAILURE; 
   } 
   else 
      nRet = L_VecSetPalette( pVector, NULL ); 
 
   return nRet; 
} 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Vector C API Help