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

IDLgrPrinter::Draw


Syntax | Arguments | Keywords | Examples | Version History

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

Printing in Bitmap or Vector Graphic Mode

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.

Keyword Settings
Windows Printer Output
UNIX File Type
VECTOR = 0
Bitmap (BMP)
Encapsulated PostScript (EPS) file (e.g. xprinter.eps)
VECTOR = 1
Enhanced MetaFile (EMF)
Encapsulated PostScript (EPS) file (e.g. xprinter.eps)

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
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 when VECT_SORTING=0. Otherwise, objects are drawn to the destination device based on their average depth value. See Bitmap and Vector Graphic Output for more information on bitmap and vector output.

Syntax

Obj->[IDLgrPrinter::]Draw [, Picture] [, 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

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 may not sort correctly. See Controlling What is Displayed in Vector Graphicsfor details.

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
When using the IDLgrPrinter object under UNIX, the Xprinter output is regarded as write-only. As there is no support for 3-D text, IDL always generates filled triangles when rendering text in the Xprinter output. On Windows, the vector output is always Enhanced MetaFile (EMF) file format. Because printer output is usually sent directly to the printer the EMF file cannot be seen by the user.

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 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 

Version History

Introduced: 5.0

VECT_SORTING, VECT_TEXT_RENDER_METHOD keywords added: 6.1


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