>  Docs Center  >  Libraries  >  JHU/APL/S1R  >  TARCLR






      Find closest match to target color in current color table.


Calling Sequence

      in = tarclr(tclr)


      tclr = target color. Flexible format see notes. in

Keyword Parameters


        SET=i Set color index i (if given) to specified color.
          Ignored if in high color mode (> 256) except to
          set the color table if it is given. Reserves color.
        /NOLOAD means use SET=i for color table only, not screen.
        /HSV Target colors is given in HSV instead of RGB.
          Hue 0-360, Saturation 0-1 float, Value 0-1 float.
          Same input options as for RGB.
        RED=red, GREEN=green, BLUE=blue change values in these
          given color tables also if SET=i is used.
          If given use to find target color if SET not given.
        To allow color sharing tarclr allows colors to be reserved.
        INIT=[lo,hi] Set a range of working colors. /INIT for all.
        /ADD means add target color to available space and reserve.
        DROP=i or DROP=[lo,hi] Return reserved colors.
        /LIST gives info on available colors.
        /B24 means force 24 bit color mode (good for testing).
        /C24 Always return 24 bit color.
          /B24 will not work for decomp=0 color mode.


      in = index in current color table of closest match. out

Common Blocks



      Notes: input target color may be given in one of many ways.
      It may be given in a single argument or in 3 arguments. The
      required order in either case is Red, Green, and Blue and
      the target values of each are assumed to be in the range
      0-255 (unless /HSV). Some example single arg entries:
      '100 120 255', '80,20,0', ['200','200','0'], [0,50,100]'
      A single string argument may also contain /HSV.
      The 3 values may also be given in 3 args.
      A special case single arg entry may be in hex such as:
      '#ffaa77' to match WWW format.'
      If using high color (more than 8 bits) then the actual
      color values is returned for use with the COLOR keyword.
      SET=i can be used to construct a color table.
        The inverse routine is c2rgb.

Modification History

      R. Sterner, 1996 Oct 30
      R. Sterner, 1997 Dec 3 --- Upgraded for high color use.
      R. Sterner, 1999 Jul 28 --- Added /HSV keyword.
      R. Sterner, 1999 Jul 29 --- Added RED,GREEN,BLUE,/NOLOAD.
      R. Sterner, 1999 Oct 12 --- Handled cases for 1 or 2 values.
      R. Sterner, 1999 Nov 11 --- Added reserved color items.
      R. Sterner, 1999 Nov 24 --- Added forced 24 bit mode.
      R. Sterner, 2000 Sep 20 --- Treats decomp=0 as 8-bit color.
      R. Sterner, 2002 Jun 25 --- Mentioned inverse. Allow /hsv in string.
      R. Sterner, 2006 Jul 26 --- Handled Z buffer.
      R. Sterner, 2007 Jun 08 --- Handled 1 arg case better.
      R. Sterner, 2007 Sep 20 --- Added C24 = always 24 bit color.
      R. Sterner, 2007 Nov 27 --- Allowed 24-bit Z-buffer.
      R. Sterner, 2010 May 04 --- Converted arrays from () to [].
  Copyright (C) 1996, Johns Hopkins University/Applied Physics Laboratory
  This software may be used, copied, or redistributed as long as it is not
  sold and this copyright notice is reproduced on each copy made. This
  routine is provided as is without any express or implied warranties
  whatsoever. Other limitations apply as described in the file disclaimer.txt.

© 2020 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us