This operation code specifies the size, shape and location of a graphic in the current print job using pen and brush attributes specified by WINPRINT-GRAPH-BRUSH and WINPRINT-GRAPH-PEN.
CALL "WIN$PRINTER" USING WINPRINT-GRAPH-DRAW, WINPRINT-DATA GIVING RESULT
WINPRINT-DATA | Group item defined in
winprint.def as follows:
01 WINPRINT-DATA. 03 WPRTDATA-SET-STD-FONT. 03 WPRTDATA-DRAW REDEFINES WPRTDATA-SET-STD-FONT. 05 WPRTDATA-DRAW-START-X PIC 9(7)V99 COMP-5. 05 WPRTDATA-DRAW-START-Y PIC 9(7)V99 COMP-5. 05 WPRTDATA-DRAW-STOP-X PIC 9(7)V99 COMP-5. 05 WPRTDATA-DRAW-STOP-Y PIC 9(7)V99 COMP-5. 05 WPRTDATA-DRAW-UNITS UNSIGNED-SHORT. 05 WPRTDATA-DRAW-SHAPE UNSIGNED-SHORT. |
This operation returns the coordinates and shape of a graphic.
The printer must be open to perform this operation. WPRTDATA-DRAW should be initialized prior to use. There is no limit to the number of times this operation may be called. Once it is called, all further printing using the WRITE statement is performed using a TRANSPARENT background. The TRANSPARENT setting is not usually applied to WRITE statements, but this mode is necessary for graphics to print correctly. (This does not apply to WINPRINT-COLUMN operations, which have a particular setting for TRANSPARENCY.)
If WINPRINT-GRAPH-PEN or WINPRINT-GRAPH-BRUSH have not yet been called, this operation will create and use the defaults. The default pen is solid black, with a width of 1. The default brush is NULL, meaning there is no fill.
WINPRINT-GRAPH-DRAW has the following values:
WPRTUNITS-CELLS | Values are measured using the
cell size of the currently selected font. The cell-size is determined by the height and width of the
0 character of a font. This is roughly equivalent to measuring in
characters.
If you use a proportional font, it is common for uppercase characters to be wider than this measurement. Non-integer values are allowed in the measurements. |
WPRTUNITS-CELLS-ABS | Values are measured using the "cell size" of the currently selected font. Positioning is based on the left edge of the paper, regardless of the physical left margin determined by the printer (even if the absolute position is smaller). If the dimensions of the area to be printed are less than the printer's left or top physical margin, or greater than the printer's right or bottom physical margin, WIN$PRINTER will return an error. (Note that due to inherent differences in the hardware of printer manufacturers, this value may not provide truly device-independent results.) |
WPRTUNITS-INCHES | Values are measured in inches. |
WPRTUNITS-INCHES-ABS | Values are measured in inches. Positioning is based on the left edge of the paper, regardless of the physical left margin determined by the printer (even if the absolute position is smaller). If the dimensions of the area to be printed are less than the printer's left or top physical margin, or greater than the printer's right or bottom physical margin, WIN$PRINTER will return an error. |
WPRTUNITS-CENTIMETERS | Values are measured in centimeters. |
WPRTUNITS-CENTIMETERS-ABS | Values are measured in centimeters. Positioning is based on the left edge of the paper, regardless of the physical left margin determined by the printer (even if the absolute position is smaller). If the dimensions of the area to be printed are less than the printer's left or top physical margin, or greater than the printer's right or bottom physical margin, WIN$PRINTER will return an error. |
WPRTUNITS-PIXELS (default) | Values are measured using the dots-per-inch (DPI) resolution of the output device. Only integer values are allowed in the
measurements.
The actual size of this measurement varies depending on the target printer's resolution. This means that a width of 5 will appear differently on a 300dpi printer than it will on a 600dpi printer. Consider the unit of measure relative to the resolution of the targeting printer before printing. |
WPRT-DRAW-RECTANGLE | Draws a rectangle with 90-degree corners. |
WPRT-DRAW-ROUND-RECTANGLE | Draws a rectangle with rounded corners. |
WPRT-DRAW-LINE | Draws a line. |
See graphprn.cbl for examples of printing graphics. This example will draw a box with rounded edges:
INITIALIZE WPRTDATA-DRAW. MOVE WPRT-DRAW-ROUND-RECTANGLE TO WPRTDATA-DRAW-SHAPE. MOVE 3 TO WPRTDATA-DRAW-START-X. MOVE 1 TO WPRTDATA-DRAW-START-Y. MOVE 40 TO WPRTDATA-DRAW-STOP-X. MOVE 10 TO WPRTDATA-DRAW-STOP-Y. MOVE WPRTUNITS-CELLS TO WPRTDATA-DRAW-UNITS. CALL "WIN$PRINTER" USING WINPRINT-GRAPH-DRAW, WINPRINT-DATA GIVING CALL-RESULT.