The IDLgrClipboard::Draw procedure method draws the given picture to this graphics destination.
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.
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 |
| Note |
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 } ]
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.
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.
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 |
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.
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 |
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 |
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 |
| Note |
Set this keyword to indicate the type of graphics primitives generated. Valid values are:
| Note |
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
Introduced: 5.1
CMYK, VECT_SHADING, VECT_SORTING, and VECT_TEXT_RENDER_METHOD keywords added: 6.1