import '../../../assert/js/assert.js';
import '../../../globals.js';
/**
 * A Canvas-style stateful (mutable) subpath, which tracks segments in addition to the points.
 *
 * See http://www.w3.org/TR/2dcontext/#concept-path
 * for the path / subpath Canvas concept.
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import TinyEmitter from '../../../axon/js/TinyEmitter.js';
import Bounds2 from '../../../dot/js/Bounds2.js';
import Matrix3 from '../../../dot/js/Matrix3.js';
import Vector2 from '../../../dot/js/Vector2.js';
import { ClosestToPointResult, Line, LineStyles, PiecewiseLinearOptions, Segment, SerializedSegment } from '../imports.js';
export type SerializedSubpath = {
    type: 'Subpath';
    segments: SerializedSegment[];
    points: {
        x: number;
        y: number;
    }[];
    closed: boolean;
};
declare class Subpath {
    segments: Segment[];
    points: Vector2[];
    closed: boolean;
    readonly invalidatedEmitter: TinyEmitter<[]>;
    _bounds: Bounds2 | null;
    private _strokedSubpaths;
    private _strokedSubpathsComputed;
    private _strokedStyles;
    private _invalidatingPoints;
    private readonly _invalidateListener;
    /**
     * NOTE: No arguments required (they are usually used for copy() usage or creation with new segments)
     */
    constructor(segments?: Segment[], points?: Vector2[], closed?: boolean);
    /**
     * Returns the bounds of this subpath. It is the bounding-box union of the bounds of each segment contained.
     */
    getBounds(): Bounds2;
    get bounds(): Bounds2;
    /**
     * Returns the (sometimes approximate) arc length of the subpath.
     */
    getArcLength(distanceEpsilon?: number, curveEpsilon?: number, maxLevels?: number): number;
    /**
     * Returns an immutable copy of this subpath
     */
    copy(): Subpath;
    /**
     * Invalidates all segments (then ourself), since some points in segments may have been changed.
     */
    invalidatePoints(): void;
    /**
     * Trigger invalidation (usually for our Shape)
     * (kite-internal)
     */
    invalidate(): void;
    /**
     * Adds a point to this subpath
     */
    addPoint(point: Vector2): this;
    /**
     * Adds a segment directly
     *
     * CAUTION: REALLY! Make sure we invalidate() after this is called
     */
    private addSegmentDirectly;
    /**
     * Adds a segment to this subpath
     */
    addSegment(segment: Segment): this;
    /**
     * Adds a line segment from the start to end (if non-zero length) and marks the subpath as closed.
     * NOTE: normally you just want to mark the subpath as closed, and not generate the closing segment this way?
     */
    addClosingSegment(): void;
    /**
     * Sets this subpath to be a closed path
     */
    close(): void;
    /**
     * Returns the numbers of points in this subpath
     *
     * TODO: This is a confusing name! It should be getNumPoints() or something https://github.com/phetsims/kite/issues/76
     */
    getLength(): number;
    /**
     * Returns the first point of this subpath
     */
    getFirstPoint(): Vector2;
    /**
     * Returns the last point of this subpath
     */
    getLastPoint(): Vector2;
    /**
     * Returns the first segment of this subpath
     */
    getFirstSegment(): Segment;
    /**
     * Returns the last segment of this subpath
     */
    getLastSegment(): Segment;
    /**
     * Returns segments that include the "filled" area, which may include an extra closing segment if necessary.
     */
    getFillSegments(): Segment[];
    /**
     * Determines if this subpath is drawable, i.e. if it contains asny segments
     */
    isDrawable(): boolean;
    /**
     * Determines if this subpath is a closed path, i.e. if the flag is set to closed
     */
    isClosed(): boolean;
    /**
     * Determines if this subpath is a closed path, i.e. if it has a closed segment
     */
    hasClosingSegment(): boolean;
    /**
     * Returns a line that would close this subpath
     */
    getClosingSegment(): Line;
    /**
     * Returns an array of potential closest points on the subpath to the given point.
     */
    getClosestPoints(point: Vector2): ClosestToPointResult[];
    /**
     * Draws the segment to the 2D Canvas context, assuming the context's current location is already at the start point
     */
    writeToContext(context: CanvasRenderingContext2D): void;
    /**
     * Converts this subpath to a new subpath made of many line segments (approximating the current subpath)
     */
    toPiecewiseLinear(options: PiecewiseLinearOptions): Subpath;
    /**
     * Returns a copy of this Subpath transformed with the given matrix.
     */
    transformed(matrix: Matrix3): Subpath;
    /**
     * Converts this subpath to a new subpath made of many line segments (approximating the current subpath) with the
     * transformation applied.
     */
    nonlinearTransformed(options: PiecewiseLinearOptions): Subpath;
    /**
     * Returns the bounds of this subpath when transform by a matrix.
     */
    getBoundsWithTransform(matrix: Matrix3): Bounds2;
    /**
     * Returns a subpath that is offset from this subpath by a distance
     *
     * TODO: Resolve the bug with the inside-line-join overlap. We have the intersection handling now (potentially) https://github.com/phetsims/kite/issues/76
     */
    offset(distance: number): Subpath;
    /**
     * Returns an array of subpaths (one if open, two if closed) that represent a stroked copy of this subpath.
     */
    stroked(lineStyles: LineStyles): Subpath[];
    /**
     * Returns a copy of this subpath with the dash "holes" removed (has many subpaths usually).
     *
     * @param lineDash
     * @param lineDashOffset
     * @param distanceEpsilon - controls level of subdivision by attempting to ensure a maximum (squared) deviation from the curve
     * @param curveEpsilon - controls level of subdivision by attempting to ensure a maximum curvature change between segments
     */
    dashed(lineDash: number[], lineDashOffset: number, distanceEpsilon: number, curveEpsilon: number): Subpath[];
    /**
     * Returns an object form that can be turned back into a segment with the corresponding deserialize method.
     */
    serialize(): SerializedSubpath;
    /**
     * Returns a Subpath from the serialized representation.
     */
    static deserialize(obj: SerializedSubpath): Subpath;
}
export default Subpath;
//# sourceMappingURL=Subpath.d.ts.map