Search for the closest color match, or allocate a new one.
Source position: agraphics.pas line 2436
function ObtainBestPenA( |
Cm: PColorMap; |
R: LongWord; |
G: LongWord; |
B: LongWord; |
const Tags: PTagItem |
):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) |
Tags |
|
a pointer to a standard tag list specifying the color matching settings desired: OBP_Precision, OBP_FailIfBad |
The correct pen value, or -1 if no sharable palette entries are available.
This function can be used by applications to figure out what pen to use to represent a given color.
The system will attempt to find the color in your viewport closest to the specified color. If there is no color within your tolerance, then a new one will be allocated, if available. If none is available, then the closest one found will be returned.
If this call succceeds, then you must call ReleasePen() when you are done with the color.
The error metric used for ObtainBestPen() is based on the magnitude squared between the two RGB values, scaled by the percentage of free entries.
|
VarArgs Version of ObtainBestPenA() |
|
|
Allocate and initialize Colormap |
|
|
Obtain a free palette entry for use by your program. |
|
|
Release an allocated palette entry to the free pool. |