public static final class

LayoutPathImpl.SegmentPathBuilder

extends Object
java.lang.Object
   ↳ sun.font.LayoutPathImpl.SegmentPathBuilder

Class Overview

Use to build a SegmentPath. This takes the data and preanalyzes it for information that the SegmentPath needs, then constructs a SegmentPath from that. Mainly, this lets SegmentPath cache the lengths along the path to each line segment, and so avoid calculating them over and over.

Summary

Public Constructors
LayoutPathImpl.SegmentPathBuilder()
Construct a SegmentPathBuilder.
Public Methods
LayoutPathImpl.SegmentPath build(LayoutPathImpl.EndType etype, double... pts)
Automatically build from a list of points represented by pairs of doubles.
LayoutPathImpl.SegmentPath complete()
LayoutPathImpl.SegmentPath complete(LayoutPathImpl.EndType etype)
Complete building a SegmentPath.
void lineTo(double x, double y)
Connect to a new point.
void moveTo(double x, double y)
Move to a new point.
void reset(int datalen)
Reset the builder for a new path.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public LayoutPathImpl.SegmentPathBuilder ()

Construct a SegmentPathBuilder.

Public Methods

public LayoutPathImpl.SegmentPath build (LayoutPathImpl.EndType etype, double... pts)

Automatically build from a list of points represented by pairs of doubles. Initial advance is zero.

public LayoutPathImpl.SegmentPath complete ()

public LayoutPathImpl.SegmentPath complete (LayoutPathImpl.EndType etype)

Complete building a SegmentPath. Once this is called, the builder is restored to its initial state and information about the previous path is released. The end type indicates whether to treat the path as closed, extended, or pinned.

public void lineTo (double x, double y)

Connect to a new point. If there is no data, the previous point is presumed to be 0, 0. This point is checked against the previous point, and if different, this point is added to the path and the advance extended. If this point is the same as the previous point, the path remains unchanged.

public void moveTo (double x, double y)

Move to a new point. If there is no data, this will become the first point. If there is data, and the previous call was a lineTo, this point is checked against the previous point, and if different, this starts a new segment at the same advance as the end of the last segment. If there is data, and the previous call was a moveTo, this replaces the point used for that previous call. Calling this is optional, lineTo will suffice and the initial point will be set to 0, 0.

public void reset (int datalen)

Reset the builder for a new path. Datalen is a hint of how many points will be in the path, and the working buffer will be sized to accomodate at least this number of points. If datalen is zero, the working buffer is freed (it will be allocated on first use).