### Frame Styles

The frame of the geometry is drawn using the following attributes: IPaint, IColorTransferMode, IPen, IJoint, and ICap. IPaint and IColorTransferMode apply to both the frame and the inside of the geometry while IPen, IJoint, and ICap define the frame of the geometry.

This section describes the classes that define frame styles of the geometry.

### IPen

IPen is a concrete class that describes how to frame the edge of a geometry. IPen defines a pen by a pen width, pen balance, and pen type. By default, it is a centered-solid pen.

#### Pen width

Width is a floating-point value that represents the device-independent width of the pen in coordinate units. A centered-frame pen of a width can be thought of as using a pen with a flat nib of the specified pen width, and drawing a curve with the nib perpendicular to the direction of the curve with the center of the nib on the curve. In the figure, the "perpendicular sweep line" is the flat nib:

#### Balance

The enumerated type EPenBalance has the following values:

- kCenteredFrame
- kInsetFrame

For kCenteredFrame, the pen is centered over the border of the geometry for path and area-enclosing geometries.

For kInsetFrame, the pen fits exactly along the inside edge of a fill and covers the edge-fill pixels of a filled area-enclosing geometry as shown in the figure:

The kInsetFrame value is useful for specifying the outside edge of a frame with pixel perfection rules. The kInsetFrame value describes a pen (of the pen width specified in the base class) on the inside of the edge of the geometry. The kInsetframe value is only used for geometries that can be filled. When a geometry object to frame is not fillable, the pen behaves as a center framed IPen. An IPen kInsetFrame applied to IGLine2D, IGPolyline2D, and IGCurve2D always behaves as a center framed IPen.

#### Pen Types

The enumerated type EPenType defines the values of different pen styles:

- kHairline
- kSolid
- kDashed
- kDot, kDashDot
- kDashDotDot
- kInvisible
- kUnknownPen

NOTE: The simplest pen style is kHairline. The kHairline style means the device renders a geometry frame using the fastest possible means. End caps, joints, and transfer modes are not applied to an IPen kHairline. Use the kHairline style only when speed is more important than accuracy. The only constraint placed on a hairline pen is that it must render within 1 pixel from the edge of a geometry.

The following figure shows some of the pen styles available:

NOTE: The layout of the patterns of these pens is not predictable because the underlying platform support is not consistent.

The kDashed, kDot, kDashDot, and kDashDotDot pen styles work only when pen width is one or less.

### IJoint

The joint style controls the rendering of sharp points. Every sharp point causes a gap to occur between the edges of the frame
(C1 discontinuity). The IJoint class determines how to fill the gap of a sharp joint.

The enumerated type EJointType defines the standard joint styles as follows:

- kBevel
- kMiterLimit
- kRound
- kUnknownJoint.

The following figure shows the standard joint styles:

The bevel joint style (kBevel) simply closes the gap between one edge and the next with a triangle.

The miter joint style (kMiterLimit) takes the two pens, and continues running in the original directions until the outside edges meet. The miter joint style has limitations. As the angle of the joint becomes greater, the limitation of what the joint can become when rendered is not predictable. On Windows platforms, it is dependent on the GDI device drivers.

The round joint style (kRound) puts a conic section in the gap such that tangent continuity is maintained.

### ICap

ICap places a cap at the start, at the end, or at an interior discontinuity (C0 discontinuity) of the frame of a linear geometry (IGLine2D, IGPolyline2D, IGCurve2D). Caps are not used on area geometries (IGRect2D, IGEllipse2D, IGPolygon2D, IGLoop2D, IGArea).

The enumerated type ECapType defines the supported cap styles:

- kFlush: A flush end cap does nothing.
- kSquare
- kRound
- kUnknownCap

The figure shows the supported cap styles:

A flush end cap (kFlush) does nothing.

A square cap (kSquare) extends the curve in a straight line by half the pen width.

A round cap (kRound) puts a semi-circle at the start or end of the curve.