The CGM Device

Device Keywords Accepted by the CGM Device


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:


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:

SET_PLOT, 'CGM' ; Select the CGM driver.

X = DIST(64) ; Create a 64 x 64 element array

TVSCL, X ; Display the image (fills entire screen)

ERASE ; Now display 4 images on the screen.

XS = !D.X_SIZE / 2 ; Size of each image, X dimension.

YS = !D.Y_SIZE / 2 ; Size of each image, Y dimension.

TVSCL, X, 0, XSIZE=XS, YSIZE=YS ; Upper left.

TVSCL, X, 1, XSIZE=XS, YSIZE=YS ; Upper right.

TVSCL, X, 2, XSIZE=XS, YSIZE=YS ; Lower left.

TVSCL, X, 3, XSIZE=XS, YSIZE=YS ; Lower right.