Clipboard Objects

Objects of the IDLgrClipboard class send Object Graphics output to the operating system native clipboard or to a file in bitmap or vector format. The file type and destination is dependent upon the platform and the values of Draw method keywords.

Note
What appears when producing bitmap or vector output is dependent upon several factors. See Bitmap and Vector Graphic Output for details.

Writing to a File from IDLgrClipboard

The file type produced when the IDLgrClipboard::Draw method is passed an IDLgrView, IDLgrViewgroup, or IDLgrScene object varies depending upon keyword settings and the platform on which the call is issued. If the FILENAME keyword is set to a non-empty string, the name of the file IDL creates is specified by the string. If the FILENAME keyword is a non-zero, numeric value, IDL creates a file named idl.ext where ext is replaced with the appropriate extension shown in parentheses in the following table.

Table 12-1: File Types Produced by IDLgrClipboard Draw Method

Keyword Settings
Windows File Type
UNIX File Type

VECTOR = 1, POSTSCRIPT = 1

Encapsulated PostScript (EPS)

Encapsulated PostScript (EPS)

VECTOR = 1, POSTSCRIPT = 0

Enhanced MetaFile (EMF)

Encapsulated PostScript (EPS)

VECTOR = 0, POSTSCRIPT = 1

Encapsulated PostScript (EPS)

Encapsulated PostScript (EPS)

VECTOR = 0, POSTSCRIPT = 0

Bitmap (BMP)

Encapsulated PostScript (EPS)

Note
PostScript clipboard output can be generated using the CMYK color model. See the IDLgrClipboard::Draw method in the IDL Reference Guide for details.

Writing to the Clipboard from IDLgrClipboard

Objects can be written to the operating system clipboard using IDLgrClipboard::Draw. When the FILENAME keyword equals an empty string (" "), equals 0 (zero), or is not specified, the output is written to the clipboard.

Note
The IDLgrClipboard object empties the Windows clipboard before writing to it.

Creating Clipboard Objects

The IDLgrClipboard::Init method takes no arguments. Use the following statement to create a clipboard object that represents the system-native clipboard buffer:

myClipboard = OBJ_NEW('IDLgrClipboard') 

The following code creates an IDLgrClipboard object and outputs the contents of an IDLgrView, IDLgrViewgroup, or IDLgrScene to various files based on the platform. This is useful to determine exactly how the contents of the window are translated into bitmap or vector graphics. In the following code, myview denotes the name of the object (view, viewgroup, or scene) to be output. Vector postscript output is also generated using the CMYK color model.

oClip = OBJ_NEW('IDLgrClipboard') 
 
; Create Windows-only output file types. 
if !VERSION.OS_FAMILY eq 'Windows' then begin 
   oClip->Draw, myview, VECTOR=0, POSTSCRIPT=0, $ 
      FILENAME="clipboard.bmp" 
   oClip->Draw, myview, VECTOR=1, POSTSCRIPT=0, $ 
      FILENAME="clipboard.emf" 
endif 
 
; Create bitmap and vector PostScript files. 
oClip->Draw, myview, VECTOR=0, POSTSCRIPT=1, $ 
   FILENAME="clipboard_bitmap.eps" 
oClip->Draw, myview, VECTOR=1, POSTSCRIPT=1, $ 
   FILENAME="clipboard_vector.eps" 
 
   oClip->Draw, myview, VECTOR=1, POSTSCRIPT=1, $ 
      /CMYK, FILENAME="clipboard_cmyk.eps" 
 
obj_destroy, oClip 

See "IDLgrClipboard" (IDL Reference Guide) for details.