"Dithering" or halftoning techniques are used to display images with multiple shades of gray on monochrome displays displays that can only display white or black. This topic is discussed in the PV-WAVE User's Guide.
Graphic and image output is always directed to the current window. When a window system is selected as the current graphics device, the index number of the current window is found in the !D.Window system variable. This variable equals -1 if no window is open or selected. The WSET procedure is used to change the current window. WSHOW hides or displays a window. WDELETE deletes a window.
The WINDOW procedure creates a new window with a given index. If a window already exists with the same index, it is first deleted. The size, position, title, and number of colors may also be specified. If you access the display before creating the first window, PV-WAVE automatically creates a window with an index number of 0 and with the default attributes.
The X Window and Microsoft Windows systems do not by default keep track of window contents. Therefore, when a window on the display is obscured by another window, the contents of its obscured portion is lost.
UNIX and OpenVMS Users: Re-exposing the window causes the X server to fill the missing data with the default background color for that window, and request the application to redraw the missing data. Applications can request a backing store for their windows, but servers are not required to provide it. Most current X servers do not provide backing store, and even those that do cannot necessarily provide it for all requesting windows. Therefore, requesting backing store from the server might help, but there is no certainty.
Windows Users: Re-exposing the window causes the Microsoft Windows to fill the missing data with the default background color for that window, and request the application to redraw the missing data.
1 (The Default) Setting the Retain keyword to 1 causes PV-WAVE to request that a backing store be maintained. If the window system decides to accept the request, it automatically repairs the missing portions when the window is exposed. X Windows may or may not, depending on the capabilities of the server and the resources available to it.
2 Specifies that PV-WAVE should keep a backing store for the window itself, and repair any window damage when the window system requests it. This option exists mainly for the X Window System. Under X, a pixmap (off-screen display memory) the same size as the window is created at the same time the window is created, and all graphics operations sent to the window are also sent to the pixmap. When the server requests PV-WAVE to repair freshly exposed windows, this pixmap is used to fill in the missing contents. Pixmaps are a precious resource in the X server, so backing pixmaps should only be requested for windows with contents that must absolutely be preserved.
UNIX Users: Some IBM AIX systems do not have backing store enabled in the X server. For this reason,DEVICE, Retain=2
is set by the Standard Library procedure SETDEMO_RS6000.pro. With backing store enabled, you can achieve increased performance by settingDEVICE, Retain=1
. Your system administrator can help you determine whether or not backing store is enabled on your system. To enable backing store, kill your workstation's X server and restart with:
xinit -- -bs -fn fixed
SET_PLOT, 'CGM'
INFO, /Device
TIP: If you want to send a CGM file to a hardcopy printer, and you want to modify the color table, it is a good idea to modify the color table before sending CGM graphics output to the file. For more information about modifying color tables, see the PV-WAVE User's Guide.
procedure before importing a CGM file into Microsoft Word. For example:
TIP: Run the MSWORD_CGM_SETUP
SET_PLOT, 'CGM' DEVICE, File='myplot.cgm' MSWORD_CGM_SETUP PLOT, dist(20) DEVICE, /CloseControlling CGM Output with DEVICE Keywords
Clip Specifies that all coordinates will be reduced to fit within the VDC coordinate range. This keyword is primarily used with the Xoffset and Yoffset keywords to protect the metafile from containing coordinates which are outside the range of the VDC system.
Close Closes the current CGM output file.
Colors Specifies the number of colors in the color table. Be sure to specify the number of colors in the color table before any graphics output is written to the file.
Ct_Offset Specifies the location (or offset) of the first element in the color table. As with the Colors keyword, this value should be specified before any graphics output is written to the file.
Filename Specifies the name of the CGM output file to be opened. If the keyword is not specified, the default name wave.cgm is used.
Index_From_Zero If nonzero, maps the PV-WAVE colortable indices directly to the CGM color table indices. That is, the indices are mapped 0-0, 1-1, and so on. By default, the PV-WAVE to CGM color indices are mapped 0-1, 1-2, and so on. This keyword disables the Color and Ct_Offset keywords.
Metafile_Type Specifies the metafile type. Options are
clear_text
and binary
. The default value is clear_text
. The binary
type is machine-specific and is more difficult to transfer.Scale_Factor Includes a floating-point value in the metafile for the Scale Mode Metric command. This allows for CGM interpreters to scale the graphics output appropriately for "exact sizing". The metric scale-factor represents the distance (in millimeters) in the displayed picture this corresponds to one VDC unit.
Std_Cell_Array Specifies that images created with the binary output (CELL_ARRAY commands) are compliant with the CGM standard. Std_Cell_Array is enabled by default. Disabling this keyword may result in some non-standard cell array commands for odd-sized images. The non-standard cell array option is provided for downward compatibility.
Xoffset Specifies the number of horizontal coordinate units to offset the graphics output. Xoffset is specified by a positive normalized coordinate in the range {0.0...1.0}.
Yoffset Specifies the number of vertical coordinate units to offset the graphics output. Yoffset is specified by a positive normalized coordinate in the range {0.0...1.0}.
SET_PLOT, 'CGM'
DEVICE, Filename='filename1'
...
DEVICE, /Close
DEVICE, Filename='filename2'
...
DEVICE, /Close
TVLCT, [0,255,0,0], [0,0,255,0], [0,0,0,255]
A
is the image variable:
A(WHERE(A EQ 0B)) = 255B
ERASE, 150Binary CGM Output for VAX/OpenVMS Machines
CGM set metafile "cgmfile" format 2 record 512 CGM interpret
To use HPGL as the current graphics device, issue the command:
SET_PLOT, 'HP'
INFO, /Device
Close_File PV-WAVE creates, opens and writes a file containing the generated graphics output. The Close_File keyword outputs any buffered commands and closes the file.
CAUTION: Under UNIX, if you close the output file with the Close_File DEVICE keyword, and then execute a command (such as PLOT) that creates more output, PV-WAVE reopens the same file, erasing the previous contents. To avoid losing the contents of an output file, use the Filename keyword to specify a different filename, or use SET_PLOT to switch to a different graphics driver, or be sure to print the closed output file before creating more output.
NOTE: See the discussion of printing output files in the PV-WAVE User's Guide for more information on this topic.
If your plotter has a sheet feeder, you need to issue the command:
DEVICE, /Eject
DEVICE, Eject=2
Filename By default all generated output is sent to a file named wave.hp. The Filename keyword can be used to change this default. If you specify a filename, the following occurs:
Landscape PV-WAVE normally generates plots with portrait orientation (the x-axis is along the short dimension of the page). If Landscape is present, landscape orientation (the x-axis is along the long dimension of the page) is used instead.
Output Specifies a scalar string that is sent directly to the graphics output file without any processing, allowing you to send arbitrary commands to the file. Since PV-WAVE does not examine the string, it is your responsibility to ensure that the string is correct for the target device.
Polyfill Some plotters (e.g., HP7550A) can perform polygon filling in hardware, while others (e.g., HP7475) cannot. PV-WAVE therefore assumes that the plotter cannot, and generates all polygon operations in software using line drawing. Specifying a nonzero value for the Polyfill keyword causes PV-WAVE to use the hardware polygon filling. Setting it to zero reverts to software filling.
Plotter_On_Off There are some configurations in which an HPGL plotter is connected between the computer and a terminal. In this mode (known as eavesdrop mode), the plotter ignores everything it is sent and passes it through to the terminal the plotter is logically off. This state continues until an escape sequence is sent that turns the plotter logically on. At this point the plotter interprets and executes all input as HPGL commands. Another escape sequence is sent at the end of the HPGL commands to return the plotter to the logically off state.
DEVICE, Xon_Xoff=0
Xsize Specifies the width of output PV-WAVE generates. Xsize is specified in centimeters unless Inches is specified.
Yoffset Specifies the y position on the page of the lower-left corner of output generated by PV-WAVE. Yoffset is specified in centimeters unless Inches is specified. (In some cases, offset is taken from the origin. See the Note following the keyword descriptions for details.)
Ysize Specifies the height of output generated by PV-WAVE. Ysize is specified in centimeters unless Inches is specified.
Xoffset = -(Xsize/2) Yoffset = -(Ysize/2)
Supported Features of HPGL
NOTE: If you have trouble with plots not completing and you have a plotter that allows you to set switches to enable pen buffering, make sure that this switch is set. If it is not, turn the plotter off, set the switch, and send your plot to the plotter again.
Here is a list of what is supported:
HPGL is not able to support all of the standard PV-WAVE linestyles. The following table summarizes the differences between the PV-WAVE linestyles and those supported by HPGL.
TIP: If your HPGL plotter is connected to an HP-IB interface, you must run PV-WAVE's HPGL output through a filter before you can plot it. The following UNIX command accomplishes this task:
tr -d '/012' wave.hp newwave.hp
NOTE: When printing from VDA Tools to a PCL device, all output that appears in black in the VDA Tool will appear in white on the printed page (i.e., it will not be visible).
SET_PLOT, 'PCL'
Use
INFO,
/Device
to view the driver's current settings.
UNIX Users: When you print files to a PCL device from a UNIX system, you may need to specify the-v
option in the print command. This option indicates that a raster image is being transmitted. For example:
lpr -Plj250_q -v wave.pcl
OpenVMS Users: Use the PASSALL parameter. For example:
PRINT /QUEUE=LJ250_Q /PASSALL WAVE.PCLControlling PCL Output with DEVICE Keywords
Close_File PV-WAVE creates, opens and writes a file containing the generated graphics output. The Close_File keyword outputs any buffered commands and closes the file.
CAUTION: Under UNIX, if you close the output file with the Close_File DEVICE keyword, and then execute a command (such as PLOT) that creates more output, PV-WAVE reopens the same file, erasing the previous contents. To avoid losing the contents of an output file, use the Filename keyword to specify a different filename, or use SET_PLOT to switch to a different graphics driver, or be sure to print the closed output file before creating more output.
NOTE: For more information on this topic, see the discussion of printing output files in the PV-WAVE User's Guide.
wave.pcl
. The Filename keyword can be used to change this default. If you specify a filename, the following occurs:
Inches By default, the Xoffset, Xsize, Yoffset, and Ysize keywords are specified in centimeters. However, if Inches is present and nonzero, they are taken to be in inches instead.
Landscape PV-WAVE normally generates plots with portrait orientation (the x-axis is along the short dimension of the page). If Landscape is present, landscape orientation (the x-axis is along the long dimension of the page) is used instead.
Optimize It is desirable, though not always possible, to compress the size of the output file. Such optimization reduces the size of the output file, and improves I/O speed to the printer. There are three levels of optimization:
ESC*b0M
(Select full graphics mode), ESC*b1M
(Select compacted graphics mode 1), and ESC*b2M
(Select compacted graphics mode 2). To determine if your printer supports the required escape sequences, consult the programmers manual for the device. The HP LaserJet II does not support this optimization level. The DeskJet PLUS does.
NOTE: Level 2 optimization can be very slow on some devices (such as the DeskJet PLUS). On such devices, it is best to avoid this optimization level.
Pixels By default, the Xoffset, Xsize, Yoffset, and Ysize keywords are specified in centimeters. However, if Pixels is present and nonzero, they are taken to be in pixels instead. Note that the selected resolution will determine how large a region is actually written on the page.
Portrait If Portrait is present, PV-WAVE will generate plots using portrait orientation, the default.
Resolution The resolution at which the PCL printer will print. PCL supports resolutions of 75, 100, 150, and 300 dots per inch. The default is 300 dpi. Lower resolution gives smaller output files, while higher resolution gives superior quality.
Threshold Specifies use of the threshold dithering algorithm. For information on this dithering method, see the PV-WAVE User's Guide.
Xoffset Specifies the x position on the page of the lower-left corner of output generated by PV-WAVE. Xoffset is specified in centimeters unless Inches or Pixels is specified.
Xsize Specifies the width of the PV-WAVE output. Xsize is specified in centimeters unless Inches or Pixels is specified.
Yoffset Specifies the y position on the page of the lower-left corner of output generated by PV-WAVE. Yoffset is specified in centimeters unless Inches or Pixels is specified.
Ysize Specifies the height of the PV-WAVE output. Ysize is specified in centimeters unless Inches or Pixels is specified.
A
is the image variable:
A(WHERE(A EQ 0B)) = 255B
To direct graphics output to the PM buffer, enter the command:
SET_PLOT, 'PM'
Close Deallocates the memory used by the buffers. The PM buffer device is reinitialized if subsequent graphics operations are directed to the device.
Get_Graphics_Function See the description of the Get_Graphics_Function keyword in X Window System on page -58.
Get_Write_Mask See the description of the Get_Write_Mask keyword in X Window System on page -58.
Set_Character_Size A two-element vector that changes the standard width and height of the vector-drawn fonts. The first element in the vector contains the new character width, and the second element contains the height. By default, characters are approximately 8-pixels wide, with 12 pixels between lines.
The PM buffer allows you to use all graphics functions supported by the X driver.
SET_PLOT,'PM'
DEVICE, Set_Resolution = [256,256], $
Set_Colors=128
LOADCT, 15
SHADE_SURF, data
TVLCT, r, g, b, /Get
cmap =TRANSPOSE([[r],[g],[b]])
imgarr = TVRD()
stat = IMAGE_WRITE('output.gif', $
IMAGE_CREATE(imgarr, Colormap=cmap))
DEVICE, /Close
NOTE: The default PostScript fonts changed with PV-WAVE 6.21. The previous default PostScript font was 12 point Helvetica. The new default PostScript font is 14 point Times Roman. You can change the default font by editing the filefontmap_ps
, which is discussed in the chapter Using Fonts in the PV-WAVE User's Guide. To see which
To direct graphics output to a PostScript file, enter the command:
SET_PLOT, 'PS'
NOTE: Unlike monitors where white is the most visible color, PostScript writes black on white paper. Setting the output color index to 0, the default when PostScript output is selected, writes black. A color index of 255 writes white which is invisible on white paper. Color tables are not used with PostScript unless the color mode has been enabled using the DEVICE procedure. See below for information on using PV-WAVE with color PostScript.
PostScript printers impose a limit on the number of vertices a polygon may contain. This limit (750 vertices for most printers) is checked, and an error message is printed if it is exceeded.
NOTE: All
TIP: UseINFO,
/Device
to view the driver's current settings.
NOTE: PostScript hardware fonts can be rotated and transformed by general 3D transforms in PV-WAVE.
Refer to the PV-WAVE User's Guide for a comprehensive list of text formatting commands.
PostScript fonts are selected using DEVICE keywords. For example:
DEVICE, /Helvetica, /Bold
Bits_Per_Pixel PV-WAVE is capable of producing PostScript images with 1, 2, 4, or 8 bits per pixel. Using more bits per pixel gives higher resolution at the cost of generating larger files. Bits_Per_Pixel is used to specify the number of bits to use. The default number of bits is four.
CAUTION: Under UNIX, if you close the output file with the Close_File DEVICE keyword, and then execute a command (such as PLOT) that creates more output, PV-WAVE reopens the same file, erasing the previous contents. To avoid losing the contents of an output file, use the Filename keyword to specify a different filename, or use SET_PLOT to switch to a different graphics driver, or be sure to print the closed output file before creating more output.
Encapsulated Specifies that the PostScript produced by PV-WAVE is to be included in another PostScript document, such as one produced by TEX, LATEX, FrameMaker, Microsoft Word, or Ventura Publisher.
By default PV-WAVE assumes that its PostScript-generated output will be sent directly to a printer. It therefore includes PostScript commands to center the plot on the page and to eject the page from the printer. These commands are undesirable if the output is going to be inserted into the middle of another PostScript document. If Encapsulated is present and nonzero, PV-WAVE does not generate these commands.
DEVICE, encaps=0
.
NOTE: You cannot reposition encapsulated output (including EPSI output) via Xoffset or Yoffset keywords. This allows full positioning control for the including product, such as MS Word.
Like normal encapsulated PostScript files, EPSI files can be imported into many desktop publishing and word processing systems; however, EPSI format provides a previewing capability that allows an approximation of the printed PostScript output to be displayed on the screen. Previewed EPSI graphics are displayed in monochrome only.
differently when printed than they do in windows on the screen. This occurs because the driver's EPSI bitmap size is fixed no matter what the size of the original PV-WAVE image, and the PV-WAVE image is scaled into this bitmap. In addition, printed PostScript files can take advantage of scalable pixels, while pixels on the screen are static. Try experimenting with the other DEVICE keywords when you specify /Epsi to see which combination gives the best results with your particular size image. The driver's EPSI bitmap size (888-by-635 pixels) works well in many cases.
TIP: EPSI images sometimes appear
NOTE: You can print EPSI files directly, but only when the file is generated in portrait mode (see the description of the Portrait keyword below).
wave.ps
. The Filename keyword can be used to change this default. If you specify a filename, one or both of the following actions occur:
Get_Fontmap Returns a list of the current font map settings. If /Get_Fontmap is specified, the information is printed to the screen. If a variable name is specified (e.g., Get_Fontmap=varname), a string array is returned.
The information returned by Get_Fontmap is in the same form as the strings specified with Set_Fontmap. The only exception to this pattern is that the first string returned in a string array is labeled as font 0 and is the current default font.
Inches By default, the Xoffset, Xsize, Yoffset, and Ysize keywords are specified in centimeters. However, if Inches is present and nonzero, they are taken to be in inches instead.
Landscape PV-WAVE normally generates plots with portrait orientation (with the x-axis along the short dimension of the page). If Landscape is present, landscape orientation (with the x-axis is along the long dimension of the page) is used instead.
TIP: In both portrait and landscape mode, the x offset is measured as a displacement along the page's short dimension, and y offset is measured as a displacement along the page's long dimension. This may cause you some confusion when you are trying to orient graphics on a landscape page. The following figure demonstrates the correct way to specify offset for PostScript's landscape mode.
Figure B-1 This figure illustrates the way in which the Xoffset and Yoffset keywords are used to position graphics on a page in both portrait and landscape orientation. Assume that the page size is 8.5 x 11 inches. Portrait orientation is shown in A. The graphic is oriented with its origin (o) in the lower-left corner of the page. The x offset is 1 inch and the y offset is 1 inch. The graphic's x-axis falls along the page's short dimension. The same graphic shown in B is, in effect, rotated 90 degrees clockwise and offset 10 inches vertically (y offset) to produce the landscape orientation shown in C. The important point to note is that the y offset needed to position the graphic as shown in C is 10 inches, not 1 inch as you might expect.
Papername Specifies the size of paper to be used for printing. If you set the keyword value to `Letter', then standard 8.5x11-inch paper is used; `tabloid' is 11x17-inch paper (Default: `Letter')
NOTE: For 11x17 output, you must be using a PostScript Level 2-compliant device.
TIP: The PostScript driver does not automatically scale up for 11x17 output. You may want to adjust the Xsize, Ysize, Xoffset, Yoffset keywords accordingly.
Portrait If Portrait is present, PV-WAVE generates plots using portrait orientation (the default).
Scale_Factor Specifies a scale factor applied to the entire plot. Its default value is 1.0, allowing output to appear at its normal size. Scale_Factor magnifies or shrinks the resulting output.
DEVICE, Set_Fontmap='5
Helvetica-Oblique, 16'
NOTE: A default font mapping is defined in a configuration file that is read when the PS driver is initialized. For information on this configuration file, see the Using Fonts chapter in the PV-WAVE User's Guide.
Xoffset Specifies the x position on the page of the lower-left corner of output generated by PV-WAVE. By default, Xoffset is specified in centimeters unless the Inches keyword is specified. Scale_Factor does not affect the value of Xoffset.
Xsize Specifies the width of output. By default, Xsize is specified in centimeters unless the Inches keyword is specified Scale_Factor modifies the value of Xsize. Hence, the statement:
DEVICE, /Inches, Xsize=7.0, Scale_Factor=0.5
Yoffset Specifies the y position on the page of the lower-left corner of output generated by PV-WAVE. By default, Yoffset is specified in centimeters unless the Inches keyword is specified. Scale_Factor does not affect the value of Yoffset.
Ysize Specifies the height of output. By default, Ysize is specified in centimeters unless the Inches keyword is specified. Scale_Factor modifies the value of Ysize. Hence, the statement:
DEVICE, /Inches, Ysize=5.0, Scale_Factor=0.5
!P.Font = 0
PLOT, temps, Title='Average Temp', Font=0
PostScript Fonts
NOTE: When generating three-dimensional plots, it is best to use the software fonts, because PV-WAVE can draw them in perspective with the rest of the plot. For details on software fonts, see the PV-WAVE User's Guide.
DEVICE, /Color
A
is the image variable:
A(WHERE(A EQ 0B)) = 255BCreating Publication-quality Documents
Figure B-2 is an example of a PV-WAVE-generated PostScript plot that has been inserted into a LATEX document. It was produced with the following statements:
SET_PLOT, 'PS'
DEVICE, /Encapsulated, Filename='pic1.ps'
x = FINDGEN(200) PLOT, 10000 * SIN(x/5) / EXP(x/100), $ Linestyle=2, Title='PV-WAVE ' + $ 'PostScript plot', Xtitle='Point Number', $ Ytitle='Y Axis Title', Font=0
OPLOT, 10000 * COS(x/5) / EXP(x/100), Linestyle=4
XYOUTS, 100, -6000, 'Sine', Font=0
OPLOT, [120, 180], [-6000, -6000], Linestyle=2
XYOUTS, 100, -8000, 'Cosine', Font=0
OPLOT, [120, 180], [-8000, -8000], Linestyle=4
Figure B-2 Sample PostScript plot using Helvetica font.
SET_PLOT, 'PS' DEVICE, /Encapsulated, Filename='pic4.ps' OPENR, 1, !Dir+'/data/mandril.img'
a = BYTARR(256, 256, /Nozero)
READU, 1, a
CLOSE, 1
FOR i = 0,3 DO BEGIN
DEVICE, Bits_Per_Pixel=2^i
TV,a,i ,Xsize=2.5, Ysize=2.5, /Inches
ENDFOR
Figure B-3 1, 2, 4, and 8-bit PostScript images.
insertplot
, is used to insert PV-WAVE-generated PostScript files into LATEX documents. The definition of this macro depends upon the TEX DVI to PostScript translation program used and is therefore not portable between various DVI programs.However, given familiarity with TEX it is relatively easy to modify the macro to suit the various DVI programs encountered in practice. The
insertplot
macro is as follows:
% Insert a PostScript plot made by % PV-WAVE into a LATEX document: % For the ArborText program dvips. % % This macro creates a captioned figure % of the specified size and uses the % \special command to insert the Post % Script. % % Usage: \insertplot{file}{caption} % {label}{width}{height} % file = name of file containing the PostScript. % caption = caption of figure % label = latex \label{} for figure to % be used by \ref{} macro. % width = width of figure, in inches. % height = height of figure, in inches. % % Insert a plot. \newcommand{\insertplot}[5]{% % Usage: \insertplot{file}{caption} % {label}{width in inches}{height} \begin{figure}% \hfill\hbox to 0.05in{\vbox to #5in{\vfil% \inputplot{#1}{#4}{#5}%Include the plot % file }\hfill}% \hfill\vspace{-.1in}% Fudge factor to % tighten things up a bit. \caption{#2}\label{#3} \end{figure}} % % % Include a PostScript File, this varies % according to the DVI program: Usage: % \inputplot{filename}{width}{height} % When called from insertplot, the current % position is at the bottom CENTER of the % figure box. \newcommand{\inputplot}[3]{% % Output PostScript commands to scale % default sized (7 wide by 5 high) PV-WAVE % plot into the specified size. Also % set origin to the current point less % half the width of the box, centering the % box above the current point. \special{ps:: gsave #2 -36 mul 0 rmoveto currentpoint translate #2 7.0 div #3 5.0 div scale}% \special{ps: plotfile #1}\special{ps:: grestore}} % %
SET_PLOT, 'REGIS'
Average_Lines Controls the method of writing images to the VT240. If this keyword is set, as it is by default, even and odd pairs of image lines are averaged and written to a single line. If clear, each image line is written to the screen (see the discussion below).
This keyword has no effect when using a VT300 series terminal.
Close_File PV-WAVE creates, opens, and writes a file containing the generated graphics output. The Close_File keyword outputs any buffered commands and closes the file.
CAUTION: Under UNIX, if you close the output file with the Close_File DEVICE keyword, and then execute a command (such as PLOT) that creates more output, PV-WAVE reopens the same file, erasing the previous contents. To avoid losing the contents of an output file, use the Filename keyword to specify a different filename, or use SET_PLOT to switch to a different graphics driver, or be sure to print the closed output file before creating more output.
NOTE: See the discussion of printing output files in the the PV-WAVE User's Guide.
wave.regis
. The Filename keyword can be used to change this default. When you specify a filename, the following occurs:
Do not use the interactive graphics cursor when graphic output is not directed to your terminal. To direct the graphic data to both the terminal and the file, set the unit to the negative of the actual unit number. If the specified unit number is zero, then Regis output to the file is stopped.
Tty Directs output to both a file and the terminal.
VT240 Sets driver for VT240 series terminals.
VT241 Same as VT240.
VT340 Sets driver for VT340 series terminals (the default).
VT341 Same as VT340.
The default setting for Regis output is: VT340, 16 colors, 4 bits per pixel.
Average_Lines=1
. Routines that rely on a uniform graphics and image coordinate system, such as SHADE_SURF, will only work in this mode.Each line of the image is written to the screen, displaying every image pixel. An n, m image occupies 2m lines on the screen (
Average_Lines=0
). Graphics and image coordinates coincide only at the lower left corner of the image.
SET_PLOT, 'TEK'
Colors The number of colors supported by the terminal. Only used with 4100 series terminals. For example, if your terminal has 4-bit planes, the number of colors is 24 -16:
DEVICE, Colors=16
This parameter sets the field !D.N_Colors, which affects the loading of color tables via the Standard Library procedures, the scaling used by the TVSCL procedure, and the number of bits output by the TV procedure to the terminal. It also changes the default color, !P. Color, to the number of colors minus one.
Gin_Chars The number of characters PV-WAVE reads when accepting a GIN (Graphics Input) report. The default is 5. If your terminal is configured to send a carriage return at the end of each GIN report, set this parameter to 6. If the number of GIN characters is too large, the CURSOR procedure will not respond until two or more keys are struck. If it is too small, the extra characters sent by the terminal will appear as input to the next PV-WAVE prompt.
Plot_To Directs the Tektronix graphic output that would normally go to the user's terminal to the specified I/O unit. The logical unit specified should be open with write access to a device or file. Save graphic output in files for later playback, redirection to other terminals, or to devices that accept Tektronix graphic commands.
Do not use the interactive graphics cursor when graphic output is not directed to your terminal. To direct the graphic data to both the terminal and the file, set the unit to the negative of the actual unit number. If the specified unit number is zero, then Tektronix output to the file is stopped.
Reset_String The string used to place the terminal back into the normal interactive mode after drawing graphics. Use this parameter, in conjunction with the Set_String keyword, to control the mode switching of your terminal. For example, the GraphON 200 series terminals require the string
ESC2
to activate the alphanumeric window after drawing graphics. The call to set this is:
DEVICE, Reset=string(27b) + '2'
ESC%!1
, which selects the ANSII code mode.Set_String The string used to place the terminal into the graphics mode from the normal interactive terminal mode. If the 4100 series mode switch is set, using the keyword Tek4100, the default graphic mode setting string is
ESC%!0
, which selects the Tektronix code mode.Tek4014 If nonzero, specifies that coordinates are to be output with full 12-bit resolution. If this keyword is not present or is zero, 10-bit coordinates are output. By default, PV-WAVE sends 10-bit coordinates. 12-bit coordinates are compatible with most terminals, even those without the full resolution, but require more characters to send.
NOTE: The 4014 and the 4100 modes may be used together. The coordinate system PV-WAVE uses for the Tektronix is 0 to 4095 in the x direction and 0 to 3120 in the y direction, even when not in the 4014 mode in the 10-bit case the internal coordinates are divided by 4 prior to output.
The default setting for Tektronix output is: 10-bit coordinates, 4000 series terminals, and no use of color.
SET_PLOT, 'TEK' DEVICE, /TEK4100, Colors = n
The line drawing procedures work with all models. Color and the display of images (albeit very slowly and frequently of a poor quality because of the low number of colors) is usable only with 4100 series terminals. Hardware polygon fill works only on the 4100 series.
Because of the tremendous variation among the requirements and abilities of these terminals, it is crucial that you configure PV-WAVE properly for your terminal.
CAUTION: If you try to display images produced with the SHADE_SURF and SHOW3 procedures, PV-WAVE may abort. Because of a limitation in the range of image coordinates available on Tektronix devices, they are not well suited to the display of images.
Selecting the WIN32 Driver
NOTE: If you are running a Windows NT system, WIN32 hardware fonts can be rotated and transformed by general 3D transforms in PV-WAVE.
SET_PLOT, 'WIN32'
Listing the Current Settings for the WIN32 Driver
NOTE: WIN32 is the default device for Windows, so selecting WIN32 as the current graphics device is not necessary unless you have previously selected some other device and want to return to WIN32.
INFO, /Device
!P.Font=0
).
Close_Display Deletes all generated windows from the Windows workspace and returns PV-WAVE to the initial graphics state.
Copy Copies a rectangular area of pixels from one region of a window to another. The argument of Copy is a six- or seven-element array: [Xs, Ys, Nx, Ny, Xd, Yd, W], where: (Xs, Ys) is the lower-left corner of the source rectangle, (Nx, Ny) are the number of columns and rows in the rectangle, and (Xd, Yd) is the coordinate of the destination rectangle. Optionally, W is the index of the window from which the pixels should be copied to the current window. If it is not supplied, the current window is used for both source and destination. Copy can be used to increase the pace of animation. This is described in Using Pixmaps to Improve Application Performance on page -75.
Cursor_Crosshair Selects the crosshair cursor type.
Cursor_Original Selects the Windows default cursor the cursor in use by the window manager when PV-WAVE starts. This cursor pattern is used by default.
Cursor_Wait Specifies the wait cursor, usually an hourglass icon.
Direct_Color=24
Font Specifies the name of the font used when the hardware font is selected (that is, when !P.Font=0). For example, to select the font 14 point New Times Roman bold, use the following DEVICE call:
DEVICE, Font='Times New Roman, 14, bold'
NOTE: The size of the font selected also affects the size of software-drawn text (e.g., the Hershey fonts). The "!" commands accepted for software fonts for subscripts and superscripts do not work for hardware fonts.
Get_Fontmap Returns a list of the current font map settings. If /Get_Fontmap is specified, the information is printed to the screen. If a variable name is specified (e.g., Get_Fontmap=varname), a string array is returned.
The information returned by Get_Fontmap is in the same form as the strings specified with Set_Fontmap. The only exception to this pattern is that the first string returned in a string array is labeled as font 0 and is the current default font.
Get_Graphics_Function Returns the value of the current graphics function (set with the Set_Graphics_Function keyword). This keyword can be used to save the value of the current graphics function, change it temporarily, and then restore it. See the example in the section Using Graphics Functions to Manipulate Color on page -82.
Get_Window_Position Places the x and y device coordinates (relative to the lower-left corner of the display) of the window's lower-left corner into a named variable.
DEVICE, Get_Write_Mask=mask
Max_Lines Sets the maximum number of identical line segments that will be cached before forcing a screen redraw. The WIN32 driver uses an internal cache for drawing line segments. Instead of drawing each line individually, lines with common characteristics are drawn as a group. This feature increases drawing efficiency and rendering speed. To disable Max_Lines, set the keyword equal to one. (Default: 500 lines.)
NOTE: The line caching feature may affect some PV-WAVE behavior that is familiar to you. In general, this applies to any operation that depends on the order in which lines are drawn. For example, using OPLOT with the color set to the background color to erase drawn lines may not work as expected. This is because some or all of the second set of lines may be drawn before the first set they were intended to overwrite. To avoid this, use the EMPTY procedure to force the driver to empty the line cache first.
Pseudo_Color=8
Set_Character_Size A two-element vector that changes the standard width and height of the vector-drawn fonts. The first element in the vector contains the new character width, and the second element contains the height. By default, character size is set to the size of the default hardware font.
Set_Fontmap Associates specific font characteristics with a particular hardware font command. This keyword can be used to specify a single string containing the information for one font, or an array of strings containing the information for multiple fonts.
For example, to associate 16 point Helvetica italic with font command !5, use the following DEVICE call:
DEVICE, Set_Fontmap='5 Helvetica
, 16, italics'
NOTE: A default font mapping is defined in a configuration file that is read when the WIN32 driver is initialized. For information on this configuration file, see the Fonts chapter in the PV-WAVE User's Guide.
GXcopy
, which causes new pixels to completely overwrite any previous pixels.
True_Color=24
Window_State Returns an array containing values indicating the status for all available PV-WAVE windows. Each element of the array contains a value equal to the sum of the following values:
winarray
contains the value 3, or 1 + 2. This indicates that the window is active and backing store is active.
WINDOW, 3
DEVICE, Window_State=winarray PRINT, winarrayResizing Graphics
You can solve this problem by plotting to a high-resolution (large) window when you intend to make high-resolution plots. If you do not wish to view this large window (or you need to make it larger than your display) then you can use the /Pixmap keyword with the WINDOW command to make the window invisible.
Psym=3
(a dot) in a PLOT command, it will appear on the screen, but when you resize the window or print the graph, the dot will disappear. This is because these pixels are treated differently by the metafile. (Note that this problem does not affect images, such as those you might dispay with the TV procedure, for example.)To solve the disappearing-dot problem, you can turn off metafiles by using the /NoMeta keyword with the WINDOW command. This results in a bitmap (
DIB
file) being used for repainting and printing. Since bitmaps are not resizable, pixels can't be lost. But keep in mind that when the graphic is printed, it will be scaled to fit the printed region, so you will see effects such as wider lines and possibly boxes in place of dots. This problem can also be solved by using a higher resolution window for the initial plot.
For detailed information on these commands, see their individual descriptions in the PV-WAVE Reference Volume 2.
Use of Color in the WIN32 Driver
TIP: You can also use the graphics window Control menu to import, export, and print graphics.
NOTE: The color model used by the WIN32 driver in PV-WAVE Version 6.0 has changed from previous releases of PV-WAVE. Earlier releases, specifically version 4.2 and PV-WAVE Personal Edition, used a color model that was very similar to that used by the X Windows X11 driver. For PV-WAVE 6.0, changes to the WIN32 driver were made to support high-color Windows video drivers and required a simplification of the way color tables and palettes are handled.
Screen resolution is usually expressed in terms of the number of horizontal and vertical pixels displayed on the screen. Common resolutions are 640x480 (VGA), 800x600, 1024x768, and 1280x1024. Higher resolutions require more memory on the video card and a more capable monitor.
Color depth refers to the number of colors that can be displayed at once on the screen. This is usually one of 16, 256, 65636 (16-bit), or 16777216 (24-bit) and is directly related to the number of bits of video memory required to store the color information for a single pixel. In combination with the resolution, this determines what video modes are available for a given amount of memory on a video card. For instance, 1024x768 resolution with 256 colors requires 768KB of memory and so should be available on most video cards with at least 1 MB of video RAM while the same resolution with 24 bits of color information would require 2304KB and would not be available unless the video card has more than 2MB of video memory.
Refresh rate refers to how quickly the video card transfers information to the monitor and is not relevant to this discussion.
In PV-WAVE's WIN32 graphics driver, the contents of a graphics window are stored in a DIB (Device Independent Bitmap) created using the DIB_RGB_COLORS format. This means that the window image is stored in an exact parallel to PV-WAVE's color model: an array of 8-bit values that act as indices into a color table which contains 8 bits each of red, green, and blue color information.
The way a pixel value in the DIB gets mapped to a color on the video screen depends on the current color depth that the video driver is using. In general, Windows will map a given pixel color to the closest matching RGB value that the video driver can display. This is likely to be an unsatisfactory match for a driver in 16 color VGA mode, while a driver in 24-bit mode will be able to match any requested color exactly.
The palette is controlled by the application that the user is currently using the foreground application. With certain exceptions (discussed below), the foreground application can set the palette to represent whatever set of colors it wants. Background applications try to render their data as best they can given that the foreground application controls the palette; this often results in "flashing" as applications redraw their data when they move from background to foreground. When PV-WAVE is the foreground application, it directly maps the current color table to the Windows palette.
With PV-WAVE Version 6.0, the WIN32 driver always indicates that PV-WAVE has 256 colors available; if it needs to display in a palletized video mode, 20 colors evenly distributed through the color table are not mapped to the palette. The other 236 colors will be exactly represented but the 20 unmapped colors will map to the closest match available in the palette, either among the 236 PV-WAVE colors or the 20 system colors. For most of the PV-WAVE color tables, the closest match is immediately adjacent in the color table and the unmapped colors are very difficult to notice. Any discrepancy is purely visual; all PV-WAVE operations, including TV and TVRD, set and return the proper color and these operations return consistent results regardless of the current video model.
WINDOW, 1, /Bitmap, Xsize=1280, Ysize=1280
abnorm.dat
. (This file is located in the data
subdirectory of the main PV-WAVE directory.) It creates a bitmap and writes all 15 images to it. It then uses the Copy keyword of the DEVICE procedure to copy the images to a visible window. Pressing any key causes the animation to halt:
PRO animate_heart
OPENR, u, !Data_Dir+'abnorm.dat',/Get_Lun
frame = ASSOC(u, BYTARR(64, 64))
WINDOW, 0, /Bitmap, Xsize=7680, Ysize=512
FOR i = 0, 15-1 DO TVSCL, $ REBIN(SMOOTH(frame(i), 3), 512, 512), i
FREE_LUN, u
WINDOW, 1, Xsize=512, Ysize=512, Title='Heart'
i = 0L
WHILE GET_KBRD(0) EQ '' DO BEGIN DEVICE, Copy=[i * 512, 0, 512, 512, 0, 0, 0]
i = (i + 1) MOD 15
ENDWHILE ENDUsing the Write Mask and Graphics Functions to Manipulate Color
The value of the Set_Graphics_Function keyword controls the logical graphics function; this function specifies how the source pixel values generated by a graphics operation are combined with the pixel values already present on the screen. To see a complete list of graphics function codes, refer to the Set_Graphics_Function keyword description in the section X Window System.
In the following example, POLYFlLL is used to select the area to be inverted. Colors represented by color index 1 are XORed with the image currently displayed in that area.
DEVICE, Get_Graphics=oldg, Set_Graphics=6
POLYFILL, [[x0,y0], [x0,y1], [x1,y1], [x1,y0]], /Device, Color=1 DEVICE, Set_Graphics_Function=oldg
GXcopy
, which means that the source graphics from the current operation get copied into the window, destroying any graphics that were previously displayed there.
DEVICE, Set_Graphics_Function=6 DEVICE, Set_Write_Mask=8
Get_Win_Id returns the HWND that was returned from the WIN32
CreateWin
dow API call. If you are making PV-WAVE calls from another application via a connectivity mechanism, you can use this keyword to get the window handle and then use the handle as an argument to an API call like HideWindow
. You can also use the handle if you need to subclass a PV-WAVE graphics window for any reason.
Set_Win_Id causes PV-WAVE to use a window that already exists as a graphics window. For instance, you might have created a window in a Visual Basic form in which you would like PV-WAVE to display graphics. You can do this by passing PV-WAVE the window handle of the existing window at runtime using the Set_Win_Id keyword. PV-WAVE will subclass the window referred to by the handle when the keyword is used with a WINDOW command. When the driver is closed or when PV-WAVE exits, subclassing is removed.
The WMF driver is a 24-bit device. For more information on 24-bit color and the WMF driver, see Handling 24-bit Color.
Selecting the WMF Driver
NOTE: If you are running a Windows NT system, WMF hardware fonts can be rotated and transformed by general 3D transforms in PV-WAVE.
SET_PLOT, 'WMF'
INFO, /Device
SET_PLOT, 'WMF'Step 2 Indicate output should be sent directly to the printer:
DEVICE, /PrintStep 3 Select the printer to send output to (if other than the default printer):
printer = WIN32_PICK_PRINTER()
DEVICE, Set_Printer='printer_name'Step 4 Execute graphics commands (PLOT, SURFACE, XYOUTS, etc.) Step 5 Close the Windows Metafile and the output is sent to the printer:
DEVICE, /Close_FileHandling 24-bit Color
Because the WMF driver is a 24-bit device, you need to specify application colors as RGB values in hexadecimal notation, rather than as an index into a color table.
To ensure that colors display correctly on all types of devices, we recommend that you use the WoColorConvert function whenever you specify a color index in your code.
TEK_COLOR PLOT, DIST(10), Color=WoColorConvert(5)
!P.Font=0
).
Close_File Closes the currently open Windows Metafile. If the Print keyword was specified, the file will be sent directly to the selected printer.
Direct_Color If set to 24, the WMF driver interprets all colors as 24-bit. For the WMF driver, this keyword is synonymous with the True_Color keyword. (Example:
Direct_Color=24
) Filename Specifies the name of a file to save the Windows Metafile output in. This keyword must be used prior to any graphics commands. If a graphics command is used and neither the Print nor Filename keyword has been specified, a Windows File Selector will be displayed.
Font Specifies the name of the font used when the hardware font is selected (that is, when !P.Font=0). For example, to select the font 14 point New Times Roman bold, use the following DEVICE call:
DEVICE, Font='Times New Roman, 14, bold'
TIP: To avoid typing the font name, use the WIN32_PICK_FONT function to select a font interactively from a dialog box. For example, if you enter this command:
WAVE DEVICE, Font=WIN32_PICK_FONT()
The information returned by Get_Fontmap is in the same form as the strings specified with Set_Fontmap. The only exception to this pattern is that the first string returned in a string array is labeled as font 0 and is the current default font.
Get_Graphics_Function See the description of the Get_Graphics_Function keyword in X Window System on page -58.
Get_Write_Mask See the description of the Get_Write_Mask keyword in X Window System on page -58.
Inches By default, the Xoffset, Xsize, Yoffset, and Ysize keywords are specified in centimeters. However, if Inches is present and nonzero, these keywords are taken to be in inches instead.
NOTE: The line caching feature may affect some PV-WAVE behavior that is familiar to you. In general, this applies to any operation that depends on the order in which lines are drawn. For example, using OPLOT with the color set to the background color to erase drawn lines may not work as expected. This is because some or all of the second set of lines may be drawn before the first set they were intended to overwrite. To avoid this, use the EMPTY procedure to force the driver to empty the line cache first.
Print If present and non-zero, specifies that output should be sent directly to the selected Windows printer when the Windows Metafile is closed. As described in Sending PV-WAVE Output Directly to a Printer, either the Set_Printer keyword or the WIN32_PICK_PRINTER function can be used to select a destination printer. If neither is used, the default Windows printer is used. The Print keyword must be specified before any output is made to the Windows Metafile.
Pseudo_Color If set to 8, the WMF driver interprets 8-bit color values (that is, color values less than 256) as color map indices rather than as 24-bit colors. (Example:
Pseudo_Color=8
)
DEVICE, Set_Fontmap='5 Helvetica
, 16, italics'
NOTE: A default font mapping is defined in a configuration file that is read when the WMF driver is initialized. For information on this configuration file, see the Fonts chapter in the PV-WAVE User's Guide.
Set_Write_Mask See the description of the Set_Write_Mask keyword in X Window System on page -58.
Under Windows, the write mask can range from 0 to 255.
True_Color=24
)
The X Window System is the default windowing system for UNIX and OpenVMS PV-WAVE platforms.
In X there are two basic cooperating processes, clients and servers. A server usually consists of a display, keyboard, and pointer (such as a mouse) as well as the software that controls them. Client processes (such as PV-WAVE) display graphics and text on the screen of a server by sending X protocol requests across the network to the server. Although in the simplest case, the server and client reside on the same machine, this network-based design allows more elaborate configurations.
Controlling Where Graphics are Displayed
NOTE: If you are running an X11R6 system, X Windows fonts can be rotated and transformed by general 3D transforms in PV-WAVE.
$DISPLAY
(UNIX) or the logical DECW$DISPLAY
(DECwindows Motif) must be set properly. Otherwise, PV-WAVE may appear to "hang". The following command allows PV-WAVE windows to appear on the local display (the current workstation). Enter one of these commands at the prompt of the current workstation before you start PV-WAVE, depending on whether you are using UNIX or OpenVMS (DECwindows Motif):
setenv DISPLAY nodename:0.0
SET DISPLAY /CREATE /NODE=nodename -/SCREEN=0.0 /TRANSPORT=transport_type
$DISPLAY
environment variable or DECW$DISPLAY
logical, and that the machine PV-WAVE is running on has permission to communicate with that X server. Refer to the documentation for your X-compatible window manager to learn how to modify your X server's permissions list.
SET_PLOT, 'X'
INFO, /Device
.
UNIX and OpenVMS Users: For more details on interapplication communication, refer to the PV-WAVE GUI Application Developer's Guide
Additional Text Formatting Commands
NOTE: All the options listed above are fully compatible with the X Window System and can be used to facilitate access to your application. However, you are not required to use any of them your application can still run under X, even though it does not have a Motif GUI.
!P.Font=0
).
Refer to the PV-WAVE User's Guide for a comprehensive list of text formatting commands.
Bypass_Translation When this keyword is set, the translation table is bypassed and color indices can be directly specified. Pixel values read via the TVRD function are not translated if this keyword is set, and thus the result contains the actual (hardware) pixel values present in the display. By default, the translation table is used with shared color tables. When displays with static (read-only) visual classes and with private color tables are used, the translation table is always bypassed. For more information about the translation table, refer to Color Translation Table on page -74.
Close_Display Causes PV-WAVE to sever the connection with the X server. This has the effect of deleting all generated windows from the screen of the server, and returns PV-WAVE to the initial graphics state. One use for this option is to change the number of colors used. See the section, When Color Characteristics are Determined on page -73, for details.
Copy Copies a rectangular area of pixels from one region of a window to another. The argument of Copy is a six- or seven-element array: [Xs, Ys, Nx, Ny, Xd, Yd, W], where: (Xs, Ys) is the lower-left corner of the source rectangle, (Nx, Ny) are the number of columns and rows in the rectangle, and (Xd, Yd) is the coordinate of the destination rectangle. Optionally, W is the index of the window from which the pixels should be copied to the current window. If it is not supplied, the current window is used for both source and destination. Copy can be used to increase the pace of animation. This is described in Using Pixmaps to Improve Application Performance on page -75.
Cursor_Crosshair Selects the crosshair cursor type. The crosshair cursor style is the default.
Cursor_Original Selects the default cursor for the window system. Under X, it is the cursor in use by the window manager when PV-WAVE starts.
/usr/include/X11/cursorfont.h
DECW$INCLUDE:CURSORFONT.H
cursorfont.h
file gives the value of Xc_Cross as being 30. In order to make that the current cursor, use the statement:
DEVICE, Cursor_Standard=30
Direct_Color=12
Floyd If present and nonzero, selects the Floyd-Steinberg dithering method. For more information on this dithering method, the PV-WAVE User's Guide.
Font Specifies the name of the font used when the hardware font is selected. For example, to select the font
8X13
:
DEVICE, Font='8X13'
:
/usr/lib/X11/fonts
SYS$SYSROOT:[SYSCOMMON.SYSFONT]
The information returned by Get_Fontmap is in the same form as the strings specified with Set_Fontmap. The only exception to this pattern is that the first string returned in a string array is labeled as font 0 and is the current default font.
Get_Graphics_Function Returns the value of the current graphics function (set with the Set_Graphics_Function keyword). This can be used to remember the current graphics function, change it temporarily, and then restore it. For an example, see the example in the section Using Graphics Functions to Manipulate Color on page -82.
Index | Description |
---|---|
0 | Visual ID |
1 | Visual class |
2 | Depth |
3 | Size of colormap |
4 | Red mask |
5 | Green mask |
6 | Blue mask |
7 | Significant bits in the specification |
Visual Class | Value |
---|---|
StaticGray | 0 |
GrayScale | 1 |
StaticColor | 2 |
PseudoColor | 3 |
TrueColor | 4 |
DirectColor | 5 |
Get_Window_Position Places the x and y device coordinates of the window's lower-left corner into a named variable.
Get_Write_Mask Specifies the name of a variable to receive the current value of the write mask. For example:
Get_Write_Mask=mask
List_Fonts Returns a list of the available X fonts. If /List_Fonts is specified, the information is printed to the screen. If a variable name is specified (e.g., List_Fonts=varname), a string array is returned. This keyword works like the UNIX command
xlsfonts
. If the Pattern_Font keyword is used to specify a pattern, that pattern is used to filter the list of fonts returned by List_Fonts; otherwise, List_Fonts returns all available fonts.
DEVICE, /List_Fonts, Pattern='-adobe-*'
NOTE: X11R5 systems support scalable fonts. You can return the names of all scalable fonts by specifying a complete font name (one with all 14 fields separated by dashes) with a zero (0) in fields 7, 8, and 12 (the fields for pixel size, point size, and average width). To list all scalable fonts, enter the command:
DEVICE, /List_Fonts, Pattern_Font='-*-*-*-*-*-*-0-0-*-*-*-0-*-*'
NOTE: X11R6 systems allow fonts to be rotated and transformed by a general 3D transform. (This is accomplished using the X Logical Font Description (XLFD) extensions and does not include perspective.) You can return the names of all fonts that support 3D transformation by specifying a matrix in either the pixel size or point size fields (fields 7 or 8). To list all fonts capable of 3D transformation, enter the command:
DEVICE, /List_Fonts, $ Pattern_Font='-*-*-*-*-*-*-[1 0 0 1]-*-*-*-*-*-*-*'
Pseudo_Color=8
Retain Specifies the default method used for backing store when creating new windows. This is the method used when the Retain keyword is not specified with the WINDOW procedure. Backing store is discussed in more detail in the subsection, How Is Backing Store Handled? on page -2. The possible values for this keyword are summarized in Possible Values for the Retain Keyword on page -3.If Retain is not used to specify the default method, method 1 (server-supplied backing store) is used.
Set_Character_Size A two-element vector that changes the standard width and height of the vector-drawn fonts. The first element in the vector contains the new character width, and the second element contains the height. By default, character size is set to the size of the default hardware font.
Set_Fontmap='5
-adobe-times-bold-r-normal-*-14-*-*-*-*-*-*-*'
NOTE: A default font mapping is defined in a configuration file that is read when the X driver is initialized. For information on this configuration file, see the Fonts chapter in the PV-WAVE User's Guide.
GXcopy
, which causes new pixels to completely overwrite any previous pixels.
Static_Color When specified with a Depth value, selects the StaticColor visual with Depth bits per pixel. This keyword has effect only if no windows have been created.
DEVICE, Translation=Transarr
Transarr
. Element zero of Transarr
contains the pixel value allocated for the first color in the colormap, and so forth.For more information on the translation table, refer to Color Translation Table on page -74.
True_Color=12
VisualID If specified with the visual class ID number, selects the visual class with visual class with given ID number.
NOTE: To acquire visual class ID numbers use the X library client program xdpyinfo, or use the commandDEVICE, /Get_Visuals
.
WINDOW, 3
DEVICE, Window_State=winarray PRINT, winarrayX Window Visuals
The X server provides six visual classes read-write and read-only visuals for three types of displays: Gray Scale, Undecomposed Color, and Decomposed Color. The names of the visual classes are listed in the following table:
NOTE: For more information on the differences between pseudo color and 24-bit ("true") color, see PV-WAVE User's Guide.
TIP: For more detailed information about X visual classes, refer to Volume 1 of the Xlib Programming Manual, Second Edition, O'Reilly & Associates, Inc., Sebastopol, CA, 1990.
For example, if you are using a display that supports both the 24-bit deep DirectColor visual class, and an 8-bit deep PseudoColor visual class, PV-WAVE will select the 24-bit deep DirectColor visual class. To use PseudoColor, enter the following command before creating a window:
DEVICE, Pseudo_Color=8
Colormapped Graphics
NOTE: If a visual type and depth is specified, using the DEVICE procedure, and it does not match the default visual class of the screen, a new colormap is created.
Since each pixel in video memory directly references a set of three 8-bit red-green-blue intensities, there is no need for a color lookup table as in an 8-bit system. However, because PV-WAVE is an 8-bit colortable-based software package (instead of a "true" 24-bit software package), it performs similar conversions internally when drawing to a 24-bit display.
NOTE: To see a formula for calculating how many colors a display is capable of displaying, given the number of bits it has for describing each pixel, refer to the PV-WAVE User's Guide.
PV-WAVE colormaps can be either shared or private, and either read-write or read-only:
For more information about when color characteristics are determined when drawing or plotting to a window running in a 24-bit visual class, refer to 24-bit Visual Classes on page -77.
DEVICE, /Close_Display
TIP: Another way to close the connection to the X server is to delete every PV-WAVE graphics window that is currently open; this automatically closes the connection.
For more information about the advantages and disadvantages of private colormaps, refer to Private Colormaps on page -72.
WINDOW, Colors = -16
DEVICE, Translation=Trans
Trans
. Element zero of this translation vector contains the value pixel allocated for the zeroth color in the PV-WAVE colormap, and so forth.
TIP: In the case of a private colormap, each element of the translation vector contains its own index value, because private colormaps start at zero and are contiguous.
DEVICE, Bypass_Translation=0
For more information about !D.N_Colors, refer to the PV-WAVE User's Guide.
To see an example of how the translation table can affect displayed colors, see Interaction Between the Set_Graphics_Function Keyword and Hardware Pixel Values on page -83.
To read a brief description of the relationship between the X server and the X client, refer to X Window System on page -58.
WINDOW, 1, /Pixmap, XSize=128, YSize=128
heartbeat.dat
. (This file is located in the data
subdirectory of the main PV-WAVE directory.) It creates a pixmap and writes all 15 images to it. It then uses the Copy keyword of the DEVICE procedure to copy the images to a visible window. Pressing any key causes the animation to halt:
PRO animate_heart
IF !Version.platform EQ 'VMS' THEN $ OPENR, u, GETENV('WAVE_DIR')+$ '[data]heartbeat.dat', /Get_Lun $ ELSE $ OPENR, u, '$WAVE_DIR/data/heartbeat.dat', /Get_Lun
frame = ASSOC(u, BYTARR(256, 256))
WINDOW, 0, /Pixmap, XSize=7680, YSize=512
FOR i = 0, 15-1 DO TV, $ REBIN(SMOOTH(frame(i), 3), 512, 512), i
FREE_LUN, u
WINDOW, 1, XSize=512, YSize=512, Title='Heart'
i = 0L
WHILE GET_KBRD(0) EQ '' DO BEGIN DEVICE, Copy=[i * 512, 0, 512, 512, 0, 0, 0]
i = (i + 1) MOD 15
ENDWHILE END
For more discussion concerning the search order for X visual classes, refer to Selecting a Visual Class on page -69.
In this mode, color data is decompressed, meaning there are still only 256 slots in the PV-WAVE color table while operating in DirectColor mode. When color data is decompressed, 8 of the bits map to one of the 256 reds, 8 of the bits map to one of the 256 greens, and 8 of the bits map to one of the 256 blues that have been loaded into the 256 element color table (with LOADCT or TVLCT).
For more information about which bits are mapped to red, green, and blue, refer to Specifying 24-bit Colors in Hexadecimal Notation on page -79.
DEVICE, True_Color=24
data = DIST(512)
WINDOW, 0 LOADCT, 0 TVSCL, data
WINDOW, 1 LOADCT, 1 TVSCL, data
WINDOW, 2 LOADCT, 4 TVSCL, data
/etc/ttys
file of a Digital UNIX workstation (if it supported 24-bit visual classes) such that it included the line:
0: window = '/usr/bin/Xtm -class StaticGray'
Understanding 24-bit Graphics Displays
NOTE: Windows that are created with calls to WAVE Widgets or Widget Toolbox functions and procedures are treated differently. These windows do inherit the X visual class from their top-level shell, which in turn, inherits the X visual class from the root window. In this sense, windows that are part of a graphical user interface (GUI) are different from ordinary PV-WAVE graphics windows.
The video memory in a 24-bit machine is capable of addressing each pixel on the screen with 8 bits assigned to each of the red, green, and blue intensity values for that pixel. These sets of 8-bit values are known as color planes, e.g., the "red plane", the "green plane", and the "blue plane". The three red-green-blue intensity values for each 24-bit pixel in video memory are translated directly into color intensities for the red, green, and blue electron guns in the CRT.
Color = 'ff00ff'x
Figure B-4 Hexadecimal notation can be used to represent 24-bit numbers; each two digits describes either the red, green, or blue intensity. The top color shown in this figure is a light gray, since the red, green, and blue components are all set to an equal intensity. The lower color shown is the color magenta, where red and green are both set to full intensity (f f), but the color green is essentially turned "off" by setting it equal to zero (00).
ames. The hexadecimal form is not recognizable by the WAVE Widgets or Widget Toolbox routines. For more information about how to select colors for widgets in a graphical user interface (GUI), refer to the PV-WAVE GUI Application Developer's Guide.
NOTE: When programming with WAVE Widgets or Widget Toolbox, you can only enter colors using color n
For more information about the translation table, refer to Color Translation Table on page -74.
mydata1
, mydata2
, mydata3
, mydata4
, and mydata5
have all been defined as integers or floating-point vectors prior to entering the commands shown below.)
DEVICE, True_Color=24
PLOT, mydata1, Color='00ff00'x
OPLOT, mydata2, Color='0000ff'x
OPLOT, mydata3, Color='ff0000'x
OPLOT, mydata4, Color='00ffff'x
OPLOT, mydata5, Color='007fff'x
Using the Write Mask and Graphics Functions to Manipulate Color
NOTE: The system variable !D.N_Colors must still be initialized properly prior to opening the graphics window. For more information about how to initialize color characteristics, refer to When Color Characteristics are Determined on page -73.
TIP: For best results when using the write mask, use a color table that uses all 256 available colors, and bypass the translation table to make sure the color table starts at zero (0). Unfortunately, a side effect of letting PV-WAVE allocate all 256 colors is that you may see "window flashing" when using your application, as explained in Private Colormaps on page -72.
The value of the Set_Graphics_Function keyword controls the logical graphics function; this function specifies how the source pixel values generated by a graphics operation are combined with the pixel values already present on the screen. To see a complete list of graphics function codes, refer toTo see a complete list of graphics function codes, refer to the Set_Graphics_Function keyword description in the section X Window System.
For example, the following code segment shows how to use the XOR graphics function to toggle the "low bit" of the pixel value that determines the color in a rectangle defined by its diagonal corners (x0, y0) and (x1, y1):
DEVICE, Get_Graphics=oldg, Set_Graphics=6
POLYFILL, [[x0,y0], [x0,y1], [x1,y1], $
[x1,y0]], /Device, Color=1
DEVICE, Set_Graphics_Function=oldg
GXcopy
, which means that the source graphics from the current operation get copied into the window, destroying any graphics that were previously displayed there.
DEVICE, Set_Graphics_Function=6 DEVICE, Set_Write_Mask=8
Figure B-5 An example color translation table.
data = [1, 2, 3]
GXand = 1 PLOT, data, Color=5
PLOT, data, Color=(5 AND 6)
DEVICE, Set_Graphics_Function=GXand PLOT, data, Color=6
TIP: You can check the values in the current translation table using the Translation keyword; this keyword specifies the name of a variable to receive the translation vector. To read the translation table, enter this command:
DEVICE, Translation=Transarr
Transarr
. Element zero of Transarr
contains the pixel value allocated for the first color in the PV-WAVE colormap, and so forth.
To set the X Window ID for a PV-WAVE window, use the Set_Xwin_Id keyword with the WINDOW procedure. The X Window ID must be a valid, existing ID for the X server that PV-WAVE is using. When the Set_Xwin_Id keyword is used, PV-WAVE uses the X window associated with the ID; PV-WAVE does not create a new window. The programmer is responsible for synchronizing the use of this window by the two programs.
NOTE: If the X Window ID is from another program, PV-WAVE color table changes may not affect the window.
Similarly, the Get_Xpix_Id keyword can be used to get the X Pixmap ID.
windows sharing a common X Window ID. For example:
CAUTION: The WDELETE procedure will delete all
WINDOW, 0, Get_Xwin_Id=New_Xwin_Id WINDOW, 1, Set_Xwin_Id=New_Xwin_Id WDELETE, 1
WDELETE, 1
deletes both windows 1 and 0.
To direct graphics output to the Z-buffer, enter the command:
SET_PLOT, 'Z'
Close Deallocates the memory used by the buffers. The Z-buffer device is reinitialized if subsequent graphics operations are directed to the device.
Get_Graphics_Function See the description of the Get_Graphics_Function keyword in Controlling the X Driver with DEVICE Keywords on page -61.
Get_Write_Mask See the description of the Get_Write_Mask keyword in Controlling the X Driver with DEVICE Keywords on page -61.
Set_Character_Size A two-element vector that changes the standard width and height of the vector-drawn fonts. The first element in the vector contains the new character width, and the second element contains the height. By default, characters are approximately 8-pixels wide, with 12 pixels between lines.
The Z-buffer allows you to use all graphics functions supported by the X driver.
SET_PLOT, 'z' SHADE_SURF, HANNING(23,23) SURFACE, HANNING(23,23), /Noerase img = TVRD(0,0,640,512) SET_PLOT, 'x' TV, img
Figure B-6 Resulting image from Example 1.
Figure B-7
dev_name = !D.Name
im = BYTARR(512,512) OPENR, 1, FILEPATH(`mandril.img', SubDir='data' )
READU, 1, im CLOSE, 1 SET_PLOT, `z' ERASE
SHADE_SURF, HANNING(23,23), /Save
verts=[ [0,0,0], [20,0,0.5], [20,20,1], $ [0,20,0.5] ]
POLYFILL, Verts, Pattern = im, $ Image_coord=[[0,0],[511,0],[511,511], $ [0,511]], /T3d
res = TVRD(0,0,640,512) SET_PLOT, dev_name TVSCL, res
Figure B-8 Resulting image from Example 2.
dev_name = !D.Name
im = BYTARR(512,512) OPENR, 1, FILEPATH(`mandril.img', SubDir='data' ) READU, 1, im CLOSE, 1 SET_PLOT, 'z' ERASE
SHADE_SURF, HANNING(23,23), /Save
verts=[ [0,0,0], [20,0,0.5], [20,20,1], [0,20,0.5] ]
POLYFILL, Verts, Pattern = im, $ Image_coord=[[0,0],[511,0],[511,511], [0,511]], /T3d
res = TVRD(0,0,640,512) SET_PLOT, dev_name TVSCL, res
Figure B-9 Resulting image from Example 3.
Figure B-10