a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
Autodocs
 Libraries:
 graphics.library
  AddAnimOb
  AddBob
  AddFont
  AddVSprite
  AllocBitMap
  AllocDBufInfo
  AllocRaster
  AllocSpriteDataA
  AndRectRegion
  AndRegionRegion
  Animate
  AreaCircle
  AreaDraw
  AreaEllipse
  AreaEnd
  AreaMove
  AskFont
  AskSoftStyle
  AttachPalExtra
  AttemptLockLayerRom
  BestModeIDA
  BitMapScale
  BltBitMap
  BltBitMapRastPort
  BltClear
  BltMaskBitMapRastPort
  BltPattern
  BltTemplate
  CBump
  CEND
  CINIT
  CMOVE
  CWAIT
  CalcIVG
  ChangeExtSpriteA
  ChangeSprite
  ChangeVPBitMap
  ClearEOL
  ClearRectRegion
  ClearRegion
  ClearScreen
  ClipBlit
  CloseFont
  CloseMonitor
  CoerceMode
  CopySBitMap
  DisownBlitter
  DisposeRegion
  DoCollision
  Draw
  DrawEllipse
  DrawGList
  EraseRect
  ExtendFont
  FindColor
  FindDisplayInfo
  Flood
  FontExtent
  FreeBitMap
  FreeColorMap
  FreeCopList
  FreeCprList
  FreeDBufInfo
  FreeGBuffers
  FreeRaster
  FreeSprite
  FreeSpriteData
  FreeVPortCopLists
  GetAPen
  GetBPen
  GetBitMapAttr
  GetColorMap
  GetDisplayInfoData
  GetDrMd
  GetExtSpriteA
  GetGBuffers
  GetOPen
  GetRGB32
  GetRGB4
  GetRPAttrA
  GetSprite
  GetVPModeID
  GfxAssociate
  GfxFree
  GfxLookUp
  GfxNew
  InitArea
  InitBitMap
  InitGMasks
  InitGels
  InitMasks
  InitRastPort
  InitTmpRas
  InitVPort
  InitView
  LoadRGB32
  LoadRGB4
  LoadView
  LockLayerRom
  MakeVPort
  ModeNotAvailable
  Move
  MoveSprite
  MrgCop
  NewRegion
  NextDisplayInfo
  ObtainBestPenA
  ObtainPen
  OpenFont
  OpenMonitor
  OrRectRegion
  OrRegionRegion
  OwnBlitter
  PolyDraw
  QBSBlit
  QBlit
  ReadPixel
  ReadPixelArray8
  ReadPixelLine8
  RectFill
  ReleasePen
  RemBob
  RemFont
  RemIBob
  RemVSprite
  ScalerDiv
  ScrollRaster
  ScrollRasterBF
  ScrollVPort
  SetABPenDrMd
  SetAPen
  SetBPen
  SetChipRev
  SetCollision
  SetDrMd
  SetFont
  SetMaxPen
  SetOPen
  SetOutlinePen
  SetRGB32
  SetRGB32CM
  SetRGB4
  SetRGB4CM
  SetRPAttrA
  SetRast
  SetSoftStyle
  SetWriteMask
  SortGList
  StripFont
  SyncSBitMap
  Text
  TextExtent
  TextFit
  TextLength
  UnlockLayerRom
  VBeamPos
  VideoControl
  WaitBOVP
  WaitBlit
  WaitTOF
  WriteChunkyPixels
  WritePixel
  WritePixelArray8
  WritePixelLine8
  XorRectRegion
  XorRegionRegion
Include
GuruMeditation
Docs » Autodocs » graphics.library » ObtainBestPenA

NAME

	ObtainBestPenA --- Search for the closest color match, or allocate a
new one. (V39)
ObtainBestPen --- varargs stub for ObtainBestPenA

SYNOPSIS

	color | -1 =ObtainBestPenA(  cm,  R,   G,    B,    taglist)
a0 d1 d2 d3 a1
LONG ObtainBestPenA( struct ColorMap *, ULONG, ULONG,
ULONG, struct TagItem *);
color = ObtainBestPen(cm,r,g,b,tags....);

INPUTS

	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)
taglist = a pointer to a standard tag list specifying the color
matching settings desired:
OBP_Precision - specifies the desired precision for the
match. Should be PRECISION_GUI, PRECISION_ICON, or
PRECISION_IMAGE or PRECISION_EXACT.
Defaults to PRECISION_IMAGE.
OBP_FailIfBad - specifies that you want ObtainBestPen to return
a failure value if there is not a color within the
given tolerance, instead of returning the closest color.
With OBP_FailIfBad==FALSE, ObtainBestPen will only fail
if the ViewPort contains no sharable colors.
Defaults to FALSE.

FUNCTION

	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.

RESULT

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

BUGS

NOTES

	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

GetColorMap(), ObtainPen(), ReleasePen()

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Defjam

FC
PDX
DJ
AOA

Comments:

$VER: d0.se 1.14 Copyright © 2011-2024 Tobias Geijersson support at d0 dot se