Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Starbase Device Drivers Manual - Vol2: HP 9000 Series 700 Computers > Chapter 2 The CADplt2 Device Driver

To Open and Initialize for Output

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

Syntax Example

C programs[12]:

fildes = gopen("〈dev〉/plt", OUTDEV, "CADplt2", RESET_DEVICE);

fildes = gopen("〈dev〉/plt", OUTDEV, "CADplt2", RESET_DEVICE);

FORTRAN 77 programs:

fildes = gopen('〈dev〉/plt'//char(0), OUTDEV, 'CADplt2'//char(0), RESET_DEVICE)

fildes = gopen('〈dev〉/plt'//char(0), OUTDEV, 'CADplt2'//char(0), RESET_DEVICE)

Pascal programs:

fildes := gopen('〈dev〉/plt', OUTDEV, 'CADplt2', RESET_DEVICE);

fildes := gopen('〈dev〉/plt', OUTDEV, 'CADplt2', RESET_DEVICE);

Parameters for gopen

The gopen procedure has four parameters: path, kind, driver, mode.

  • path - This is the name of the special device file created by the mknod command as specified in the section "Special Device Files" such as 〈dev/plt.

  • kind - This indicates the I/O characteristics of the device. This parameter may only be OUTDEV.

  • driver - This is the character representation of the driver type. This must be CADplt2.

  • mode - This is the mode control word which consists of several flag bits which are or ed together. Listed below are the flag bits and their device dependent actions:

    • SPOOLED - Open the device for spooled operation.

    • 0 (zero) - Open the device but do nothing else.

    • INIT - Open and initialize the device in a device dependent manner. For this device driver the INIT mode will send the HP-GL/2 command DF to the device. This command will not change the following:

      • P1 and P2

      • media type and quality level

      • 90 degree rotation or axis alignment

    • RESET_DEVICE - Open and completely initialize the device. For this device driver the RESET_DEVICE mode will send the HP-GL/2 command IN to the device. This command will reset the device's configuration including P1 and P2.

    • THREE_D - Open the device for three-dimensional primitives.

PCL Context Switching

The CADplt2 driver can be used with devices that support HP-GL/2 and PCL (Printer Control Language). The driver will context switch the device into HP-GL/2 mode by sending the escape sequence EC%-IB before sending any HP-GL/2 commands. On devices which do not support PCL (pen plotters) the context switch command will be ignored.

Encoded Polyline Command (PE)

The CADplt2 driver makes extensive use of the HP-GL/2 command PE. This command provides move, draw, pen-up, pen-down, and select pen functionality in an encoded format. Spoolfile size may be significantly reduced depending on the mix of output primitives, resulting in much improved plotting times.

Device Defaults

Color Table

The HP-GL/2 default color table is the same as the Starbase default color table. The exception to this is that entry 0 is white (no pen) and entry 1 is black[13]. To read the current color table values, use the inquire_color_table procedure.

Color output results may differ depending on the device used. The color electrostatic plotter will achieve the truest color reproductions. It can reproduce a wide spectrum of colors since it has an arbitrary number of definable pens.

Black and white electrostatic plotters can only reproduce color map entries 0 for white and 1 for black. Any other color selection will result in either white or black.

Pen plotters may produce different results based on the colors the device has available. Pen plotters have a set number of physical pens. The color map should be resized and redefined to reflect the physical number of pens and pen colors in the following steps.

  1. gopen the device.

  2. Set the color map size using the gescape HPGL2_SET_CMAP_SIZE (Nine pens, 0 equals no pen, 1-8 are real pens).

  3. Set the color map entries with the Starbase routine define_color_table to the red, green and blue values of the physical pens of the device.

NOTE: If colors are selected by red, green, and blue values, Starbase will try to match the actual color map values as closely as possible using a "square root of the sum of the squares" algorithm.

The default color map has 64 entries with 17 shown in the following table (entries 18-63 are various color shades defined by Starbase).

Table 2-2 Default Color Map

Pen

Color

0

white

1

black

2

red

3

yellow

4

green

5

cyan

6

blue

7

magenta

8

10% gray

9

20% gray

10

30% gray

11

40% gray

12

50% gray

13

60% gray

14

70% gray

15

80% gray

16

90% gray

17

white

 

You can redefine the default color map size and contexts using the gescape HPGL2_SET_CMAP_SIZE and the Starbase routine define_color_table.

Defining, redefining, and sizing the color map will not increase the size of the spooled files.

Red, Green, and Blue Values

Functions that take red, green, and blue values as arguments are supported. Starbase chooses the pen that most closely corresponds in value to the red, green, and blue values selected using the color map entries and sends the color map index to the driver. A "square root of sum of squares" algorithm is used to identify the pen.

Each Starbase routine that selects color has two variants: (a) one takes a color map, and (b) the other takes a red, green, and blue triplet. See Starbase Reference manual for more information on color selection routines.

Device Coordinate System

HP-GL/2 is a single quadrant coordinate system, as opposed to HP-GL which is a four quadrant system. The default P1, P2 limits for the CADplt2 driver operating in this coordinate system are P1=0, 0, P2=35376, 24000, equal to the D-sized paper in a 7600/240D electrostatic plotter. Since plotter-unit size is not device dependent, these coordinates are correct for any HP-GL/2 plotter with D-sized paper.

  • Non-spooled

    When opening the device directly (non-spooled), the driver will inquire the device's P1, P2 limits and use them unmodified. You may use set_p1_p2 to change the P1, P2 limits.

  • Spooled Mode

    If the device is opened in a spooled mode, the driver will put the plotter into scaled mode, isotropically scaling the D-sized coordinates into the maximum plotting area available. Again, clipping will be avoided. However, if you use set_p1_p2 with the metric option while in spooled mode, the scaling will be turned off and clipping may result.

Device ID

If the device is not in SPOOLED mode, the device driver will send the HP-GL/2 command OI and use the returned string as the device ID. If the device is spooled, the device ID will be CADplt2.

Line Types

All the Starbase line types are supported in the CADplt2 driver. (Index 4, DASH_DOT_DOT, not supported in the CADplt or HP-GL driver, is supported in the CADplt2 driver.)

The following table shows the default line types CADplt2 supports.

Table 2-3 Line Types

Index

Type

0

SOLID

1

DASH

2

DOT

3

DASH_DOT

4

DASH_DOT_DOT

5

LONG_DASH

6

CENTER_DASH

7

CENTER_DASH_DASH

 

The gescape HPGL2_ADAPTIVE_LINES[14] selects either fixed (default) or adaptive line types. An adaptive line type "fits" the pattern between endpoints to insure an integer number of patterns; thus, endpoints always have a line drawn to them. Fixed line types resemble lines on a raster display, where the pattern is not fitted but wrapped around the object. In this configuration, endpoints could show up in a "move" rather than "draw" region of the pattern.

P1 and P2

The values for P1 and P2 are device dependent and will vary depending on the gopen mode that was used when accessing the device as below:

  • INIT or 0 mode

    The values of P1 and P2 will be equal to the current values set on the device. The device driver will inquire these values and use them unmodified. When a device is opened in this mode, it is your responsibility to insure that appropriate P1 and P2 values are currently established.

  • RESET_DEVICE mode

    The HP-GL/2 command IN will be sent to the plotter. This will cause the device to reset P1 and P2 to the hard clip limits to take advantage of the full size of the paper that is currently loaded. The device driver will then inquire these values and use them. This mode insures that the current values of P1 and P2 will match the paper size that is loaded.

  • SPOOLED mode

    Since the device driver cannot inquire the P1 and P2 values from the device, the driver assumes the limits as:

    P1 x:  0, P1 y:  0
    P2 x: 35376, P2 y: 24000

    The limits are the same for HP 7600/240D electrostatic plotter. The device driver will then put the HP-GL/2 command SC in the spool file. This will cause the device to scale the assumed P1 and P2 values to the actual P1 and P2 values in effect when the spooled file is dumped to the device. The effect of the scaling command is to cause the entire drawing to be expanded or compressed isotropically so that it will fill the P1 and P2 extent of the device. In order to turn off the scaling function, the Starbase procedure set_p1_p2 with METRIC units must be called.

NOTE: HP-GL/2 devices will scale isotropically, yielding no distortion of the plot in spooled mode.

Timeouts

An initial timeout of 10 seconds is used when the procedure gopen is called. If the device is accessed correctly by the gopen call within the timeout, the timeout is removed completely for all further action. Should the device be taken off line or fail after a successful gopen call, the device driver can "hang" indefinitely during operation.



[12] The actual path names of directories in angle brackets depend on the file system structure. See the Graphics Administration Guide for details.

[13] Electrostatic plotters can plot white (no pen) over an area already plotted in another color.

[14] Warning: Adaptive line types may produce solid-looking lines when used with primitives such as circles, which are rendered by using many small line segments. The pattern will "adapt" to each small line segment.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.