Board index » cppbuilder » Customized palette

Customized palette

Hi,

Does anybody now how to define or create a personnal palette. I would like
to draw  16 coulours images with 16 levels of green or blue.
I dont find the CreatePalette in the online help and the palette property
is not widely descrived.
Thanks for any idea.

PS: excuses for my poor english

 

Re:Customized palette


I just got help myself with palette's (Thanks to Wenderson Teixeira).

This code I got from Win32 API Superbible

LPLOGPALETTE pLogPal;
#define NUMBERCOLORS 16

pLogPal = (LPLOGPALETTE)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,sizeof(LOGPALETTE)+(NUMBERCOLORS*sizeof(PALET{*word*249}TRY)));
  pLogPal->palVersion = 0x300;
  pLogPal->palNumEntries = NUMBERCOLORS;

  int i;
  // Create 15 shapes of grey
  for(i=0; i<NUMBERCOLORS-1;i++){
    pLogPal->palPalEntry[i].peRed = 255-(i*15);
    pLogPal->palPalEntry[i].peGreen = 255-(i*15);
    pLogPal->palPalEntry[i].peBlue = 255-(i*15);
    pLogPal->palPalEntry[i].peFlags = PC_RESERVED;
  }

  // Make the last color black
  pLogPal->palPalEntry[i].peRed = 0;
  pLogPal->palPalEntry[i].peGreen = 0;
  pLogPal->palPalEntry[i].peBlue = 0;
  pLogPal->palPalEntry[i].peFlags = PC_RESERVED;

  HPALETTE hPal = CreatePalette(pLogPal);

  // Use the palette

  Remember to call
  HeapFree(GetProcessHeap(),0,pLogPal);
  DeleteObject(hPal);
  when you are done with them

Hope this helps
Kaj Christensen

rhea skrev i meddelandet <01bdb58c$d550e7a0$0400a8c0@shiva>...

Quote
>Hi,

>Does anybody now how to define or create a personnal palette. I would like
>to draw  16 coulours images with 16 levels of green or blue.
>I dont find the CreatePalette in the online help and the palette property
>is not widely descrived.
>Thanks for any idea.

>PS: excuses for my poor english

Re:Customized palette


Quote
> I dont find the CreatePalette in the online help and the palette property
> is not widely descrived.

In the directory \BORLAND\SHARED\MSHELP, you'll find all the Win32 .hlp
files from Microsoft.  You can use the Help|Customize menu selection to
add it to your normal help contents search, although it does tend to add
a lot of noise.  The particular help file you want is call Win32.hlp.
But you should download the help file patch found at:

http://www.inprise.com/techpubs/bcppbuilder/

dated 4/11/97, as BCB3 unfortunately shipped with the same broken win32.hlp
file that BCB1 did.  You can get it directly here:

ftp://ftp.inprise.com/pub/bcppbuilder/techpubs/bcbhlp01.zip

+===================================================+
| Jonathan Arnold (mailto:jdarn...@buddydog.org)    |
| Senior Engineer           Roger Wagner Publishing |
| http://people.ne.mediaone.net/jdarnold            |
+===================================================+

"There is no psychiatrist in the world like a puppy{*word*180}ing your
 face." -- Ben Williams

Other Threads