Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

IDLgrClipboard::Draw


Syntax | Arguments | Keywords | Examples | Version History

The IDLgrClipboard::Draw procedure method draws the given picture to this graphics destination.

Writing to a File

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.

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)

Writing to the Clipboard

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.

Note
When VECT_SORTING=0, objects are drawn to the destination device in the order that they are added to the model, view, viewgroup, or scene object that contains them. Otherwise, objects are drawn to the destination device based on their average depth value.

Syntax

Obj->[IDLgrClipboard::]Draw [, Picture] [, /CMYK] [, FILENAME=string] [, POSTSCRIPT=value] [, VECT_SHADING={ 0 | 1 } ] [, VECT_SORTING={ 0 | 1 } ] [, VECT_TEXT_RENDER_METHOD={ 0 | 1 } ] [, VECTOR={ 0 | 1 } ]

Arguments

Picture

The view (an instance of an IDLgrView object), viewgroup (an instance of an IDLgrViewgroup object), or scene (an instance of an IDLgrScene object) to be drawn.

Keywords

CMYK

This keyword has an effect only when the output format is Encapsulated PostScript (POSTSCRIPT=1). Set this keyword to create a PostScript file using the CMYK (cyan, magenta, yellow, and black) color model. The default is a PostScript file using the RGB (red, green, blue) color model. This keyword applies to both bitmap and vector graphic PostScript files.

The CMYK format is a subtractive color model that is better suited for color printing. This color model allows some document processing applications and printer control software to easily adjust the overall brightness of an image by manipulating a single channel (K). PostScript files created with the CMYK color model must be processed by an interpreter capable of interpreting PostScript Language Level 2 or higher.

FILENAME

To write to a file, set this keyword as follows:

If the value is an empty string (" "), equals 0 (zero), or is not specified, the output is written to the clipboard.

Note
You are strongly encouraged to specify a string for this value. The ability to specify a numerical value is maintained for backward compatibility, but its usage should be deprecated.

POSTSCRIPT

Set this keyword to a non-zero value to indicate that the generated output should be in Encapsulated PostScript format. By default, the generated output is in Bitmap format on Windows platforms and Encapsulated PostScript on UNIX platforms.

VECT_SHADING

This keyword has an effect only when generating vector output (VECTOR=1) and when the output format is Encapsulated PostScript (POSTSCRIPT=1).

This keyword controls the appearance of smooth (Gouraud) shaded IDLgrPolygon and IDLgrSurface objects. Valid values are:

Note
Polygons and surfaces in Enhanced MetaFiles (EMF) files will be rendered using flat shading. Only the output in Encapsulated PostScript (EPS) files is affected by this keyword, and only when the VECTOR keyword has been set. See Bitmap and Vector Graphic Output for details about vector graphic output.

VECT_SORTING

This keyword has an effect only when generating vector output (VECTOR=1).

This keyword controls the way object primitives in a picture appear in the destination. Valid values are:

Note
Objects that intersect each other, IDLgrImage objects (which do not update the depth buffer), and objects contained within transparent views might not sort correctly. See Controlling What is Displayed in Vector Graphics.

VECT_TEXT_RENDER_METHOD

This keyword has an effect only when generating vector output (VECTOR=1).

This keyword controls the way text is rendered in a vector graphic file. Valid values are:

Note
The results of attempting to edit the text primitives depends upon the sophistication of the graphics program. An Enhanced MetaFile (EMF) inserted into a Microsoft Word document can be edited. However, not all versions of Microsoft Word support advanced 3-D graphic primitives such as those associated with obliquely or vertically aligned text. Choosing to edit a file with non-horizontally aligned text may result in the text being flattened into two dimensions. Typically, each letter becomes its own string and alignment is altered. To edit non-horizontal text and preserve the original quality, create an Encapsulated PostScript (EPS) file that can be modified in a more sophisticated object-oriented image editing program.

Note
See Text Rendering in Vector Graphics for more information.

VECTOR

Set this keyword to indicate the type of graphics primitives generated. Valid values are:

Note
Transparent objects in a view are not rendered in vector graphic files. Semi-transparent objects are rendered fully opaque. See Bitmap and Vector Graphic Output for a complete discussion of when to output to bitmap or vector graphics based on picture content.

Examples

This example demonstrates the process of copying the contents of an IDL graphics display object (a buffer or a window) to the system clipboard, where it becomes available for pasting into another application. The example also uses the IDLgrClipboard::Draw method to create a platform-dependent file type in the current directory.

PRO SendingPlotToClipboard 
 
; Determine the path to the "damp_sn2.dat" file. 
signalFile = FILEPATH('damp_sn2.dat', $ 
   SUBDIRECTORY = ['examples', 'data']) 
 
; Initialize the parameters of the data within the file. 
signalSize = 512 
signal = BYTARR(signalSize, /NOZERO) 
 
; Open the file, read in data, and then close the file. 
OPENR, unit, signalFile, /GET_LUN 
READU, unit, signal 
FREE_LUN, unit 
 
; Determine viewplane size and margins. 
offsetScale = 150. 
viewOffset = offsetScale*[-1., -1., 1., 1.] 
signalRange = MAX(signal) - MIN(signal) 
 
; Initialize the display objects. 
windowSize = [512, 384] 
oWindow = OBJ_NEW('IDLgrWindow', RETAIN = 2, $ 
   DIMENSIONS = windowSize, $ 
   TITLE = 'Damped Sine Wave with Noise') 
 
; Use an IDLgrViewgroup as the picture rather than  
; an IDLgrView. This is used  as a container for the 
; "loose" objects, such as the IDLgrText objects that  
; are the axis titles. 
oViewgroup = OBJ_NEW('IDLgrViewgroup') 
oWindow->SetProperty, GRAPHICS_TREE = oViewgroup 
 
; Add an IDL container to the viewgroup to hold text objects. 
oContainer = OBJ_NEW('IDL_CONTAINER') 
oViewgroup->Add, oContainer 
 
oView = OBJ_NEW('IDLgrView', $ 
   VIEWPLANE_RECT = [0., 0., signalSize, signalRange] + $ 
   viewOffset) 
oViewgroup->Add, oView 
oModel = OBJ_NEW('IDLgrModel') 
oView->Add, oModel 
 
; Initialize the plot object. 
oPlot = OBJ_NEW('IDLgrPlot', signal, COLOR = [0, 0, 255]) 
oModel->Add, oPlot 
 
; Obtain plot ranges. 
oPlot->GetProperty, XRANGE = xPlotRange, $ 
	YRANGE = yPlotRange 
 
; Initialize axes objects, which are based on the plot 
; ranges. 
oXTitle = OBJ_NEW('IDLgrText', 'Time (seconds)') 
oContainer->Add, oXTitle 
oXAxis = OBJ_NEW('IDLgrAxis', 0, RANGE = xPlotRange, $ 
   LOCATION = [xPlotRange[0], yPlotRange[0]], /EXACT, $ 
   TITLE = oXTitle, TICKDIR = 0, $ 
   TICKLEN = (0.02*(yPlotRange[1] - yPlotRange[0]))) 
oModel->Add, oXAxis 
oYTitle = OBJ_NEW('IDLgrText', 'Amplitude (centimeters)') 
oContainer->Add, oYTitle 
oYAxis = OBJ_NEW('IDLgrAxis', 1, RANGE = yPlotRange, $ 
   LOCATION = [xPlotRange[0], yPlotRange[0]], /EXACT, $ 
   TITLE = oYTitle, TICKDIR = 0, $ 
   TICKLEN = (0.02*(xPlotRange[1] - xPlotRange[0]))) 
oModel->Add, oYAxis 
oModel->Translate, -50., -50., 0. 
oWindow->Draw 
 
; Determine the centimeter to pixel resolution of the 
; plot on the screen. 
oWindow->GetProperty, RESOLUTION = screenResolution 
 
; Initialize clipboard destination object. 
oClipboard = OBJ_NEW('IDLgrClipboard', QUALITY = 2, $ 
   DIMENSIONS = windowSize, $ 
   RESOLUTION = screenResolution, $ 
   GRAPHICS_TREE = oViewgroup) 
 
; Determine the type of export file, which depends on 
; the screen device. 
screenDevice = !D.NAME 
CASE screenDevice OF 
'X': fileExtension = '.ps' 
'WIN': fileExtension = '.emf' 
ELSE: BEGIN 
   OBJ_DESTROY, [oWindow, oClipboard] 
   RETURN 
   END 
ENDCASE 
clipboardFile = 'damp_sn2' + fileExtension 
 
; Display the view within the clipboard destination, 
; which exports to a PS or EMF. 
oClipboard->Draw, FILENAME = clipboardFile, $ 
   /VECTOR 
oClipboard->Draw, FILENAME = 'damp_sn2.eps', $ 
   /POSTSCRIPT, /VECTOR 
 
; Cleanup object references. Before destroying the  
; IDLgrClipboard object, reset its GRAPHICS_TREE  
; to NULL so the IDLgrViewgroup can remain associated  
; with the IDLgrWindow. Interactive destruction 
; of the IDLgrWindow will free the other graphics objects 
; implicitly.  
oClipboard->SetProperty, GRAPHICS_TREE = OBJ_NEW() 
OBJ_DESTROY, oClipboard 
 
END 

Version History

Introduced: 5.1

CMYK, VECT_SHADING, VECT_SORTING, and VECT_TEXT_RENDER_METHOD keywords added: 6.1


Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]