WINPRINT-GRAPH-DRAW

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 .

Usage

CALL "WIN$PRINTER"
    USING WINPRINT-GRAPH-DRAW, WINPRINT-DATA
    GIVING RESULT

Parameters

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.

Return Value

This operation returns the coordinates and shape of a graphic.

Description

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

Note: The current cursor position on the printer is not modified by this call.

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.

Note: When you call WINPRINT-GRAPH-DRAW, the operation will automatically test to see if a form feed is pending. If this is the case, the form feed will be performed before the call to this operation is executed.

WINPRINT-GRAPH-DRAW has the following values:

  • WPRTDATA-DRAW-UNITS - Specifies the unit of measure of the values passed for drawing coordinates. If an illegal value is set, the unit of measure will be set to the default (WPRTUNITS-PIXELS). The unit of measure may be set to one of 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.

  • WPRTDATA-DRAW-SHAPE - Specifies which type of shape to draw. If an illegal value is used, no shape will be drawn. The possible values are:
    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.
  • WPRTDATA-DRAW-START-X - Specifies the top-left horizontal coordinate of the shape to draw. The unit of measure is set with WPRTDATA-DRAW-UNITS. The minimum value of this coordinate is 0. The top-leftmost coordinate for all graphic operations is 0,0
  • WPRTDATA-DRAW-START-Y - Specifies the top-left vertical coordinate of the shape to draw. The unit of measure is set with WPRTDATA-DRAW-UNITS. The minimum value of this coordinate is 0. The top-leftmost coordinate for all graphic operations is 0,0
  • WPRTDATA-DRAW-STOP-X - Specifies the lower-right horizontal coordinate of the shape to draw. The unit of measure is set with WPRTDATA-DRAW-UNITS. The maximum value of this coordinate depends on the unit of measure selected.
  • WPRTDATA-DRAW-STOP-Y - Specifies the lower-right vertical coordinate of the shape to draw. The unit of measure is set with WPRTDATA-DRAW-UNITS. The maximum value of this coordinate depends on the unit of measure selected.

Example

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.