AndroidPath


Summary

Public constructors

AndroidPath(internalPath: Path)
android

Public functions

open Unit
addArc(oval: Rect, startAngleDegrees: Float, sweepAngleDegrees: Float)

Adds a new subpath with one arc segment that consists of the arc that follows the edge of the oval bounded by the given rectangle, from startAngle degrees around the oval up to startAngle + sweepAngle degrees around the oval, with zero degrees being the point on the right hand side of the oval that crosses the horizontal line that intersects the center of the rectangle and with positive angles going clockwise around the oval.

android
open Unit
addArcRad(oval: Rect, startAngleRadians: Float, sweepAngleRadians: Float)

Adds a new subpath with one arc segment that consists of the arc that follows the edge of the oval bounded by the given rectangle, from startAngle radians around the oval up to startAngle + sweepAngle radians around the oval, with zero radians being the point on the right hand side of the oval that crosses the horizontal line that intersects the center of the rectangle and with positive angles going clockwise around the oval.

android
open Unit
addOval(oval: Rect)

Adds a new subpath that consists of a curve that forms the ellipse that fills the given rectangle.

android
open Unit
addOval(oval: Rect, direction: Path.Direction)

Adds a new subpath that consists of a curve that forms the ellipse that fills the given rectangle.

android
open Unit
addPath(path: Path, offset: Offset)

Adds a new subpath that consists of the given path offset by the given offset.

android
open Unit
addRect(rect: Rect)

Adds a new subpath that consists of four lines that outline the given rectangle.

android
open Unit
addRect(rect: Rect, direction: Path.Direction)

Adds a new subpath that consists of four lines that outline the given rectangle.

android
open Unit
addRoundRect(roundRect: RoundRect)

Add a round rectangle shape to the path from the given RoundRect.

android
open Unit
addRoundRect(roundRect: RoundRect, direction: Path.Direction)

Add a round rectangle shape to the path from the given RoundRect.

android
open Unit
arcTo(
    rect: Rect,
    startAngleDegrees: Float,
    sweepAngleDegrees: Float,
    forceMoveTo: Boolean
)

If the forceMoveTo argument is false, adds a straight line segment and an arc segment.

android
open Unit

Closes the last subpath, as if a straight line had been drawn from the current point to the first point of the subpath.

android
open Unit
cubicTo(x1: Float, y1: Float, x2: Float, y2: Float, x3: Float, y3: Float)

Adds a cubic bezier segment that curves from the current point to the given point (x3, y3), using the control points (x1, y1) and (x2, y2).

android
open Rect

Compute the bounds of the control points of the path, and write the answer into bounds.

android
open Unit
lineTo(x: Float, y: Float)

Adds a straight line segment from the current point to the given point

android
open Unit
moveTo(x: Float, y: Float)

Starts a new subpath at the given coordinate

android
open Boolean
op(path1: Path, path2: Path, operation: PathOperation)

Set this path to the result of applying the Op to the two specified paths.

android
open Unit
quadraticBezierTo(x1: Float, y1: Float, x2: Float, y2: Float)

Adds a quadratic bezier segment that curves from the current point to the given point (x2, y2), using the control point (x1, y1).

android
open Unit
quadraticTo(x1: Float, y1: Float, x2: Float, y2: Float)

Adds a quadratic bezier segment that curves from the current point to the given point (x2, y2), using the control point (x1, y1).

android
open Unit
relativeCubicTo(
    dx1: Float,
    dy1: Float,
    dx2: Float,
    dy2: Float,
    dx3: Float,
    dy3: Float
)

Adds a cubic bezier segment that curves from the current point to the point at the offset (dx3, dy3) from the current point, using the control points at the offsets (dx1, dy1) and (dx2, dy2) from the current point.

android
open Unit

Adds a straight line segment from the current point to the point at the given offset from the current point.

android
open Unit

Starts a new subpath at the given offset from the current point

android
open Unit
relativeQuadraticBezierTo(dx1: Float, dy1: Float, dx2: Float, dy2: Float)

Adds a quadratic bezier segment that curves from the current point to the point at the offset (dx2, dy2) from the current point, using the control point at the offset (dx1, dy1) from the current point.

android
open Unit
relativeQuadraticTo(dx1: Float, dy1: Float, dx2: Float, dy2: Float)

Adds a quadratic bezier segment that curves from the current point to the point at the offset (dx2, dy2) from the current point, using the control point at the offset (dx1, dy1) from the current point.

android
open Unit

Clears the Path object of all subpaths, returning it to the same state it had when it was created.

android
open Unit

Rewinds the path: clears any lines and curves from the path but keeps the internal data structure for faster reuse.

android
open Unit
transform(matrix: Matrix)

Transform the points in this path by the provided matrix

android
open Unit
translate(offset: Offset)

Translates all the segments of every subpath by the given offset.

android

Public properties

open PathFillType

Determines how the interior of this path is calculated.

android
Path
android
open Boolean

Returns the path's convexity, as defined by the content of the path.

android
open Boolean

Returns true if the path is empty (contains no lines or curves)

android

Inherited functions

From androidx.compose.ui.graphics.Path
open infix Path
and(path: Path)

Returns the intersection of two paths as a new Path.

android
open Unit
arcToRad(
    rect: Rect,
    startAngleRadians: Float,
    sweepAngleRadians: Float,
    forceMoveTo: Boolean
)

If the forceMoveTo argument is false, adds a straight line segment and an arc segment.

android
open operator PathIterator

Creates a new PathIterator for this Path that evaluates conics as quadratics.

android
open PathIterator
iterator(conicEvaluation: PathIterator.ConicEvaluation, tolerance: Float)

Creates a new PathIterator for this Path.

android
open operator Path
minus(path: Path)

Returns the difference of two paths as a new Path.

android
open infix Path
or(path: Path)

Returns the union of two paths as a new Path.

android
open operator Path
plus(path: Path)

Returns the union of two paths as a new Path.

android
open infix Path
xor(path: Path)

Returns the union minus the intersection of two paths as a new Path.

android

Public constructors

AndroidPath

AndroidPath(internalPath: Path = PlatformPath())

Public functions

addArc

open fun addArc(oval: Rect, startAngleDegrees: Float, sweepAngleDegrees: Float): Unit

Adds a new subpath with one arc segment that consists of the arc that follows the edge of the oval bounded by the given rectangle, from startAngle degrees around the oval up to startAngle + sweepAngle degrees around the oval, with zero degrees being the point on the right hand side of the oval that crosses the horizontal line that intersects the center of the rectangle and with positive angles going clockwise around the oval.

addArcRad

open fun addArcRad(oval: Rect, startAngleRadians: Float, sweepAngleRadians: Float): Unit

Adds a new subpath with one arc segment that consists of the arc that follows the edge of the oval bounded by the given rectangle, from startAngle radians around the oval up to startAngle + sweepAngle radians around the oval, with zero radians being the point on the right hand side of the oval that crosses the horizontal line that intersects the center of the rectangle and with positive angles going clockwise around the oval.

addOval

open fun addOval(oval: Rect): Unit

Adds a new subpath that consists of a curve that forms the ellipse that fills the given rectangle.

To add a circle, pass an appropriate rectangle as oval. Rect can be used to easily describe the circle's center Offset and radius.

The oval is wound counter-clockwise.

addOval

open fun addOval(oval: Rect, direction: Path.Direction): Unit

Adds a new subpath that consists of a curve that forms the ellipse that fills the given rectangle.

To add a circle, pass an appropriate rectangle as oval. Rect can be used to easily describe the circle's center Offset and radius.

The direction to wind the rectangle's contour is specified by direction.

addPath

open fun addPath(path: Path, offset: Offset): Unit

Adds a new subpath that consists of the given path offset by the given offset.

addRect

open fun addRect(rect: Rect): Unit

Adds a new subpath that consists of four lines that outline the given rectangle. The rectangle is wound counter-clockwise.

addRect

open fun addRect(rect: Rect, direction: Path.Direction): Unit

Adds a new subpath that consists of four lines that outline the given rectangle. The direction to wind the rectangle's contour is specified by direction.

addRoundRect

open fun addRoundRect(roundRect: RoundRect): Unit

Add a round rectangle shape to the path from the given RoundRect. The round rectangle is wound counter-clockwise.

addRoundRect

open fun addRoundRect(roundRect: RoundRect, direction: Path.Direction): Unit

Add a round rectangle shape to the path from the given RoundRect. The direction to wind the rectangle's contour is specified by direction.

arcTo

open fun arcTo(
    rect: Rect,
    startAngleDegrees: Float,
    sweepAngleDegrees: Float,
    forceMoveTo: Boolean
): Unit

If the forceMoveTo argument is false, adds a straight line segment and an arc segment.

If the forceMoveTo argument is true, starts a new subpath consisting of an arc segment.

In either case, the arc segment consists of the arc that follows the edge of the oval bounded by the given rectangle, from startAngle degrees around the oval up to startAngle + sweepAngle degrees around the oval, with zero degrees being the point on the right hand side of the oval that crosses the horizontal line that intersects the center of the rectangle and with positive angles going clockwise around the oval.

The line segment added if forceMoveTo is false starts at the current point and ends at the start of the arc.

close

open fun close(): Unit

Closes the last subpath, as if a straight line had been drawn from the current point to the first point of the subpath.

cubicTo

open fun cubicTo(x1: Float, y1: Float, x2: Float, y2: Float, x3: Float, y3: Float): Unit

Adds a cubic bezier segment that curves from the current point to the given point (x3, y3), using the control points (x1, y1) and (x2, y2).

getBounds

open fun getBounds(): Rect

Compute the bounds of the control points of the path, and write the answer into bounds. If the path contains 0 or 1 points, the bounds is set to (0,0,0,0)

lineTo

open fun lineTo(x: Float, y: Float): Unit

Adds a straight line segment from the current point to the given point

moveTo

open fun moveTo(x: Float, y: Float): Unit

Starts a new subpath at the given coordinate

op

open fun op(path1: Path, path2: Path, operation: PathOperation): Boolean

Set this path to the result of applying the Op to the two specified paths. The resulting path will be constructed from non-overlapping contours. The curve order is reduced where possible so that cubics may be turned into quadratics, and quadratics maybe turned into lines.

Parameters
path1: Path

The first operand (for difference, the minuend)

path2: Path

The second operand (for difference, the subtrahend)

operation: PathOperation

PathOperation to apply to the 2 specified paths

Returns
Boolean

True if operation succeeded, false otherwise and this path remains unmodified.

quadraticBezierTo

open fun quadraticBezierTo(x1: Float, y1: Float, x2: Float, y2: Float): Unit

Adds a quadratic bezier segment that curves from the current point to the given point (x2, y2), using the control point (x1, y1).

quadraticTo

open fun quadraticTo(x1: Float, y1: Float, x2: Float, y2: Float): Unit

Adds a quadratic bezier segment that curves from the current point to the given point (x2, y2), using the control point (x1, y1).

relativeCubicTo

open fun relativeCubicTo(
    dx1: Float,
    dy1: Float,
    dx2: Float,
    dy2: Float,
    dx3: Float,
    dy3: Float
): Unit

Adds a cubic bezier segment that curves from the current point to the point at the offset (dx3, dy3) from the current point, using the control points at the offsets (dx1, dy1) and (dx2, dy2) from the current point.

relativeLineTo

open fun relativeLineTo(dx: Float, dy: Float): Unit

Adds a straight line segment from the current point to the point at the given offset from the current point.

relativeMoveTo

open fun relativeMoveTo(dx: Float, dy: Float): Unit

Starts a new subpath at the given offset from the current point

relativeQuadraticBezierTo

open fun relativeQuadraticBezierTo(dx1: Float, dy1: Float, dx2: Float, dy2: Float): Unit

Adds a quadratic bezier segment that curves from the current point to the point at the offset (dx2, dy2) from the current point, using the control point at the offset (dx1, dy1) from the current point.

relativeQuadraticTo

open fun relativeQuadraticTo(dx1: Float, dy1: Float, dx2: Float, dy2: Float): Unit

Adds a quadratic bezier segment that curves from the current point to the point at the offset (dx2, dy2) from the current point, using the control point at the offset (dx1, dy1) from the current point.

reset

open fun reset(): Unit

Clears the Path object of all subpaths, returning it to the same state it had when it was created. The current point is reset to the origin. This does NOT change the fill-type setting.

rewind

open fun rewind(): Unit

Rewinds the path: clears any lines and curves from the path but keeps the internal data structure for faster reuse.

transform

open fun transform(matrix: Matrix): Unit

Transform the points in this path by the provided matrix

translate

open fun translate(offset: Offset): Unit

Translates all the segments of every subpath by the given offset.

Public properties

fillType

open var fillTypePathFillType

Determines how the interior of this path is calculated.

Defaults to the non-zero winding rule, PathFillType.NonZero.

internalPath

val internalPathPath

isConvex

open val isConvexBoolean

Returns the path's convexity, as defined by the content of the path.

A path is convex if it has a single contour, and only ever curves in a single direction.

This function will calculate the convexity of the path from its control points, and cache the result.

isEmpty

open val isEmptyBoolean

Returns true if the path is empty (contains no lines or curves)

Returns
Boolean

true if the path is empty (contains no lines or curves)