Top  | Previous | Next

Fill and Stroke

All shapes have three properties that affect how they look. The Fill Paint is a property of type Paint that represents the interior color of the shape. The Stroke Paint property (also a Paint) represents the color of the shape's outline. The Stoke Style property is a property of type Stroke that affects the thickness, corners, and dash properties of the shape's outline.

 

Editing Paints

Both the fill and stroke paints can be a variety of different kinds of paints. To edit a shape's fill or stroke paint, you can either use the paint dropdown in the property editor table by clicking on the pencil icon (pencil) or open up the dedicated Fill and Stroke panel from the View menu.

 

Editing a shape's fill paint using the dropdown editor.

Editing a shape's fill paint using the dropdown editor.

 

Paint Types

The top of the paint editor is a selection area that allows you to choose between the five different kinds of paints.

 

The five different paint types demonstrated as triangle fill paints.

The five different paint types demonstrated as triangle fill paints.

 

1.The first paint type is no paint (paint_none). If used as a fill paint, then the interior of the shape will be transparent. If used as the stroke paint, then the paint's outline will not be drawn at.
2.The second paint type is a solid color (paint_solid). This paint type is equivalent to the Color type used elsewhere throughout the component library. A solid color is any color, including an alpha (transparency) level.
3.The third paint type is a linear gradient (paint_linear). Linear gradients smoothly blend any number of colors along a straight line across the shape. Each color is called a Stop. Each stop is represented as a drag-able control on a horizontal preview of the gradient in the gradient editor. You can click on a stop to select it and change its color or drag it to reposition it. You can right click on it to remove it. You can right click on the preview strip to add new stops and change the gradient's cycle mode.
4.The fourth paint type is the radial gradient (paint_radial). Radial paints are very much like linear paints except that the colors emanate from a point creating an ellipse of each hue. Radial paints are configured in the same way as linear paints.
5.The fifth paint type is the pattern paint (paint_pattern). This paint uses a repeating pixel-pattern with two different colors. You can pick a pattern from the dropdown or create your own using the built-in pattern editor.

 

Gradient Paint Bounds

The two gradient paints are more than a list of colored stops; they also need to be placed relative to the shape. The same gradient may look wildly different depending on how it is placed against the shape. By default, a linear gradient will run horizontally across the width of the entire shape, but this is readily changed. By switching to the Gradient Tool (gradient_editor), you can drag around handles that control how the gradient is applied.

 

The same gradient, applied differently to the same shape.

The same gradient, applied differently to the same shape.

Gradient Cycles

The two gradient paints (linear and radial) both have a cycle mode that you can change by right-clicking within the preview strip. The cycle modes are illustrated below:

gradint_cycle_mode

1.No Cycle. The first and last stops are repeated forever after the edge of the paint bounds.
2.Reflect. Beyond the bounds of the paint, it will be reflected and drawn in reverse, and then reflected again, creating a smooth repetition.
3.Repeat. Beyond the bounds of the paint, it will be repeated forever.

 

Stroke Style

A shape's stroke paint is only half the story. The stroke style is also an important component of how an outline is drawn. Primarily the style controls the thickness of the line drawn, but it also can be used to create a dashed line. The setting for thickness is specified in pixels, and creating a dashed line is as easy as picking the style from the list.

 

The effect the thickness and dash pattern settings is fairly self-explanatory, but the other stroke settings are a bit more subtle. You can notice their effect more readily on thick lines.

 

Cap styles

Cap styles

Cap style is a setting that controls what happens at the end of a line segment. You can either have the line simply be terminated with no decoration (#1), Round off the end with a semi-circle (#2), or cap the end with a square (#3).

 

Join styles

Join styles

Join style is a setting that affects how a line is drawn where two segments meet ( a corner ). The default setting is called a miter join (#1), where the stroke is extended into a point to make a sharp corner. The other options are rounded corners (#2) or beveled edge corners (#3).

 

Miter length illustrated

Miter length illustrated

Miter style joins can become a problem for very sharp angles. With a sufficiently sharp angle, the miter decoration can become extremely long. To control this, there is a miter length setting to limit the length of a miter decoration. The illustration on the left shows the same miter join with two different miter length settings. The first drawing illustrates the length of the miter join.