Table of Contents

Class PdfSubpath

Namespace
UglyToad.PdfPig.Core
Assembly
UglyToad.PdfPig.Core.dll

A supbpath is made up of a sequence of connected segments.

public class PdfSubpath
Inheritance
PdfSubpath
Inherited Members

Constructors

PdfSubpath()

public PdfSubpath()

Properties

Commands

The sequence of commands which form this PdfSubpath.

public IReadOnlyList<PdfSubpath.IPathCommand> Commands { get; }

Property Value

IReadOnlyList<PdfSubpath.IPathCommand>

IsClockwise

Return true if points are organised in a clockwise order. Works only with closed paths.

public bool IsClockwise { get; }

Property Value

bool

IsCounterClockwise

Return true if points are organised in a counterclockwise order. Works only with closed paths.

public bool IsCounterClockwise { get; }

Property Value

bool

IsDrawnAsRectangle

True if the PdfSubpath was originaly drawn using the rectangle ('re') operator.

Always false if paths are clipped.

public bool IsDrawnAsRectangle { get; }

Property Value

bool

Methods

BezierCurveTo(double, double, double, double, double, double)

Add a PdfSubpath.BezierCurve to the path.

public void BezierCurveTo(double x1, double y1, double x2, double y2, double x3, double y3)

Parameters

x1 double
y1 double
x2 double
y2 double
x3 double
y3 double

CloseSubpath()

Close the path.

public void CloseSubpath()

Equals(object)

Compares two PdfSubpaths for equality. Paths will only be considered equal if the commands which construct the paths are in the same order.

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetBoundingRectangle()

Gets a PdfRectangle which entirely contains the geometry of the defined subpath.

public PdfRectangle? GetBoundingRectangle()

Returns

PdfRectangle?

For subpaths which don't define any geometry this returns null.

GetBoundingRectangle(IReadOnlyList<PdfSubpath>)

Gets a PdfRectangle which entirely contains the geometry of the defined path.

public static PdfRectangle? GetBoundingRectangle(IReadOnlyList<PdfSubpath> path)

Parameters

path IReadOnlyList<PdfSubpath>

Returns

PdfRectangle?

For paths which don't define any geometry this returns null.

GetCentroid()

Get the PdfSubpath's centroid point.

public PdfPoint GetCentroid()

Returns

PdfPoint

GetDrawnRectangle()

If IsDrawnAsRectangle then returns the rectangle dimensions specified. Otherwise returns null.

public PdfRectangle? GetDrawnRectangle()

Returns

PdfRectangle?

Remarks

Since a rectangle is interpreted as a move command followed by 3 lines and a close command this condenses the 5 commands back into a single rectangle.

GetHashCode()

Get the hash code. Paths will only have the same hash code if the commands which construct the paths are in the same order.

public override int GetHashCode()

Returns

int

IsClosed()

Determines if the path is currently closed.

public bool IsClosed()

Returns

bool

LineTo(double, double)

Add a PdfSubpath.Line command to the path.

public void LineTo(double x, double y)

Parameters

x double
y double

MoveTo(double, double)

Add a PdfSubpath.Move command to the path.

public void MoveTo(double x, double y)

Parameters

x double
y double

Rectangle(double, double, double, double)

Add a rectangle following the pdf specification (m, l, l, l, c) path. A new subpath is created.

public void Rectangle(double x, double y, double width, double height)

Parameters

x double
y double
width double
height double