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

FindColor

Find the closest matching color in a colormap.

Declaration

Source position: agraphics.pas line 2142

function FindColor(

  Cm: PColorMap;

  R: LongWord;

  G: LongWord;

  B: LongWord;

  MaxColor: LongInt

):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)

Description

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:

  1. programs which pop up on public screens when those screens are not using palette sharing. You might use this function as a fallback when ObtainBestPenA() says that there are no sharable pens.
  2. Internal color matching by an application which is either running on a non-public screen, or which wants to match colors to an internal color table which may not be associated with any displayed screen.

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.

See also

ObtainBestPenA

  

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

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