Pixel Map Output
The Pixel Map buffer allows you to create PV‑WAVE graphical output in memory. This output buffer is useful for creating images using batch mode methods or background processes.
To direct graphics output to the PM buffer, enter the command:
SET_PLOT, 'PM'
This causes PV-WAVE to use the PM buffer driver for producing graphical output. Once the PM buffer driver is enabled via SET_PLOT, the DEVICE procedure is used to control its actions, as described in
"Controlling PM buffer Output with DEVICE Keywords".
Use INFO, /Device to view the driver’s current settings.
Controlling PM buffer Output with DEVICE Keywords
The following keywords to the DEVICE procedure provide control of the PM buffer driver:
Close—Deallocates the memory used by the buffers. The PM buffer device is reinitialized if subsequent graphics operations are directed to the device.
Get_Graphics_Function—See the description of the
Get_Graphics_Function keyword in
"X Window System".
Get_Write_Mask—See the description of the
Get_Write_Mask keyword in
"X Window System".
Set_Character_Size—A two-element vector that changes the standard width of the vector-drawn fonts and the space allocated above the line of text. The first element in the vector contains the new character width, and the second element contains the number of pixels above the line of text. By default, characters are approximately 8-pixels wide, with 12 pixels between lines.
Set_Colors—Sets the number of pixel values, !D.N_Colors. This value is used by a number of routines to determine the scaling of pixel data and the default drawing index. Allowable values range from 2 to 256, and the default value is 256. Use this parameter to make the PM buffer device compatible with devices with fewer than 256 color indices. The number of colors can be changed at any time without affecting any accumulated graphics present in the buffer (it does not delete the current buffer).
Set_Graphics_Function—See the description of the
Set_Graphics_Function keyword in
"X Window System".
The PM buffer allows you to use all graphics functions supported by the X driver.
Set_Resolution—Two-element vector that sets the width and height of the buffers. The default size is 640-by-512. If this size is not the same as the existing buffers, the current buffers are destroyed and the device is reinitialized.
Set_Write_Mask—See the description of the
Set_Write_Mask keyword in
"X Window System".
Example
; Switch output to the PM buffer.
SET_PLOT,'PM'
; Make a 256x256 buffer with 128 colors.
DEVICE, Set_Resolution=[256, 256], Set_Colors=128
; Load a color table.
LOADCT, 15
; Make a plot.
SHADE_SURF, DIST(25)
; Get the color table RGB values.
TVLCT, r, g, b, /Get
; Put RGB values into a colormap array.
cmap = TRANSPOSE([[r],[g],[b]])
; Read the image from the PM buffer.
imgarr = TVRD()
; Write the image and colormap to a GIF file.
stat = IMAGE_WRITE('output.gif', IMAGE_CREATE(imgarr, Colormap=cmap))
; De-allocate memory used by the device.
DEVICE, /Close