Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / Using IDL / Color and Destination Objects

IDL

Color and Destination Objects

Color and Destination Objects

Each destination object has one of the two color models associated with it (an Indexed Color Model, and the RGB Color Model), shown in the following table.Once a destination object has been created, you cannot change the associated color model. You can, however, create destination objects that use different color models in the same IDL session. That is, it is possible to have two window objects—one using the Indexed color model and one using the RGB color model—on your computer screen at the same time.

Color Model

Keyword Value

INDEXED

COLOR_MODEL=1

See Indexed Color Model in Object Graphics.

RGB

COLOR_MODEL=0 (default)

See RGB Color Model in Object Graphics

You can specify the color of any graphic object using either a color index or an RGB value, regardless of the color model used by the destination object or the physical destination device. The main distinction between the two color models lies in how IDL manages the color lookup table (if any) of the physical destination device. See How IDL Interprets Color Values for details.

A Note about Draw Widgets


Drawable areas created with the WIDGET_DRAW function deserve a special mention. When a draw widget is created with the GRAPHICS_LEVEL keyword set equal to 2, the widget contains an instance of an IDLgrWindow object rather than an IDL Direct Graphics drawable window. By default, the window object uses the RGB color model; to use the indexed color model, set the COLOR_MODEL keyword to WIDGET_DRAW equal to 1 (one).

Indexed Color Model in Object Graphics


In the Indexed color model, you have control over how colors are loaded into a color lookup table. If the Indexed Color Model is used, a color value (or individual image pixel) is expected to be an index into the palette associated with the destination object. To load a particular color table, create a palette object, then set it as a property of the destination object in which the graphics are to be drawn (using the PALETTE keyword in the SetProperty method of the destination object). If a palette is not explicitly provided for a given destination object, a gray scale ramp is loaded by default.

When the contents of your destination object are rendered on the physical device (that is, when you call the Draw method for the destination object), the RGB values from the palette are either:

  • passed directly through to the physical device (if it uses RGB values), or
  • loaded into the physical device’s lookup table (if it uses Indexed values).

Specify that a destination object should use the Indexed color model by setting the COLOR_MODEL property of the object equal to 1 (one):

myWindow = OBJ_NEW('IDLgrWindow', COLOR_MODEL = 1)

Specify a palette object by setting the PALETTE property equal to a palette object:

myWindow->SetProperty, PALETTE=myPalette

When you assign a color index to a visualization object that is drawn on the destination device, the color index is used to look up an RGB value in the specified palette. When you assign an RGB value to an object that is drawn on the destination device, the nearest match within the destination object’s palette is found and used to represent that color.

See How IDL Interprets Color Values for information on how a color assignment to a visualization object is interpreted by a destination object using either an RGB or Indexed color mode.

RGB Color Model in Object Graphics


In the RGB color model, IDL takes responsibility for filling the color lookup table on the destination device (if necessary). When the contents of your destination object are rendered on the physical device (that is, when you call the Draw method for the destination object), the RGB values are either:

  • passed directly through to the physical device (if it uses RGB values), or
  • matched as nearly as possible with colors loaded in the physical device’s lookup table (if it uses Indexed values).

Specify that a destination object should use the RGB color model by setting the COLOR_MODEL property of the object equal to 0 (zero). This is the default color model value for newly created destination objects.

myWindow = OBJ_NEW('IDLgrWindow', COLOR_MODEL = 0)



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us