Board index » cppbuilder » Colors?

Colors?

How can I tell how many colors the user is using? (256 etc.)
Please help! many thanks!
 

Re:Colors?


Quote
Chad Jones wrote in message <380CFB5C.773E5...@mail.usask.ca>...
>How can I tell how many colors the user is using? (256 etc.)
>Please help! many thanks!

This should give u info HOW many bits is used 4 pixel...

    HDC HandleDC;

    HandleDC = GetDC(0);
    Bpl  = (GetDeviceCaps(HandleDC, BITSPIXEL) * GetDeviceCaps(HandleDC,
PLANES));
    ReleaseDC(0, HandleDC);

but many ppl use 32-bit mode that give 24bit col, so colors u should get by
this...

    if (Bpl > 24) Bpl = 24;
    Form1->Caption = 1 << Bpl;

I hope i remebered that stuff ABOUT right...
haven't been using it in AEONS ;)

Re:Colors?


Quote
coderaper wrote in message <7uj21p$s...@forums.borland.com>...
>Chad Jones wrote in message <380CFB5C.773E5...@mail.usask.ca>...
>>How can I tell how many colors the user is using? (256 etc.)
>>Please help! many thanks!

>This should give u info HOW many bits is used 4 pixel...

     Int Bpl;  //   OOPS forgot this from here...
Quote
>    HDC HandleDC;

>    HandleDC = GetDC(0);
>    Bpl  = (GetDeviceCaps(HandleDC, BITSPIXEL) * GetDeviceCaps(HandleDC,
>PLANES));
>    ReleaseDC(0, HandleDC);

>but many ppl use 32-bit mode that give 24bit col, so colors u should get by
>this...

>    if (Bpl > 24) Bpl = 24;
>    Form1->Caption = 1 << Bpl;

>I hope i remebered that stuff ABOUT right...
>haven't been using it in AEONS ;)

Re:Colors?


If you use TBitmap or TImage, just look for PixelFormat property.

eg

TBitmap->PixelFormat = pf1bit, pf2bit, pf8bit, pf16, pf24 ...

Regards...

--
Frank Markus Schanzenb?cher
Programmer & Designer 4
visual and audial medias
Germany @  Individual Software GmbH
Mailto:Frank_Mar...@inso-gmbh.de

Check: http://signpro.iscool.net   for a Win32/CBuilder !Open Source!
Project

Chad Jones schrieb in Nachricht <380CFB5C.773E5...@mail.usask.ca>...

Quote
>How can I tell how many colors the user is using? (256 etc.)
>Please help! many thanks!

Other Threads