PathEffect
-
Cmn
interface PathEffect
Effect applied to the geometry of a drawing primitive. For example, this can be used to draw shapes as a dashed or shaped pattern, or apply a treatment around line segment intersections.
Summary
Public companion functions |
||
---|---|---|
PathEffect |
chainPathEffect(outer: PathEffect, inner: PathEffect) Create a PathEffect that applies the inner effect to the path, and then applies the outer effect to the result of the inner effect. |
Cmn
|
PathEffect |
cornerPathEffect(radius: Float) Replaces sharp angles between line segments into rounded angles of the specified radius |
Cmn
|
PathEffect |
dashPathEffect(intervals: FloatArray, phase: Float) Draws a shape as a series of dashes with the given intervals and offset into the specified interval array. |
Cmn
|
PathEffect |
stampedPathEffect( Dash the drawn path by stamping it with the specified shape represented as a |
Cmn
|
Extension functions |
||
---|---|---|
PathEffect |
android
|
Public companion functions
chainPathEffect
fun chainPathEffect(outer: PathEffect, inner: PathEffect): PathEffect
Create a PathEffect that applies the inner effect to the path, and then applies the outer effect to the result of the inner effect. (e.g. outer(inner(path)).
cornerPathEffect
fun cornerPathEffect(radius: Float): PathEffect
Replaces sharp angles between line segments into rounded angles of the specified radius
Parameters | |
---|---|
radius: Float |
Rounded corner radius to apply for each angle of the drawn shape |
dashPathEffect
fun dashPathEffect(intervals: FloatArray, phase: Float = 0.0f): PathEffect
Draws a shape as a series of dashes with the given intervals and offset into the specified interval array. The intervals must contain an even number of entries (>=2). The even indices specify "on" intervals and the odd indices represent "off" intervals. The phase parameter is the pixel offset into the intervals array (mod the sum of all of the intervals).
For example: if intervals[] = {10, 20}
, and phase = 25, this will set up a dashed path like so: 5 pixels off 10 pixels on 20 pixels off 10 pixels on 20 pixels off
The phase parameter is an offset into the intervals array. The intervals array controls the length of the dashes. This is only applied for stroked shapes (ex. PaintingStyle.Stroke
and is ignored for filled in shapes (ex. PaintingStyle.Fill
Parameters | |
---|---|
intervals: FloatArray |
Array of "on" and "off" distances for the dashed line segments |
phase: Float = 0.0f |
Pixel offset into the intervals array |
stampedPathEffect
fun stampedPathEffect(
shape: Path,
advance: Float,
phase: Float,
style: StampedPathEffectStyle
): PathEffect
Dash the drawn path by stamping it with the specified shape represented as a Path
. This is only applied to stroke shapes and will be ignored with filled shapes. The stroke width used with this PathEffect
is ignored as well.
Parameters | |
---|---|
shape: Path |
Path to stamp along |
advance: Float |
Spacing between each stamped shape |
phase: Float |
Amount to offset before the first shape is stamped |
style: StampedPathEffectStyle |
How to transform the shape at each position as it is stamped |