 VT330/VT340 Programmer Reference Manual

# 11 Polygon Fill Command

You use the polygon fill command to draw filled-in, closed objects such as circles, ellipses, triangles, and squares. Polygon fill commands start with the key letter F. There are four basic options to the F command.

• Vector
• Curve and arc
• Position
• Temporary write controls

The polygon fill command uses the current foreground color specified to fill in figures (Chapters 2 and 3).

## Vector Option

The polygon fill command accepts all vector command options and arguments. This feature lets you draw filled-in objects such as squares, rectangles, and diamonds. Chapter 5 describes all the vector command options.

You use the following basic format of a polygon fill command with a vector option.

F(V<positions>)

where

F identifies a polygon fill command.

V identifies the vector option.

<positions> are the positions of the polygon's vertices.

Figure 11-1 shows a filled-in square and a filled-in diamond. These objects are drawn with a polygon fill command using the vector option and B suboption.

Figure 11-1 Vector Option Example COMMANDS P[50,200]F(V(B)[+100]      [,+100]      [-100]      (E))

 COMMANDS P[400,300]F(V(B)[300,200]      [200,300]      [300,400]      (E))

## Curve and Arc Option

The polygon fill command accepts all curve command options and arguments. This feature lets you draw filled-in circles, arcs, and other curved objects. Chapter 6 describes all the curve command options.

You use the following basic format for a polygon fill command with curve options.

F(C<positions>)

where

C identifies the curve option.

<positions> are coordinate values for a curve or circle. To use a curve, you include the (B) and (E) options. See Chapter 6 for the format of curve command options.

Figure 11-2 shows a filled-in ellipse and a filled-in circle. The circle is drawn using the polygon fill command with the circle option. The ellipse is drawn using the polygon fill command with the closed curve option.

Figure 11-2 Curve Option Example COMMANDS P[100,200]F(C(B)      [+200]      [,+100]      [-200]      (E))

 COMMANDS P[500,300]F(C[+100])

## Position Option

The polygon fill command accepts all position command options and arguments. Remember, position options do not draw graphic images as do the curve and vector options. You can use the position option to connect vectors, curves, and arcs. Chapter 3 describes the position command. Chapter 6 describes the curve command and its options.

You can use the P option (with the open curve function of the curve option) to set the slope at the two endpoints of an open curve. You can also use the P option to reset the cursor position before and after an arc with its center at the current position.

You use the following basic format for a polygon fill command with the position and curve options.

F(C(A+<degrees>)<position1>P<position2>...)

where

C identifies a curve option.

A identifies an arc suboption.

<degrees> specifies the number of degrees and the direction to draw the arc in.

<position1> is the point where the arc will start.

P identifies a position option.

<position2> is the new active position.

Figure 11-3 shows filled-in, connected arcs and a filled-in, connected arc and rectangle. The connected arcs are drawn with the polygon fill command, position option, and open curve option. The connected arc and rectangle are drawn with the polygon fill command, position option, vector option, and open curve option.

Figure 11-3 Position Option Example COMMANDS P[200,200]F(C(A+270)      [+50,-50]P[+100]C(A+270)      [-50,+50])

 COMMANDS P[450,300]F(C(C,A+270)      [-50]V[,+50]      [+100]      [,-100]      [-50])

## Temporary Write Controls Option

The polygon fill command accepts all write command options and arguments. There are two ways to use temporary write controls with the polygon fill command.

• as an option of the F command
• as a suboption of the C and V options

Chapter 3 describes the write control command and its options.

Temporary Write Control as an Option of the F Command

F(W(<suboption>)<options>)

where

W identifies a temporary write control option.

<suboptions> are the temporary write control values to use.

<options> are polygon fill command options that will use the temporary write control values.

Temporary Write Control as a Suboption of the C or V options

F(C(W(<sub-suboptions>)<suboptions>)<options>)

where

C identifies a curve option. You could also use a vector (V) option.

W identifies a temporary write control suboption.

<sub-suboptions> are the temporary write control values to use.

<suboptions> are the curve options and values that will use the temporary write control values.

<options> are any other polygon fill command options.

Only the last W option in a polygon fill command affects the graphic image. Other W options have no effect, because ReGIS does not draw the image until the end of the polygon fill command. The one exception is when you use pixel vector multiplication as a suboption of the W option.

Figure 11-4 shows a pie segment filled with Xs, and a filled-in box with rounded corners. The pie segment is drawn with the polygon fill command, temporary write control option (with the S suboption), vector option, and open curve option. The box with rounded corners is drawn with the polygon fill command, temporary write control option (with the I suboption), vector option, and open curve option.

Figure 11-4 Temporary Write Control Option Example COMMANDS P[200,100]F(W(I(W)),V[+100]C(C,A-90)[,+50]V[,+100]C(C,A-90)[-50]V[-100]C(C,A-90)[,-50]V[,-100]C(C,A-90)[+50])

 COMMANDS P[400,300]F(W(S"X"),V(B)[+200,-100]C(C,A+30)      [-200,+100]V(E))

## Filling Complex Polygons

You can use the commands in this chapter to fill simple or complex polygons. However, a complex polygon requires more planning. You should build your command string in steps. The following method is one example.

1. Build a ReGIS command string that draws the outline of the desired polygon. This command string may use vector, curve, and position commands. The outline should be a single, closed figure. The outline must not have any gaps or cross over itself.

2. Enclose the command string from step 1 in an F command.

F(<ReGIS command string>)

3. If you want your polygon to have a contrasting outline, you can use a macrograph.

 @:A@; ;Loads macrograph. F(@A) ;Fills polygon. @A ;Draws outline.

Chapter 9 describes the macrograph command and its options.

Figure 11-5 shows a filled paper icon with a dotted outline. This image is drawn with a polygon fill command using the curve option, vector option, temporary write control option, and macrographs.

Figure 11-5 Example of Filling a Complex Polygon COMMANDS I P[200,200]@:XV[+100]      [,+70]P[-25,-10]C(S)[+25,+10]      [-25,+10]      [-50,-20]      [-25,+10]      [+25,+10]P[-25,-10]V[,-70] @; F(W(I1),@X)

 COMMANDS II P[200,200]W(P4) @X W(P1)

## Some Points on Using the Polygon Fill Command

You should consider the following points when you use the polygon fill command.

• Vertices
You must specify at least three different vertices, or ReGIS will not draw an image. You can use up to 256 vertices. ReGIS ignores additional vertices. If you map two consecutive vertices to the same pixel, they count as one vertex.

NOTE: Each argument for the vector option creates one vertex. Each argument for the curve option can create more than one vertex.

• Closed Figures
If your commands do not create a closed polygon, the results of the polygon fill command are unpredictable.

• Perimeter
In some cases, the outline of the filled polygon may not line up exactly with the vectors that connect the same vertices. You should draw a border after the filled area.

• Single Closed Figures
You should only use the polygon fill command to fill single closed figures. The F command is not designed to fill polygons made of intersecting groups of single closed figures. Although the F command can fill these polygons, the results are unpredictable.

• Current Position
ReGIS saves the cursor position at the beginning of any polygon fill command. The cursor returns to this position at the end of the command (whether or not any drawing takes place). This feature provides some compatibility with devices that do not have the F command.

• Position Stack Options (B and E)
Any polygon fill command string that changes the position stack is not compatible with ReGIS devices that do not have the F command.

## Polygon Fill Command Summary

Table 11-1 is a summary of the F command options. There are no default values for these options.

Table 11-1 Polygon Fill Command Summary
Option Description
F(V<positions>)

Vector option
<positions> are the positions of the polygon's vertices.

F(C<positions>)

Curve option
<positions> are coordinate values for a curve or circle.

F(C(A+<degrees>) <position1> P<position2>...)

Position option (with curve option)
C identifies a curve option.
A identifies an arc suboption.
<degrees> specifies the number of degrees and the direction to draw the arc in.
<position1> is the point where the arc will start.
P identifies a position option.
<position2> is the new active position.

F(W(<suboptions>) <options>)

Temporary Write Control as an Option of the F Command
<suboptions> are the temporary write control values to use.
<options> are polygon fill command options that will use the temporary write control values.

F(C(W<sub-suboptions>) <suboptions>) <options>)

Temporary Write Control as a Suboption of the C or V Options
C identifies a curve option. You could also use a vector (V) option.
W identifies a temporary write control suboption.
<sub-suboptions> are the temporary write control values to use.
<suboptions> are the curve options and values that will use the temporary write control values.
<options> are any other polygon fill command options.