NCL Website header
NCL Home > Documentation > HLUs > API

NhlNewColor

The Fortran name of this function is NhlFNewColor.

This function adds a color specified as an RGB triple to the colormap of a Workstation instance and returns its HLU color index.


C Synopsis

#include <ncarg/hlu/hlu.h>
#include <hfile for Workstation class object>

int NhlNewColor(
	        int	workid,
		float	red,
		float	green,
		float	blue
		)

Fortran Synopsis

      subroutine NhlFNewColor(workid, red, green, blue, indx)
      integer workid, indx
      real red, green, blue

Arguments

workid (input)
Integer identifier of an instance of a Workstation class object
red (input)
Value of the red component of the desired color in the range 0.0 to 1.0 inclusive.
green (input)
Value of the green component of the desired color in the range 0.0 to 1.0 inclusive.
blue (input)
Value of the blue component of the desired color in the range 0.0 to 1.0 inclusive.
indx (output, Fortran only)
The HLU color index of a newly allocated color with the specified RGB values.

Types

Type name:		NhlTErrorTypes
Definition:
typedef enum _NhlErrType{
	NhlFATAL	= -4,	/* "FATAL"	*/
	NhlWARNING	= -3,	/* "WARNING"	*/
	NhlINFO		= -2,	/* "INFO"	*/
	NhlNOERROR	= -1	/* "NOERROR"	*/
} NhlErrorTypes;

Description

This function is used to add a new color to a Workstation object's colormap. NhlNewColor returns a an HLU color index of its own choosing from among those currently unallocated by the Workstation object. To set a specific HLU color index you must use the function NhlSetColor. If the Workstation colormap is full an error message is generated, and the negative return value may be cast to the type NhlErrorTypes.


Return Values

If greater than or equal to 0, the integer return value of NhlNewColor is the HLU color index of a newly allocated color with RGB values as specified by the function parameters. The Fortran routine, NhlFNewColor, returns this value in indx. If the return value is less than 0, you may cast the value to the type NhlErrorTypes, to determine the error status, as follows:
Value	|			Meaning
--------+-------------------------------------------------
NOERROR	|	function successful
--------+-------------------------------------------------
INFO	|	minor recoverable error
--------+-------------------------------------------------
WARNING	|	recoverable error
--------+-------------------------------------------------
FATAL	|	function failed; continuing the program
	|       may result in core dump


See Also