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 5 Computer Graphics Metafile

To Open and Initialize for Output

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

Syntax Examples

The following examples open and initialize the hpcgm driver and put the metafile into a file named ex.cgm:

For C Programs:

fildes = gopen("ex.cgm", OUTMETA, "hpcgm", INIT);

For Fortran77 Programs:

fildes=gopen('ex.cgm'//char(0),OUTMETA,'hpcgm'//char(0),INIT);

For Pascal Programs:

fildes = gopen('ex.cgm', OUTMETA, 'hpcgm', INIT);

Parameters for gopen

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

  • path - The name of the file that will be created by Starbase and to which hpcgm will write the metafile.

  • kind - May be OUTMETA or OUTDEV. If OUTDEV, the file named by path must already exist unless SPOOLED is specified in Mode.

  • driver - The character representation of the driver type. This is hpcgm modified to meet the syntax of the programming language used. Namely:

    "hpcgm"                
    for C.
    'hpcgm'//char(0)       
    for Fortran77.
    'hpcgm'                
    for Pascal.
  • Mode - The mode control word consisting of several flag bits that can be or ed together. Listed below are the flag bits which have device dependent action.

    • SPOOLED — Allows specifying Kind equal to OUTDEV without having Path already in existence.

    • 0 (zero) — No flag causes the device to be initialized anyway (including color map initialization).

Driver Default

There are a number of driver options that may be manipulated with the gescape function. See the “Parameters for gescape ” section in this driver for the defaults and options.

Default Color Map

While the hpcgm driver produces a metafile with color selection mode direct (RGB). It also maintains an internal color map to convert indexes to RGB. This map has 256 entries and is initialized to the default values shown below.

Table 5-1 Default Color Table

Index

Color

Red

Green

Blue

0

black

0.0

0.0

0.0

1

white

1.0

1.0

1.0

2

red

1.0

0.0

0.0

3

yellow

1.0

1.0

0.0

4

green

0.0

1.0

0.0

5

cyan

0.0

1.0

1.0

6

blue

0.0

0.0

1.0

7

magenta

1.0

0.0

1.0

8

10% gray

0.1

0.1

0.1

9

20% gray

0.2

0.2

0.2

10

30% gray

0.3

0.3

0.3

11

40% gray

0.4

0.4

0.4

12

50% gray

0.5

0.5

0.5

13

60% gray

0.6

0.6

0.6

14

70% gray

0.7

0.7

0.7

15

80% gray

0.8

0.8

0.8

16

90% gray

0.9

0.9

0.9

17

white

1.0

1.0

1.0

18-255

shaded colors

 

Selection of TOP mode (see CGMESC_TOP_MODE gescape later in this driver) changes the value of the default color table.

Table 5-2 Top Mode Default Color Table

Index

Color

Red

Green

Blue

0

black

0.0

0.0

0.0

1

white

1.0

1.0

1.0

2

red

1.0

0.0

0.0

3

green

0.0

1.0

0.0

4

blue

0.0

0.0

1.0

5

yellow

1.0

1.0

0.0

6

magenta

1.0

0.0

1.0

7

cyan

0.0

1.0

1.0

8-255

repeat colors*

 

* Index numbers 8 through 255 repeat the colors listed in index 0-7.

When INIT is used in the shade_mode procedure call, the color map initialization is based on the value of the mode parameter.

CMAP_NORMAL mode

Same as the Default Color Table.

CMAP_MONOTONIC mode

The color map is initialized as shades of gray.

CMAP_FULL mode

The color map is initialized as shades of color with three bits allocated for red, three bits allocated for green, and two bits allocated for blue.

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