Device Keywords Accepted by the CGM Device
BINARY
,
CLOSE_FILE
,
COLORS
,
ENCODING
,
FILENAME
,
NCAR
,
SET_CHARACTER_SIZE
,
TEXT
The CGM,
Computer Graphics Metafile, standard describes a device independent file format used for the exchange of graphic information. The IDL CGM driver produces CGM files encoded in one of three methods:
Text
,
Binary
or
NCAR
Binary
. To direct graphics output to a CGM file, issue the command:
SET_PLOT,'CGM'
This causes IDL to use the CGM driver for producing graphical output. Once the CGM driver is selected, the DEVICE procedure controls its actions, as described below. Typing
HELP, /DEVICE
displays the current state of the CGM driver. The CGM driver defaults to the binary encoding using 256 colors.
Abilities and Limitations
This section describes details specific to IDL's CGM implementation:
-
IDL uses the CGM default integer encoding for graphic primitives. Coordinate values range from 0 to 32767. It is advisable to use the values stored in !D.X_SIZE and !D.Y_SIZE instead of assuming a fixed coordinate range.
-
Color information is output with a resolution of 8 bits (color indices and intensity values range from 0 to 255).
-
The definition of background color in the CGM standard is somewhat ambiguous. According to the standard, color index 0 and the background color are the same. Because background color is specified in the metafile as a color value (RGB triple), not an index, it is possible to have the background color not correspond with the color value of index 0.
-
The CGM BACKGROUND_COLOUR attribute is explicitly set by IDL only during an erase operation: changing the value of the color map at index 0 does not cause IDL to generate a BACKGROUND_COLOUR attribute until the next ERASE occurs. An ERASE command sets the background color to the value in the color map at index 0. The command
ERASE, INDEX
(where INDEX is not 0) generates the message "
Value of background color is out of allowed range.
" For consistent results, modify the color table before any graphics are output.
-
The CGM standard uses
scalable (variable size) pixels for raster images. By default, the TV and TVSCL procedures output images, regardless of size, using the entire graphics output area. To output an image smaller than the graphics output area, specify the XSIZE and YSIZE keywords with the TV and TVSCL procedures. For example:
SET_PLOT, 'CGM'
X = DIST(64)
TVSCL, X
ERASE
XS = !D.X_SIZE / 2
YS = !D.Y_SIZE / 2
TVSCL, X, 0, XSIZE=XS, YSIZE=YS
TVSCL, X, 1, XSIZE=XS, YSIZE=YS
TVSCL, X, 2, XSIZE=XS, YSIZE=YS
TVSCL, X, 3, XSIZE=XS, YSIZE=YS