Package io.github.humbleui.skija
Class PathMeasure
- java.lang.Object
-
- io.github.humbleui.skija.impl.Native
-
- io.github.humbleui.skija.impl.Managed
-
- io.github.humbleui.skija.PathMeasure
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class PathMeasure extends Managed
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPathMeasure._FinalizerHolder-
Nested classes/interfaces inherited from class io.github.humbleui.skija.impl.Managed
Managed.CleanerThunk
-
-
Field Summary
-
Fields inherited from class io.github.humbleui.skija.impl.Managed
_cleanable
-
-
Constructor Summary
Constructors Constructor Description PathMeasure()PathMeasure(long ptr)PathMeasure(Path path)Initialize the pathmeasure with the specified path.PathMeasure(Path path, boolean forceClosed)Initialize the pathmeasure with the specified path.PathMeasure(Path path, boolean forceClosed, float resScale)Initialize the pathmeasure with the specified path.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static long_nGetFinalizer()static float_nGetLength(long ptr)static float[]_nGetMatrix(long ptr, float distance, boolean getPosition, boolean getTangent)static io.github.humbleui.types.Point_nGetPosition(long ptr, float distance)static RSXform_nGetRSXform(long ptr, float distance)static boolean_nGetSegment(long ptr, float startD, float endD, long dstPtr, boolean startWithMoveTo)static io.github.humbleui.types.Point_nGetTangent(long ptr, float distance)static boolean_nIsClosed(long ptr)static long_nMake()static long_nMakePath(long pathPtr, boolean forceClosed, float resScale)static boolean_nNextContour(long ptr)static void_nSetPath(long ptr, long pathPtr, boolean forceClosed)floatgetLength()Return the total length of the current contour, or 0 if no path is associated (e.g.@Nullable Matrix33getMatrix(float distance, boolean getPosition, boolean getTangent)Pins distance to 0 <= distance <= getLength(), and then computes the corresponding matrix (by calling getPosition/getTangent).@Nullable io.github.humbleui.types.PointgetPosition(float distance)Pins distance to 0 <= distance <= getLength(), and then computes the corresponding position.@Nullable RSXformgetRSXform(float distance)Pins distance to 0 <= distance <= getLength(), and then computes the corresponding RSXform.@org.jetbrains.annotations.Nullable booleangetSegment(float startD, float endD, @NotNull Path dst, boolean startWithMoveTo)Given a start and stop distance, return in dst the intervening segment(s).@Nullable io.github.humbleui.types.PointgetTangent(float distance)Pins distance to 0 <= distance <= getLength(), and then computes the corresponding tangent.booleanisClosed()booleannextContour()Move to the next contour in the path.PathMeasuresetPath(@Nullable Path path, boolean forceClosed)Reset the pathmeasure with the specified path.-
Methods inherited from class io.github.humbleui.skija.impl.Managed
_nInvokeFinalizer, close
-
-
-
-
Constructor Detail
-
PathMeasure
@Internal public PathMeasure(long ptr)
-
PathMeasure
public PathMeasure()
-
PathMeasure
public PathMeasure(Path path)
Initialize the pathmeasure with the specified path. The parts of the path that are needed are copied, so the client is free to modify/delete the path after this call.
-
PathMeasure
public PathMeasure(Path path, boolean forceClosed)
Initialize the pathmeasure with the specified path. The parts of the path that are needed are copied, so the client is free to modify/delete the path after this call.
-
PathMeasure
public PathMeasure(Path path, boolean forceClosed, float resScale)
Initialize the pathmeasure with the specified path. The parts of the path that are needed are copied, so the client is free to modify/delete the path after this call.
resScale controls the precision of the measure. values > 1 increase the precision (and possible slow down the computation).
-
-
Method Detail
-
setPath
public PathMeasure setPath(@Nullable @Nullable Path path, boolean forceClosed)
Reset the pathmeasure with the specified path. The parts of the path that are needed are copied, so the client is free to modify/delete the path after this call.
-
getLength
public float getLength()
Return the total length of the current contour, or 0 if no path is associated (e.g. resetPath(null))
-
getPosition
@Nullable public @Nullable io.github.humbleui.types.Point getPosition(float distance)
Pins distance to 0 <= distance <= getLength(), and then computes the corresponding position.- Returns:
- null if there is no path, or a zero-length path was specified.
-
getTangent
@Nullable public @Nullable io.github.humbleui.types.Point getTangent(float distance)
Pins distance to 0 <= distance <= getLength(), and then computes the corresponding tangent.- Returns:
- null if there is no path, or a zero-length path was specified.
-
getRSXform
@Nullable public @Nullable RSXform getRSXform(float distance)
Pins distance to 0 <= distance <= getLength(), and then computes the corresponding RSXform.- Returns:
- null if there is no path, or a zero-length path was specified.
-
getMatrix
@Nullable public @Nullable Matrix33 getMatrix(float distance, boolean getPosition, boolean getTangent)
Pins distance to 0 <= distance <= getLength(), and then computes the corresponding matrix (by calling getPosition/getTangent).- Returns:
- null if there is no path, or a zero-length path was specified.
-
getSegment
@Nullable public @org.jetbrains.annotations.Nullable boolean getSegment(float startD, float endD, @NotNull @NotNull Path dst, boolean startWithMoveTo)Given a start and stop distance, return in dst the intervening segment(s). If the segment is zero-length, return false, else return true. startD and stopD are pinned to legal values (0..getLength()). If startD > stopD then return false (and leave dst untouched). Begin the segment with a moveTo if startWithMoveTo is true
-
isClosed
public boolean isClosed()
-
nextContour
public boolean nextContour()
Move to the next contour in the path. Return true if one exists, or false if we're done with the path.
-
_nGetFinalizer
@Internal public static long _nGetFinalizer()
-
_nMake
@Internal public static long _nMake()
-
_nMakePath
@Internal public static long _nMakePath(long pathPtr, boolean forceClosed, float resScale)
-
_nSetPath
@Internal public static void _nSetPath(long ptr, long pathPtr, boolean forceClosed)
-
_nGetLength
@Internal public static float _nGetLength(long ptr)
-
_nGetPosition
@Internal public static io.github.humbleui.types.Point _nGetPosition(long ptr, float distance)
-
_nGetTangent
@Internal public static io.github.humbleui.types.Point _nGetTangent(long ptr, float distance)
-
_nGetRSXform
@Internal public static RSXform _nGetRSXform(long ptr, float distance)
-
_nGetMatrix
@Internal public static float[] _nGetMatrix(long ptr, float distance, boolean getPosition, boolean getTangent)
-
_nGetSegment
@Internal public static boolean _nGetSegment(long ptr, float startD, float endD, long dstPtr, boolean startWithMoveTo)
-
_nIsClosed
@Internal public static boolean _nIsClosed(long ptr)
-
_nNextContour
@Internal public static boolean _nNextContour(long ptr)
-
-