The IDLgrPrinter::Draw procedure method draws the given picture to this graphics destination.
The IDLgrPrinter::Draw method VECTOR keyword generates output in bitmap or vector format. The following table shows the keyword options and results for each platform.
Because Windows printer output is usually sent directly to the printer, EMF and BMP files are not viewable. On UNIX, the printer output is usually directed to a file named xprinter.eps by default.
| Note |
Obj->[IDLgrPrinter::]Draw [, Picture] [, 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 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 printing the contents of an IDL graphics display object (a buffer or a window) to an IDLgrPrinter object. The resolution of the printed page is based on the resolution of the screen. The model object in the printer object must be scaled to maintain the same size as displayed on the screen. The location of the view must also be changed to center the display on the page.
PRO PrintingAnImage
; Determine the path to the "convec.dat" file.
convecFile = FILEPATH('convec.dat', $
SUBDIRECTORY = ['examples', 'data'])
; Initialize the parameters of the image with the file.
convecSize = [248, 248]
convecImage = BYTARR(convecSize[0], convecSize[1])
; Open the file, read in the image, and then close the
; file.
OPENR, unit, convecFile, /GET_LUN
READU, unit, convecImage
FREE_LUN, unit
; Initialize the display objects.
windowSize = convecSize
oWindow = OBJ_NEW('IDLgrWindow', RETAIN = 2, $
DIMENSIONS = windowSize, $
TITLE = 'Earth Mantle Convection')
oView = OBJ_NEW('IDLgrView', $
VIEWPLANE_RECT = [0., 0., windowSize])
oModel = OBJ_NEW('IDLgrModel')
; Initialize the image object with its palette.
oPalette = OBJ_NEW('IDLgrPalette')
oPalette->LOADCT, 27
oImage = OBJ_NEW('IDLgrImage', convecImage, $
PALETTE = oPalette)
; Add image to model, which is added to the view, and
; then the view is displayed in the window.
oModel->Add, oImage
oView->Add, oModel
oWindow->Draw, oView
; Determine the centimeter measurements of the image
; on the screen.
oWindow->GetProperty, RESOLUTION = screenResolution
windowSizeCM = windowSize*screenResolution
; Initialize printer destination object.
oPrinter = OBJ_NEW('IDLgrPrinter', PRINT_QUALITY = 2, $
QUALITY = 2)
; Obtain page parameters to determine the page
; size in centimeters.
oPrinter->GetProperty, DIMENSIONS = pageSize, $
RESOLUTION = pageResolution
pageSizeCM = pageSize*pageResolution
; Calculate a ratio between screen size and page size.
pageScale = windowSizeCM/pageSizeCM
; Use ratio to scale the model within the printer to the
; same size as the model on the screen.
oModel->Scale, pageScale[0], pageScale[1], 1.
; Determine the center of the page and the image in
; pixels.
centering = ((pageSizeCM - windowSizeCM)/2.) $
/pageResolution
; Move the view to center the image.
oView->SetProperty, LOCATION = centering
; Display the view within the printer destination.
oPrinter->Draw, oView
oPrinter->NewDocument
; Cleanup object references.
OBJ_DESTROY, [oPrinter, oView, oPalette]
END
Introduced: 5.0
VECT_SORTING, VECT_TEXT_RENDER_METHOD keywords added: 6.1