Available in LEADTOOLS Vector Imaging toolkits. |
L_VecSetPalette
#include "lvkrn.h"
L_LVKRN_API L_INT L_VecSetPalette(pVector, hPalette)
pVECTORHANDLE pVector; |
/* pointer to a vector handle */ |
L_HPALETTE hPalette; |
/* handle to a palette */ |
Sets the palette handle associated with the specified vector.
Parameter |
Description |
pVector |
Pointer to the vector handle. |
hPalette |
Handle to the new palette to set. |
Returns
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
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: |
Example
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; }