|
|
|
|
|
|
|
|
|
|
public float length(int contourIndex) { |
|
|
|
D.assert(contourIndex <= currentContourIndex, () => $"Iterator must be advanced before index {contourIndex} can be used."); |
|
|
|
return PathMeasure_length(contourIndex); |
|
|
|
return PathMeasure_length(_ptr, contourIndex); |
|
|
|
} |
|
|
|
|
|
|
|
public unsafe Tangent getTangentForOffset(int contourIndex, float distance) { |
|
|
|
|
|
|
PathMeasure_getPosTan(contourIndex, distance, posTanPtr); |
|
|
|
PathMeasure_getPosTan(_ptr, contourIndex, distance, posTanPtr); |
|
|
|
} |
|
|
|
|
|
|
|
if (posTan[0] == 0.0f) { |
|
|
|
|
|
|
public Path extractPath(int contourIndex, float start, float end, bool startWithMoveTo = true) { |
|
|
|
D.assert(contourIndex <= currentContourIndex, |
|
|
|
() => $"Iterator must be advanced before index {contourIndex} can be used."); |
|
|
|
IntPtr pathPtr = PathMeasure_getSegment(contourIndex, start, end, startWithMoveTo); |
|
|
|
IntPtr pathPtr = PathMeasure_getSegment(_ptr, contourIndex, start, end, startWithMoveTo); |
|
|
|
return PathMeasure_isClosed(contourIndex); |
|
|
|
return PathMeasure_isClosed(_ptr, contourIndex); |
|
|
|
bool next = PathMeasure_nativeNextContour(); |
|
|
|
bool next = PathMeasure_nativeNextContour(_ptr); |
|
|
|
if (next) { |
|
|
|
currentContourIndex++; |
|
|
|
} |
|
|
|
|
|
|
static extern void PathMeasure_dispose(IntPtr ptr); |
|
|
|
|
|
|
|
[DllImport(NativeBindings.dllName)] |
|
|
|
static extern float PathMeasure_length(int contourIndex); |
|
|
|
static extern float PathMeasure_length(IntPtr ptr, int contourIndex); |
|
|
|
static extern unsafe void PathMeasure_getPosTan(int contourIndex, float distance, float* posTan); |
|
|
|
static extern unsafe void PathMeasure_getPosTan(IntPtr ptr, int contourIndex, float distance, float* posTan); |
|
|
|
static extern IntPtr PathMeasure_getSegment(int contourIndex, float start, float end, |
|
|
|
static extern IntPtr PathMeasure_getSegment(IntPtr ptr, int contourIndex, float start, float end, |
|
|
|
static extern bool PathMeasure_isClosed(int contourIndex); |
|
|
|
static extern bool PathMeasure_isClosed(IntPtr ptr, int contourIndex); |
|
|
|
static extern bool PathMeasure_nativeNextContour(); |
|
|
|
static extern bool PathMeasure_nativeNextContour(IntPtr ptr); |
|
|
|
} |
|
|
|
|
|
|
|
public class ColorFilter : IEquatable<ColorFilter> { |
|
|
|