Find the closest matching color in a colormap.
Source position: agraphics.pas line 2202
function FindColor( |
Cm: PColorMap; |
r: LongWord; |
g: LongWord; |
b: LongWord; |
MaxPen: LongWord |
):LongWord; |
Cm |
|
Colormap |
r |
|
red level (32 bit left justified fraction) |
g |
|
green level (32 bit left justified fraction) |
b |
|
blue level (32 bit left justified fraction) |
MaxPen |
|
The maximum entry in the color table to search. A value of -1 will limt the search to only those pens which could be rendered in (for instance, it will not examine the sprite colors on a 4 color screen). |
The system will attempt to find the color in the passed colormap which most closely matches the RGB values passed. No new pens will be allocated, and you should not ReleasePen() the returned pen. This function is not sensitive to palette sharing issues. Its intended use is for:
In order to use the MaxPen=-1 feature, you must have initialized palette sharing via AttachPalExtra() (all intuition screens do this). Otherwise, MaxPen=-1 will search all colors in the colormap.
|
Search for the closest color match, or allocate a new one. |
|
|
Allocate and initialize Colormap |
|
|
Obtain a free palette entry for use by your program. |
|
|
Release an allocated palette entry to the free pool. |