VT100.net 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.

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
FILLED SQUARE
COMMANDS
P[50,200]
F(V(B)[+100]
      [,+100]
      [-100]
      (E))
    
FILLED DIAMOND
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
FILLED ELLIPSE
COMMANDS
P[100,200]
F(C(B)
      [+200]
      [,+100]
      [-200]
      (E))
    
FILLED CIRCLE
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
FILLED, CONNECTED ARCS
COMMANDS
P[200,200]
F(C(A+270)
      [+50,-50]
P[+100]
C(A+270)
      [-50,+50])
 
    
FILLED, CONNECTED ARC AND RECTANGLE
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.

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
FILLED WHITE BOX WITH ROUNDED CORNERS
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])
    
PIE SEGMENT FILLED WITH Xs
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<ReGIS commands>@; ;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
FILLED PAPER ICON
COMMANDS I
P[200,200]
@:X
V[+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)
    
PAPER ICON OUTLINE
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.

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.