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 3 Printer Command Language Formatter

Using the Graphics Print Procedures

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

The Starbase Graphics Techniques chapter "Storing, Retrieving, and Printing Images" should be read prior to reading this section. Briefly, the graphics print procedures are:

  • bitmap_print, dcbitmap_print, intbitmap_print — print from a bitmap.

  • file_print — print from a file created previously using bitmap_to_file or dcbitmap_to_file.

The user controls the output using parameters of the bitmap_print and file_print procedures and parameters in the configuration file. Except for the formatter and config parameters, all other parameters are discussed in the Starbase Graphics Techniques manual.

Specifying the Formatter and Config Parameters

The print procedures require specification of two parameters which are unique to the PCL formatter:

  1. formatter — The name that is used is "pcl".

  2. config — This should be set to the desired configuration file.

Using the bmprint Program

The program bmprint.c can be found in\Footnote The actual path names of directories in angle brackets depend on the file system structure. See the Graphics Administration Guide for details.\EndFootnote{}:

formatters〉/pcl/bmprint.c

You may desire to customize it for your application environment or to make multiple copies under different names that reference different configuration files. Essentially this program executes the gopen call on a bitmap without initializing it, allowing all or a portion of the currently displayed bitmap to be printed.

Run time parameters allow you to specify:

  • start location (-l option).

  • size of the rectangle (-s option).

  • rotation of the output print (-r option).

  • color map mode full or other (-f option).

  • print the background (-k option) (see note below).

  • set foreground and background indices (-c option).

  • set the bitmap bank to print (-b option).

  • set the display enable mask (-d).

  • select a single plane to print (-p).

You should make a copy of the source, modify it as required to reflect the configuration file and defaults you desire to use, and then compile and link it as described in the section of this chapter concerning linking.

The background (-k) option affects the resulting print in one of two ways depending upon whether a single plane is being printed or not. If a single plane is being printed and no background is selected, the foreground and background index parameters are active and specify what is to be printed (foreground) and not printed (background). In all other cases (not single plane), the actual background color index used by the formatter (the index whose printing will be suppressed) is obtained from one of two sources. In the case of a non-single plane being printed from a bitmap opened with the gopen, the formatter uses the current Starbase background index. In the case of a non-single plane being printed from a Starbase bitmap file the background index is obtained from the Starbase bitmap file being printed.

A final note on background indexes. If you decide to set the Starbase background color index prior to a bitmap_print operation and the color map's shade mode is CMAP_FULL with more than eight planes the resulting index is a 24-bit value. The upper eight bits are used for red, the center eight bits are used for blue, and the lower eight bits are used for green. You may want to use background_color rather then background_color_index providing the specific (float) red, green, and blue values rather than computing the 24-bit index.

index24 = (red_index << 16) + (green_index << 8) + blue_index

Direct Access Printing

When using direct access printing, the first parameter of the configuration file (output goes to std out parameter) should be set to FALSE. The special device file parameter of the configuration file should be set to the special device file of the printer (see the section on setting up the special device file). You must have write permission for the device file.

The following examples assume that a bitmap has been created containing the data you desire to print. In the case of bitmap_print, dcbitmap_print, and intbitmap_print calls fildes is the file descriptor of the bitmap opened with gopen. In the case of file_print, myfile.dat is the Starbase bitmap file previously created. The configuration file is config.prtr.

  1. Example of bitmap_print and dc_bitmap_print calls in C. Refer to the Starbase Reference manual for parameter descriptions.

    bitmap_print(fildes,"pcl","config.prtr",
    ALL_PLANES,TRUE, 0.0,0.0,100,100,FALSE,1,0,TRUE);

    dcbitmap_print(fildes,"pcl","config.prtr",
    ALL_PLANES,FALSE, 0.0,100,100,FALSE,1,0,TRUE);
  2. Example of a file_print call in C. Refer to the Starbase Reference manual for parameter descriptions.

    file_print(myfile.dat,"pcl","config.prtr",
    ALL_PLANES,TRUE, 1,0,TRUE);

Direct Access Using Redirection or Pipes

Access to a non-spooled printer requires an HP-UX environment (in order to use the ">" and "|" redirection and pipe symbols). The following examples use a configuration file named config.temp which has the output to a file named temp. The example special device file is 〈dev[21]/rlp. The previously prepared Starbase bitmap file is myfile.dat.

The HP-UX environment can be obtained from within a program using the HP-UX Reference, Section 3 procedure system. Similar functionality may be obtained by invoking the HP-UX Reference, Section 1 procedure pcltrans, or by running the provided bmprint program.

  1. Example of a pcltrans call. Refer to the Starbase Reference manual pcltrans procedure for parameters[22].

    pcltrans 〈parms〉 myfile.dat > 〈dev〉/rlp
  2. Example of redirection using file_print, cat, and system.

    file_print(myfile.dat,"pcl","config.temp",
    ALL_PLANES,TRUE, 1,0,TRUE);
    system("cat temp > 〈dev〉/rlp");
  3. Example of a screenpr call. Refer to the Starbase Reference manual screenpr procedure for parameters.

    screenpr -C <parms> > 〈dev〉/rlp

Spooling Examples

Spooling can be done using the HP-UX command pcltrans. Spooling may also be done utilizing the file_print, dcbitmap_print, bitmap_print, and intbitmap_print procedures in conjunction with the HP-UX procedure system. Using the system procedure, you can spool a file from within a program.

A possible sequence within a program might be to create a file using the bitmap_to_file procedure and then use the system procedure to invoke the spooler. Alternatively, a program might invoke bitmap_print with a configuration file specified that directs output to standard out in a system procedure call which also pipes the output to lp in raw mode.

The following examples are given as possible ways to spool raster graphics data from Starbase bitmaps. You should review the pertinent sections of the Starbase Reference manual for the correct calling parameters (parms).

Note that the following programming examples are written in C.

  1. Spooling from a Starbase environment using file_print (assumes the configuration file sets output to file myprint.proc and the Starbase bitmap file name is myprint.dat).

    /* create the Starbase bitmap file */
    bitmap_to_file( parms...,myprint.dat... parms);
    /* format the file, output filename is myprint.proc */
    file_print(myprint.dat, ... parms);
    /* spool the file */
    system("lp -oraw myprint.proc");
  2. Spooling from a Starbase environment (assumes the configuration file sets output to file myprint.proc) using bitmap_print.

    /* format the file - output filename is myprint.proc */
    bitmap_print(parms);
    system("lp -oraw myprint.proc");
  3. Spooling using the HP-UX command screenpr. The currently displayed bitmap will be spooled.

    screenpr -C | lp -oraw
  4. Spooling using the HP-UX command pcltrans. Assumes a Starbase bitmap file myprint.dat has been previously created.

    pcltrans -C myprint.dat | lp -oraw

Controlling Print Orientation

The default print orientation is analogous to landscape mode on a LaserJet or LaserJet Plus printer. That is, width is across the long paper dimension, and height is across the narrow paper dimension.

Print Size and Clipping

Print rows that extend beyond the last column on the physical page will generally be clipped by the printer. However, this action is printer dependent.

Print columns that extend beyond the last row on the physical page will be printed onto the next (fanfold) page.

This formatter determines the target page size based on information in the configuration file. Specifically, page_length, page_width, and resolution determine the number of dots in the output page. The cell_size parameter is used to determine the number of input pixels that will fit on the output page as follows:

output pixels across = page_width * resolution / cell_size
output pixels down = page_length * resolution / cell_size

Prints will be truncated according to the target page size by the formatter. The following example may help clarify this.

Request to print the entire frame buffer

Source frame buffer width = 1280 pixels
Source frame buffer height = 1024 pixels

Page width = 8.0 in
Page length = 10.5 in
Resolution = 180 dots per inch

if cell_size = 2 then
available output pixels across = 8.0 * 180 / 2 = 720
available output pixels down = 10.5 * 180 / 2 = 945
result 720 < 1280 and 945 < 1024 truncate in both dimensions

if cell size = 1 then
available output pixels across = 8.0 * 180 / 1 = 1400
available output pixels down = 10.5 * 180 / 1 = 1890
result 1400 > 1280 and 1890 > 1024 no truncation


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

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

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