Set Fill Mode
Purpose
The Set Fill Mode function changes the way subsequent drawing operations are rendered, either by coloring in the interiors of regions or by rendering only the outline of regions.
Syntax
Opcode format | Opcode
[ASCII] (Hex) |
Operand Format | Comments |
Single-byte, readable operand | [F] (46) | None | Turn Fill Mode ON. |
[f] (66) | None | Turn Fill Mode OFF. |
Description
Certain drawing opcodes (such as Draw Polyline/Polygon, Draw Circle/Circular Arc/Circular Wedge, and Draw Ellipse/Elliptical Arc/Elliptical Wedge) define 2D regions. The "Set Fill Mode" attribute changes the way these regions are rendered. With Fill mode activated, the interiors of subsequent regions are rendered in the current color. With "Fill Mode" inactive, the outlining edges of subsequent regions are rendered using the polyline attributes.
Notes
When filling self-intersecting regions, the DWF reading application should follow the even-odd rule as shown in figure 1.
Figure 1. The even-odd rule applied to regions
Using the even-odd rule an infinitely long horizontal ray is passed through the object (from left to right) and the number of intersections made with region edges is counted. For regions where the edge intersection count is an odd number, the region is colored. Even edge counts indicate regions that are not rendered.
It is not possible to render both the interior of a region, and a visibly different edge of the region in the same drawing operation. To accomplish this effect, a series of drawing and attribute opcodes must be used. For example, to draw a red triangle with a black outlining edge, you can use the following DWF codes:
(Color 255,0,0,255) Set the color to red
F Turn on Fill mode
P 3 0,0 10,0 5,5 Draw a triangle
(Color 0,0,0,255) Set the color to black
f Turn off Fill mode
P 4 0,0 10,0 5,5 0,0 Four points specifies three line segments
Default
By default the "Fill Mode" attribute is off, which is the equivalent of executing the following opcode:
f
Implementation in WHIP! Versions
Toolkit Function |
TBD |
Partial |
Full |
Revised in |
Set Fill Mode |
- |
- |
1.03 |
- |
See Also