PathUtils

Added in 1.1.0

public final class PathUtils


A set of path-related utility methods.

Summary

Public methods

static @NonNull Collection<PathSegment>
@RequiresApi(value = 26)
flatten(@NonNull Path path)

Flattens (or approximate) a Path with a series of line segments using a 0.5 pixel error.

static @NonNull Collection<PathSegment>
@RequiresApi(value = 26)
flatten(@NonNull Path path, @FloatRange(from = 0) float error)

Flattens (or approximate) a Path with a series of line segments.

Public methods

flatten

Added in 1.1.0
@RequiresApi(value = 26)
public static @NonNull Collection<PathSegmentflatten(@NonNull Path path)

Flattens (or approximate) a Path with a series of line segments using a 0.5 pixel error. Note: This method requires API 26 or newer.

Parameters
@NonNull Path path

path to flatten.

See also
flatten

flatten

Added in 1.1.0
@RequiresApi(value = 26)
public static @NonNull Collection<PathSegmentflatten(@NonNull Path path, @FloatRange(from = 0) float error)

Flattens (or approximate) a Path with a series of line segments. Note: This method requires API 26 or newer.

Parameters
@NonNull Path path

path to flatten.

@FloatRange(from = 0) float error

The acceptable error for a line on the Path. Typically this would be 0.5 so that the error is less than half a pixel.

See also
approximate