Class PathMeasure

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class PathMeasure
    extends Managed
    • Field Summary

      • Fields inherited from class io.github.humbleui.skija.impl.Native

        _ptr
    • 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)  
      float getLength()
      Return the total length of the current contour, or 0 if no path is associated (e.g.
      @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).
      @Nullable io.github.humbleui.types.Point getPosition​(float distance)
      Pins distance to 0 <= distance <= getLength(), and then computes the corresponding position.
      @Nullable RSXform getRSXform​(float distance)
      Pins distance to 0 <= distance <= getLength(), and then computes the corresponding RSXform.
      @org.jetbrains.annotations.Nullable boolean getSegment​(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.Point getTangent​(float distance)
      Pins distance to 0 <= distance <= getLength(), and then computes the corresponding tangent.
      boolean isClosed()  
      boolean nextContour()
      Move to the next contour in the path.
      PathMeasure setPath​(@Nullable Path path, boolean forceClosed)
      Reset the pathmeasure with the specified path.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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()
        Overrides:
        isClosed in class Managed
        Returns:
        true if the current contour is closed.
      • 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)