Unit 'agraphics' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#aros]

ObtainBestPenA

Search for the closest color match, or allocate a new one.

Declaration

Source position: agraphics.pas line 2177

function ObtainBestPenA(

  Cm: PColorMap;

  r: LongWord;

  g: LongWord;

  b: LongWord;

  Tags: PTagItem

):LongInt;

Arguments

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

Function result

The correct pen value, or -1 if no sharable palette entries are available.

Description

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.

See also

ObtainBestPen

  

VarArgs Version of ObtainBestPenA()

GetColorMap

  

Allocate and initialize Colormap

ObtainPen

  

Obtain a free palette entry for use by your program.

ReleasePen

  

Release an allocated palette entry to the free pool.


Documentation generated on: 2021-07-30