|
-
December 17th, 1999, 07:50 AM
#1
Using palettes
I am programming an application that needs a palette filled with shades of red.
I have tried the following lines of code :
For i = 0 To 255
Pal.palPalEntry(i).peRed = i
Pal.palPalEntry(i).peGreen = 0
Pal.palPalEntry(i).peBlue = 0
Pal.palPalEntry(i).peFlags = 0
Next i
hPal = CreatePalette(Pal)
hHoldPrevPal = SelectPalette(Form1.hdc, hPal, True)
RealizePalette (Form1.hdc)
RealizePalette has returned a value of 249.
While trying all shades of red, from RGB(0,0,0) to RGB(255,0,0) , I could get only 4 distinct shades of red,
with all the others dithered.
Thanks for any help,
Gino.
-
December 17th, 1999, 04:17 PM
#2
Re: Using palettes
That is correct.
You should use SelectPalette(Form1.hdc, hPal, False) to set the palette as foreground palette. Only foreground palette can force other colors out of system palette.
With foreground palette, you may get 236+3 levels of red shade.
A C/C++ programmer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|