Find the closest matching color in a colormap.
Source position: agraphics.pas line 2142
function FindColor( |
Cm: PColorMap; |
R: LongWord; |
G: LongWord; |
B: LongWord; |
MaxColor: LongInt |
):LongInt; |
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) |
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. |