Table of Contents

Struct DrawingClipState

Namespace
SixLabors.ImageSharp.Drawing.Processing
Assembly
SixLabors.ImageSharp.Drawing.dll

Represents an ordered set of exact clip primitives carried by a drawing command.

public readonly struct DrawingClipState
Inherited Members

Properties

Count

Gets the number of clip descriptors in stack order.

public int Count { get; }

Property Value

int

Empty

Gets an empty clip state.

public static DrawingClipState Empty { get; }

Property Value

DrawingClipState

HasClips

Gets a value indicating whether this state carries any clips.

public bool HasClips { get; }

Property Value

bool

Methods

Append(DrawingClipDescriptor)

Appends one clip descriptor.

public DrawingClipState Append(DrawingClipDescriptor descriptor)

Parameters

descriptor DrawingClipDescriptor

The descriptor to append.

Returns

DrawingClipState

The updated clip state.

Append(DrawingClipState)

Appends all descriptors from another state.

public DrawingClipState Append(DrawingClipState state)

Parameters

state DrawingClipState

The clip state to append.

Returns

DrawingClipState

The updated clip state.

FromPaths(IReadOnlyList<IPath>, ClipOperation, DrawingClipEdgeMode)

Creates a clip state from path operands.

public static DrawingClipState FromPaths(IReadOnlyList<IPath> paths, ClipOperation operation, DrawingClipEdgeMode edgeMode)

Parameters

paths IReadOnlyList<IPath>

The clip paths.

operation ClipOperation

The operation used to combine the paths with the existing clip.

edgeMode DrawingClipEdgeMode

The clip edge mode.

Returns

DrawingClipState

The normalized clip state.

GetDescriptor(int)

Gets one descriptor by stack order.

public DrawingClipDescriptor GetDescriptor(int index)

Parameters

index int

The descriptor index.

Returns

DrawingClipDescriptor

The descriptor at the requested index.

Transform(Matrix4x4)

Transforms this clip state.

public DrawingClipState Transform(Matrix4x4 matrix)

Parameters

matrix Matrix4x4

The transform matrix.

Returns

DrawingClipState

The transformed clip state.

Translate(Vector2)

Translates this clip state.

public DrawingClipState Translate(Vector2 offset)

Parameters

offset Vector2

The translation offset.

Returns

DrawingClipState

The translated clip state.

TryGetConservativeBounds(Point, out Rectangle)

Gets conservative integer bounds for intersection descriptors in absolute target coordinates.

public bool TryGetConservativeBounds(Point destinationOffset, out Rectangle bounds)

Parameters

destinationOffset Point

The absolute destination offset for the owning command.

bounds Rectangle

The conservative bounds.

Returns

bool

true when at least one intersection descriptor has clip bounds.

TryGetTargetBoundsClip(Point, out Rectangle)

Gets bounds for a single pixel-aligned clip that can be represented entirely by target bounds.

public bool TryGetTargetBoundsClip(Point destinationOffset, out Rectangle bounds)

Parameters

destinationOffset Point

The absolute destination offset for the owning canvas state.

bounds Rectangle

The exact integer clip bounds.

Returns

bool

true when this state contains only one pixel-aligned rectangle clip.