A window object is a representation of an on-screen area on a display device that serves as a graphics destination.
Note: Objects or subclasses of this type can not be saved or restored.
Note on Window Size Limits
The OpenGL libraries IDL uses impose limits on the maximum size of a drawable area. The limits are device-dependent; they depend both on your graphics hardware and the setting of the RENDERER property. Currently, the smallest maximum drawable area on any IDL platform is 1280 x 1024 pixels; the limit on your system may be larger.
Superclasses
IDLitComponent
Creation
See IDLgrWindow::Init.
Properties
Objects of this class have the following properties. See IDLgrWindow Properties for details on individual properties.
In addition, objects of this class inherit the properties of all superclasses of this class.
Methods
This class has the following methods:
In addition, this class inherits the methods of its superclasses (if any).
Examples
JPEG2000 Files for Tiling
This example takes a 5000 by 5000 pixel JPEG file containing an aerial photograph of Chicago’s O’Hare International Airport and creates a JPEG2000 file from the data. This file type provides inherent support for image tiles.
See tilingjp2_doc.pro in the examples/doc/objects subdirectory of the IDL installation directory for the tiling application code. Run the example procedure by entering tilingjp2_doc at the IDL command prompt or view the file in an IDL Editor window by entering .EDIT tilingjp2_doc.pro.
Note: The first time you run this application, it generates the JPEG2000 file. This might take a noticeable amount of time, depending on your system speed. However, once the JPEG2000 image is created, this file will be used instead of being recreated.
The following figure shows the O’Hare image. When the application opens, the view is positioned in the upper-left corner of the full-resolution image.
Saving Window Contents to a File
If you have created a scene or view containing graphical objects and wish to save the rendering to a file, you will first need to create an image object from which to retrieve the image data. The following steps render an object to a window, create an image object from the window, and save the image data as a TIFF file.
First, create the view to be rendered. Use an indexed color model for the window object, setting the background color to white and the foreground color of the plot object to black.
mywindow = OBJ_NEW('IDLgrWindow', COLOR_MODEL=1)
myview = OBJ_NEW('IDLgrView', $
VIEWPLANE_RECT=[0,-4,10,8], COLOR=255)
mymodel = OBJ_NEW('IDLgrModel')
myplot = OBJ_NEW('IDLgrPlot', RANDOMN(seed, 10), COLOR=0, $
THICK=3)
myview->Add, mymodel
mymodel->Add, myplot
mywindow->Draw, myview
myimage = mywindow->Read()
myimage->GetProperty, DATA=image
WRITE_TIFF, 'myfile.tif', image
Instancing to Improve Redraw Performance
Within interactive graphics applications, it is often necessary to redraw a given view over and over again (for example, as the user clicks and drags within the view to manipulate one or more objects). During those redraws, it may be that only a small subset of the objects within the view is changing, while the remaining objects are static. In such a case, it may be more efficient to take a snapshot of the unchanged portion of the view. This snapshot can be reused for each draw, and only the changing portion of the view needs to be re-rendered. This process is called instancing.
It is to your advantage to use instancing only in cases where displaying the snapshot image is faster than rendering each of the objects that remain unchanged.
The following example shows how a typical instancing loop would be set up. First, hide the objects in the view that will be changing. In this example, we assume that the objects that change continuously are contained by a single model object, with the object reference myChangingModel. We set the HIDE property for this model to remove it from the rendered view.
myChangingModel->SetProperty, HIDE=1
myWindow->Draw, myView, /CREATE_INSTANCE
myUnchangingModel->SetProperty, HIDE=1
myChangingModel->SetProperty, HIDE=0
myView->SetProperty, /TRANSPARENT
ROT = 0
FOR i=0,359 DO BEGIN
ROT=ROT+1
myChangingModel->Rotate, [0,1,0], ROT
myWindow->Draw, myView, /DRAW_INSTANCE
ENDFOR
myUnchangingModel->SetProperty, HIDE=0
myView->SetProperty, TRANSPARENT=0
Version History
5.0 |
Introduced. |
6.1 |
Added MINIMUM_VIRTUAL_DIMENSIONS, ZOOM_BASE, and ZOOM_NSTEP properties.
|
6.2 |
Added QueryRequiredTiles method.
Added VIEWPORT_DIMENSIONS property.
|
6.3 |
Added OnEnter, OnExit, OnExpose, OnKeyboard, OnMouseDown, OnMouseMotion, OnMouseUp, and OnResize methods.
|
6.4 |
Added OnWheel method.
|
8.2 |
Added the LINE_QUALITY property.
|