Unverified Commit 8c390cb1 authored by Ivan Matkov's avatar Ivan Matkov Committed by GitHub

Temporary revert `Path` edit methods as `@Deprecated(ERROR)` (#1172)

[SKIKO-1114](https://youtrack.jetbrains.com/issue/SKIKO-1114) Provide
more smooth migration to skiko 0.144.*
parent 71e76fbf
...@@ -66,12 +66,14 @@ fun skiaPreprocessorFlags(os: OS, buildType: SkiaBuildType): Array<String> { ...@@ -66,12 +66,14 @@ fun skiaPreprocessorFlags(os: OS, buildType: SkiaBuildType): Array<String> {
"-DSK_SUPPORT_OPENCL=0", "-DSK_SUPPORT_OPENCL=0",
"-DSK_UNICODE_AVAILABLE", "-DSK_UNICODE_AVAILABLE",
"-DSK_USING_THIRD_PARTY_ICU", "-DSK_USING_THIRD_PARTY_ICU",
"-DSK_HIDE_PATH_EDIT_METHODS", // Temporary (m144) skia flag for migration to SkPathBuilder
// For ICU symbols renaming: // For ICU symbols renaming:
"-DU_DISABLE_RENAMING=0", "-DU_DISABLE_RENAMING=0",
"-DU_DISABLE_VERSION_SUFFIX=1", "-DU_DISABLE_VERSION_SUFFIX=1",
"-DU_HAVE_LIB_SUFFIX=1", "-DU_HAVE_LIB_SUFFIX=1",
"-DU_LIB_SUFFIX_C_NAME=_skiko", "-DU_LIB_SUFFIX_C_NAME=_skiko",
// Temporary (m144) skia flag for migration to SkPathBuilder
"-USK_HIDE_PATH_EDIT_METHODS",
*buildType.flags *buildType.flags
) )
......
...@@ -7,7 +7,7 @@ kotlin.mpp.enableCInteropCommonization=true ...@@ -7,7 +7,7 @@ kotlin.mpp.enableCInteropCommonization=true
deploy.version=0.0.0 deploy.version=0.0.0
# a tag from https://github.com/JetBrains/skia-pack # a tag from https://github.com/JetBrains/skia-pack
dependencies.skia=m144-e2e6623374-2 dependencies.skia=m144-e2e6623374-4
# a tag from https://github.com/JetBrains/angle-pack # a tag from https://github.com/JetBrains/angle-pack
dependencies.angle=ec4d8f8e4d dependencies.angle=ec4d8f8e4d
......
...@@ -1181,6 +1181,567 @@ class Path internal constructor(ptr: NativePointer) : Managed(ptr, _FinalizerHol ...@@ -1181,6 +1181,567 @@ class Path internal constructor(ptr: NativePointer) : Managed(ptr, _FinalizerHol
} finally { } finally {
reachabilityBarrier(this) reachabilityBarrier(this)
} }
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun reset(): Path {
Stats.onNativeCall()
Path_nReset(_ptr)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun rewind(): Path {
Stats.onNativeCall()
_nRewind(_ptr)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun incReserve(extraPtCount: Int): Path {
Stats.onNativeCall()
_nIncReserve(_ptr, extraPtCount)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun moveTo(x: Float, y: Float): Path {
Stats.onNativeCall()
_nMoveTo(_ptr, x, y)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun moveTo(p: Point): Path {
@Suppress("DEPRECATION_ERROR")
return moveTo(p.x, p.y)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun rMoveTo(dx: Float, dy: Float): Path {
Stats.onNativeCall()
_nRMoveTo(_ptr, dx, dy)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun lineTo(x: Float, y: Float): Path {
Stats.onNativeCall()
_nLineTo(_ptr, x, y)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun lineTo(p: Point): Path {
@Suppress("DEPRECATION_ERROR")
return lineTo(p.x, p.y)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun rLineTo(dx: Float, dy: Float): Path {
Stats.onNativeCall()
_nRLineTo(_ptr, dx, dy)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun quadTo(x1: Float, y1: Float, x2: Float, y2: Float): Path {
Stats.onNativeCall()
_nQuadTo(_ptr, x1, y1, x2, y2)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun quadTo(p1: Point, p2: Point): Path {
@Suppress("DEPRECATION_ERROR")
return quadTo(p1.x, p1.y, p2.x, p2.y)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun rQuadTo(dx1: Float, dy1: Float, dx2: Float, dy2: Float): Path {
Stats.onNativeCall()
_nRQuadTo(_ptr, dx1, dy1, dx2, dy2)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun conicTo(x1: Float, y1: Float, x2: Float, y2: Float, w: Float): Path {
Stats.onNativeCall()
_nConicTo(_ptr, x1, y1, x2, y2, w)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun conicTo(p1: Point, p2: Point, w: Float): Path {
@Suppress("DEPRECATION_ERROR")
return conicTo(p1.x, p1.y, p2.x, p2.y, w)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun rConicTo(dx1: Float, dy1: Float, dx2: Float, dy2: Float, w: Float): Path {
Stats.onNativeCall()
_nRConicTo(_ptr, dx1, dy1, dx2, dy2, w)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun cubicTo(x1: Float, y1: Float, x2: Float, y2: Float, x3: Float, y3: Float): Path {
Stats.onNativeCall()
_nCubicTo(_ptr, x1, y1, x2, y2, x3, y3)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun cubicTo(p1: Point, p2: Point, p3: Point): Path {
@Suppress("DEPRECATION_ERROR")
return cubicTo(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun rCubicTo(dx1: Float, dy1: Float, dx2: Float, dy2: Float, dx3: Float, dy3: Float): Path {
Stats.onNativeCall()
_nRCubicTo(_ptr, dx1, dy1, dx2, dy2, dx3, dy3)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun arcTo(oval: Rect, startAngle: Float, sweepAngle: Float, forceMoveTo: Boolean): Path {
@Suppress("DEPRECATION_ERROR")
return arcTo(oval.left, oval.top, oval.right, oval.bottom, startAngle, sweepAngle, forceMoveTo)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun arcTo(left: Float, top: Float, right: Float, bottom: Float, startAngle: Float, sweepAngle: Float, forceMoveTo: Boolean): Path {
Stats.onNativeCall()
_nArcTo(_ptr, left, top, right, bottom, startAngle, sweepAngle, forceMoveTo)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun tangentArcTo(x1: Float, y1: Float, x2: Float, y2: Float, radius: Float): Path {
Stats.onNativeCall()
_nTangentArcTo(_ptr, x1, y1, x2, y2, radius)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun tangentArcTo(p1: Point, p2: Point, radius: Float): Path {
@Suppress("DEPRECATION_ERROR")
return tangentArcTo(p1.x, p1.y, p2.x, p2.y, radius)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun ellipticalArcTo(
rx: Float,
ry: Float,
xAxisRotate: Float,
arc: PathEllipseArc,
direction: PathDirection,
x: Float,
y: Float
): Path {
Stats.onNativeCall()
_nEllipticalArcTo(_ptr, rx, ry, xAxisRotate, arc.ordinal, direction.ordinal, x, y)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun ellipticalArcTo(r: Point, xAxisRotate: Float, arc: PathEllipseArc, direction: PathDirection, xy: Point): Path {
@Suppress("DEPRECATION_ERROR")
return ellipticalArcTo(r.x, r.y, xAxisRotate, arc, direction, xy.x, xy.y)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun rEllipticalArcTo(
rx: Float,
ry: Float,
xAxisRotate: Float,
arc: PathEllipseArc,
direction: PathDirection,
dx: Float,
dy: Float
): Path {
Stats.onNativeCall()
_nREllipticalArcTo(_ptr, rx, ry, xAxisRotate, arc.ordinal, direction.ordinal, dx, dy)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun closePath(): Path {
Stats.onNativeCall()
_nClosePath(_ptr)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addRect(rect: Rect, dir: PathDirection = PathDirection.CLOCKWISE, start: Int = 0): Path {
@Suppress("DEPRECATION_ERROR")
return addRect(rect.left, rect.top, rect.right, rect.bottom, dir, start)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addRect(left: Float, top: Float, right: Float, bottom: Float, dir: PathDirection = PathDirection.CLOCKWISE, start: Int = 0): Path {
Stats.onNativeCall()
_nAddRect(_ptr, left, top, right, bottom, dir.ordinal, start)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addOval(oval: Rect, dir: PathDirection = PathDirection.CLOCKWISE, start: Int = 1): Path {
@Suppress("DEPRECATION_ERROR")
return addOval(oval.left, oval.top, oval.right, oval.bottom, dir, start)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addOval(left: Float, top: Float, right: Float, bottom: Float, dir: PathDirection = PathDirection.CLOCKWISE, start: Int = 1): Path {
Stats.onNativeCall()
_nAddOval(_ptr, left, top, right, bottom, dir.ordinal, start)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addCircle(x: Float, y: Float, radius: Float, dir: PathDirection = PathDirection.CLOCKWISE): Path {
Stats.onNativeCall()
_nAddCircle(_ptr, x, y, radius, dir.ordinal)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addArc(oval: Rect, startAngle: Float, sweepAngle: Float): Path {
@Suppress("DEPRECATION_ERROR")
return addArc(oval.left, oval.top, oval.right, oval.bottom, startAngle, sweepAngle)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addArc(left: Float, top: Float, right: Float, bottom: Float, startAngle: Float, sweepAngle: Float): Path {
Stats.onNativeCall()
_nAddArc(_ptr, left, top, right, bottom, startAngle, sweepAngle)
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addRRect(rrect: RRect, dir: PathDirection = PathDirection.CLOCKWISE, start: Int = 6): Path {
@Suppress("DEPRECATION_ERROR")
return addRRect(rrect.left, rrect.top, rrect.right, rrect.bottom, rrect.radii, dir, start)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addRRect(left: Float, top: Float, right: Float, bottom: Float, radii: FloatArray, dir: PathDirection = PathDirection.CLOCKWISE, start: Int = 6): Path {
Stats.onNativeCall()
interopScope {
_nAddRRect(_ptr, left, top, right, bottom, toInterop(radii), radii.size, dir.ordinal, start)
}
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addPoly(pts: Array<Point>, close: Boolean): Path {
val flat = FloatArray(pts.size * 2)
for (i in pts.indices) {
flat[i * 2] = pts[i].x
flat[i * 2 + 1] = pts[i].y
}
@Suppress("DEPRECATION_ERROR")
return addPoly(flat, close)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addPoly(pts: FloatArray, close: Boolean): Path {
require(pts.size % 2 == 0) { "Expected even amount of pts, got " + pts.size }
Stats.onNativeCall()
interopScope {
_nAddPoly(_ptr, toInterop(pts), pts.size / 2, close)
}
return this
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addPath(src: Path?, extend: Boolean = false): Path {
return try {
Stats.onNativeCall()
_nAddPath(
_ptr,
getPtr(src),
extend
)
this
} finally {
reachabilityBarrier(this)
reachabilityBarrier(src)
}
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addPath(src: Path?, dx: Float, dy: Float, extend: Boolean = false): Path {
return try {
Stats.onNativeCall()
_nAddPathOffset(
_ptr,
getPtr(src),
dx,
dy,
extend
)
this
} finally {
reachabilityBarrier(this)
reachabilityBarrier(src)
}
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun addPath(src: Path?, matrix: Matrix33, extend: Boolean = false): Path {
return try {
Stats.onNativeCall()
interopScope {
_nAddPathTransform(
_ptr,
getPtr(src),
toInterop(matrix.mat),
extend
)
}
this
} finally {
reachabilityBarrier(this)
reachabilityBarrier(src)
}
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun reverseAddPath(src: Path?): Path {
return try {
Stats.onNativeCall()
_nReverseAddPath(_ptr, getPtr(src))
this
} finally {
reachabilityBarrier(this)
reachabilityBarrier(src)
}
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun offset(dx: Float, dy: Float, dst: Path? = null): Path {
return try {
Stats.onNativeCall()
_nOffset(_ptr, dx, dy, getPtr(dst))
this
} finally {
reachabilityBarrier(this)
reachabilityBarrier(dst)
}
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun transform(matrix: Matrix33, applyPerspectiveClip: Boolean): Path {
@Suppress("DEPRECATION_ERROR")
return transform(matrix, null, applyPerspectiveClip)
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun transform(matrix: Matrix33, dst: Path? = null, applyPerspectiveClip: Boolean = true): Path {
return try {
Stats.onNativeCall()
interopScope {
_nTransform(
_ptr,
toInterop(matrix.mat),
getPtr(dst),
applyPerspectiveClip
)
}
this
} finally {
reachabilityBarrier(this)
reachabilityBarrier(dst)
}
}
@Deprecated(
message = "Mutating Path API was moved to PathBuilder in Skia m144",
replaceWith = ReplaceWith("PathBuilder"),
level = DeprecationLevel.ERROR,
)
fun setLastPt(x: Float, y: Float): Path {
Stats.onNativeCall()
_nSetLastPt(_ptr, x, y)
return this
}
} }
@ExternalSymbolName("org_jetbrains_skia_Path__1nGetFinalizer") @ExternalSymbolName("org_jetbrains_skia_Path__1nGetFinalizer")
...@@ -1383,3 +1944,140 @@ private external fun _nMakeFromBytes(data: InteropPointer, size: Int): NativePoi ...@@ -1383,3 +1944,140 @@ private external fun _nMakeFromBytes(data: InteropPointer, size: Int): NativePoi
@ExternalSymbolName("org_jetbrains_skia_Path__1nIsValid") @ExternalSymbolName("org_jetbrains_skia_Path__1nIsValid")
private external fun _nIsValid(ptr: NativePointer): Boolean private external fun _nIsValid(ptr: NativePointer): Boolean
// ================ DEPRECATED ================
@ExternalSymbolName("org_jetbrains_skia_Path__1nReset")
private external fun Path_nReset(ptr: NativePointer)
@ExternalSymbolName("org_jetbrains_skia_Path__1nRewind")
private external fun _nRewind(ptr: NativePointer)
@ExternalSymbolName("org_jetbrains_skia_Path__1nIncReserve")
private external fun _nIncReserve(ptr: NativePointer, extraPtCount: Int)
@ExternalSymbolName("org_jetbrains_skia_Path__1nMoveTo")
private external fun _nMoveTo(ptr: NativePointer, x: Float, y: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nRMoveTo")
private external fun _nRMoveTo(ptr: NativePointer, dx: Float, dy: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nLineTo")
private external fun _nLineTo(ptr: NativePointer, x: Float, y: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nRLineTo")
private external fun _nRLineTo(ptr: NativePointer, dx: Float, dy: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nQuadTo")
private external fun _nQuadTo(ptr: NativePointer, x1: Float, y1: Float, x2: Float, y2: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nRQuadTo")
private external fun _nRQuadTo(ptr: NativePointer, dx1: Float, dy1: Float, dx2: Float, dy2: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nConicTo")
private external fun _nConicTo(ptr: NativePointer, x1: Float, y1: Float, x2: Float, y2: Float, w: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nRConicTo")
private external fun _nRConicTo(ptr: NativePointer, dx1: Float, dy1: Float, dx2: Float, dy2: Float, w: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nCubicTo")
private external fun _nCubicTo(ptr: NativePointer, x1: Float, y1: Float, x2: Float, y2: Float, x3: Float, y3: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nRCubicTo")
private external fun _nRCubicTo(ptr: NativePointer, dx1: Float, dy1: Float, dx2: Float, dy2: Float, dx3: Float, dy3: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nArcTo")
private external fun _nArcTo(
ptr: NativePointer,
left: Float,
top: Float,
right: Float,
bottom: Float,
startAngle: Float,
sweepAngle: Float,
forceMoveTo: Boolean
)
@ExternalSymbolName("org_jetbrains_skia_Path__1nTangentArcTo")
private external fun _nTangentArcTo(ptr: NativePointer, x1: Float, y1: Float, x2: Float, y2: Float, radius: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nEllipticalArcTo")
private external fun _nEllipticalArcTo(
ptr: NativePointer,
rx: Float,
ry: Float,
xAxisRotate: Float,
size: Int,
direction: Int,
x: Float,
y: Float
)
@ExternalSymbolName("org_jetbrains_skia_Path__1nREllipticalArcTo")
private external fun _nREllipticalArcTo(
ptr: NativePointer,
rx: Float,
ry: Float,
xAxisRotate: Float,
size: Int,
direction: Int,
dx: Float,
dy: Float
)
@ExternalSymbolName("org_jetbrains_skia_Path__1nClosePath")
private external fun _nClosePath(ptr: NativePointer)
@ExternalSymbolName("org_jetbrains_skia_Path__1nAddRect")
private external fun _nAddRect(ptr: NativePointer, l: Float, t: Float, r: Float, b: Float, dir: Int, start: Int)
@ExternalSymbolName("org_jetbrains_skia_Path__1nAddOval")
private external fun _nAddOval(ptr: NativePointer, l: Float, t: Float, r: Float, b: Float, dir: Int, start: Int)
@ExternalSymbolName("org_jetbrains_skia_Path__1nAddCircle")
private external fun _nAddCircle(ptr: NativePointer, x: Float, y: Float, r: Float, dir: Int)
@ExternalSymbolName("org_jetbrains_skia_Path__1nAddArc")
private external fun _nAddArc(ptr: NativePointer, l: Float, t: Float, r: Float, b: Float, startAngle: Float, sweepAngle: Float)
@ExternalSymbolName("org_jetbrains_skia_Path__1nAddRRect")
private external fun _nAddRRect(
ptr: NativePointer,
l: Float,
t: Float,
r: Float,
b: Float,
radii: InteropPointer,
size: Int,
dir: Int,
start: Int
)
@ExternalSymbolName("org_jetbrains_skia_Path__1nAddPoly")
private external fun _nAddPoly(ptr: NativePointer, coords: InteropPointer, count: Int, close: Boolean)
@ExternalSymbolName("org_jetbrains_skia_Path__1nAddPath")
private external fun _nAddPath(ptr: NativePointer, srcPtr: NativePointer, extend: Boolean)
@ExternalSymbolName("org_jetbrains_skia_Path__1nAddPathOffset")
private external fun _nAddPathOffset(ptr: NativePointer, srcPtr: NativePointer, dx: Float, dy: Float, extend: Boolean)
@ExternalSymbolName("org_jetbrains_skia_Path__1nAddPathTransform")
private external fun _nAddPathTransform(ptr: NativePointer, srcPtr: NativePointer, matrix: InteropPointer, extend: Boolean)
@ExternalSymbolName("org_jetbrains_skia_Path__1nReverseAddPath")
private external fun _nReverseAddPath(ptr: NativePointer, srcPtr: NativePointer)
@ExternalSymbolName("org_jetbrains_skia_Path__1nOffset")
private external fun _nOffset(ptr: NativePointer, dx: Float, dy: Float, dst: NativePointer)
@ExternalSymbolName("org_jetbrains_skia_Path__1nTransform")
private external fun _nTransform(ptr: NativePointer, matrix: InteropPointer, dst: NativePointer, applyPerspectiveClip: Boolean)
@ExternalSymbolName("org_jetbrains_skia_Path__1nSetLastPt")
private external fun _nSetLastPt(ptr: NativePointer, x: Float, y: Float)
package org.jetbrains.skia
import org.jetbrains.skiko.tests.runTest
import kotlin.test.Test
@Suppress("DEPRECATION_ERROR")
class PathMutatingMethodsCompatTest {
@Test
fun restoredMutatingMethodsAreCallable() = runTest {
val path = Path()
val src = PathBuilder().moveTo(0f, 0f).lineTo(10f, 10f).detach()
val dst = Path()
val point1 = Point(1f, 2f)
val point2 = Point(3f, 4f)
val point3 = Point(5f, 6f)
val oval = Rect.makeLTRB(0f, 0f, 20f, 30f)
val rrect = RRect.makeLTRB(0f, 0f, 20f, 30f, 4f)
val matrix = Matrix33.makeTranslate(7f, 8f)
val radii = floatArrayOf(1f, 1f, 2f, 2f, 3f, 3f, 4f, 4f)
path.reset()
path.rewind()
path.incReserve(8)
path.moveTo(0f, 0f)
path.moveTo(point1)
path.rMoveTo(1f, 1f)
path.lineTo(2f, 2f)
path.lineTo(point2)
path.rLineTo(1f, 1f)
path.quadTo(1f, 2f, 3f, 4f)
path.quadTo(point1, point2)
path.rQuadTo(1f, 1f, 2f, 2f)
path.conicTo(1f, 2f, 3f, 4f, 0.5f)
path.conicTo(point1, point2, 0.5f)
path.rConicTo(1f, 1f, 2f, 2f, 0.75f)
path.cubicTo(1f, 2f, 3f, 4f, 5f, 6f)
path.cubicTo(point1, point2, point3)
path.rCubicTo(1f, 1f, 2f, 2f, 3f, 3f)
path.arcTo(oval, 0f, 90f, false)
path.arcTo(0f, 0f, 20f, 30f, 90f, 45f, true)
path.tangentArcTo(1f, 2f, 3f, 4f, 5f)
path.tangentArcTo(point1, point2, 6f)
path.ellipticalArcTo(10f, 20f, 30f, PathEllipseArc.SMALLER, PathDirection.CLOCKWISE, 40f, 50f)
path.ellipticalArcTo(point1, 15f, PathEllipseArc.LARGER, PathDirection.COUNTER_CLOCKWISE, point2)
path.rEllipticalArcTo(10f, 20f, 30f, PathEllipseArc.SMALLER, PathDirection.CLOCKWISE, 5f, 6f)
path.closePath()
path.addRect(oval, PathDirection.CLOCKWISE, 0)
path.addRect(0f, 0f, 20f, 30f, PathDirection.COUNTER_CLOCKWISE, 2)
path.addOval(oval, PathDirection.CLOCKWISE, 1)
path.addOval(0f, 0f, 20f, 30f, PathDirection.COUNTER_CLOCKWISE, 3)
path.addCircle(5f, 5f, 4f, PathDirection.CLOCKWISE)
path.addArc(oval, 45f, 90f)
path.addArc(0f, 0f, 20f, 30f, 10f, 15f)
path.addRRect(rrect, PathDirection.CLOCKWISE, 6)
path.addRRect(0f, 0f, 20f, 30f, radii, PathDirection.COUNTER_CLOCKWISE, 5)
path.addPoly(arrayOf(point1, point2, point3), true)
path.addPoly(floatArrayOf(0f, 0f, 1f, 1f, 2f, 2f), false)
path.addPath(src, false)
path.addPath(src, 1f, 2f, true)
path.addPath(src, matrix, false)
path.reverseAddPath(src)
path.offset(3f, 4f, dst)
path.transform(matrix, true)
path.transform(matrix, dst, false)
path.setLastPt(9f, 10f)
}
}
...@@ -226,21 +226,6 @@ extern "C" JNIEXPORT jboolean Java_org_jetbrains_skia_PathKt__1nIsRect ...@@ -226,21 +226,6 @@ extern "C" JNIEXPORT jboolean Java_org_jetbrains_skia_PathKt__1nIsRect
} }
} }
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nOffset
(JNIEnv* env, jclass jclass, jlong ptr, jfloat dx, jfloat dy, jlong dstPtr) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPath* dst = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(dstPtr));
*dst = instance->makeOffset(dx, dy);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nTransform
(JNIEnv* env, jclass jclass, jlong ptr, jfloatArray matrixArr, jlong dstPtr) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPath* dst = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(dstPtr));
std::unique_ptr<SkMatrix> matrix = skMatrix(env, matrixArr);
*dst = instance->makeTransform(*matrix);
}
extern "C" JNIEXPORT jboolean JNICALL Java_org_jetbrains_skia_PathKt__1nGetLastPt extern "C" JNIEXPORT jboolean JNICALL Java_org_jetbrains_skia_PathKt__1nGetLastPt
(JNIEnv* env, jclass jclass, jlong ptr, jfloatArray resultArray) { (JNIEnv* env, jclass jclass, jlong ptr, jfloatArray resultArray) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr)); SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
...@@ -450,3 +435,198 @@ extern "C" JNIEXPORT jlong JNICALL Java_org_jetbrains_skia_PathKt__1nMakeFromPol ...@@ -450,3 +435,198 @@ extern "C" JNIEXPORT jlong JNICALL Java_org_jetbrains_skia_PathKt__1nMakeFromPol
SkPath* instance = new SkPath(path); SkPath* instance = new SkPath(path);
return reinterpret_cast<jlong>(instance); return reinterpret_cast<jlong>(instance);
} }
// ================ DEPRECATED ================
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt_Path_1nReset(JNIEnv* env, jclass jclass, jlong ptr) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->reset();
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nRewind(JNIEnv* env, jclass jclass, jlong ptr) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->rewind();
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nUpdateBoundsCache(JNIEnv* env, jclass jclass, jlong ptr) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->updateBoundsCache();
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nIncReserve(JNIEnv* env, jclass jclass, jlong ptr, int extraPtCount) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->incReserve(extraPtCount);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nMoveTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat x, jfloat y) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->moveTo(x, y);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nRMoveTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat dx, jfloat dy) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->rMoveTo(dx, dy);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nLineTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat x, jfloat y) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->lineTo(x, y);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nRLineTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat dx, jfloat dy) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->rLineTo(dx, dy);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nQuadTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat x1, jfloat y1, jfloat x2, jfloat y2) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->quadTo(x1, y1, x2, y2);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nRQuadTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat dx1, jfloat dy1, jfloat dx2, jfloat dy2) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->rQuadTo(dx1, dy1, dx2, dy2);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nConicTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat w) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->conicTo(x1, y1, x2, y2, w);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nRConicTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat dx1, jfloat dy1, jfloat dx2, jfloat dy2, jfloat w) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->rConicTo(dx1, dy1, dx2, dy2, w);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nCubicTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->cubicTo(x1, y1, x2, y2, x3, y3);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nRCubicTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat dx1, jfloat dy1, jfloat dx2, jfloat dy2, jfloat dx3, jfloat dy3) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->rCubicTo(dx1, dy1, dx2, dy2, dx3, dy3);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nArcTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat left, jfloat top, jfloat right, jfloat bottom, jfloat startAngle, jfloat sweepAngle, jboolean forceMoveTo) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->arcTo({left, top, right, bottom}, startAngle, sweepAngle, forceMoveTo);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nTangentArcTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat radius) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->arcTo(x1, y1, x2, y2, radius);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nEllipticalArcTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat rx, jfloat ry, jfloat xAxisRotate, jint size, jint direction, jfloat x, float y) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->arcTo(rx, ry, xAxisRotate, static_cast<SkPath::ArcSize>(size), static_cast<SkPathDirection>(direction), x, y);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nREllipticalArcTo(JNIEnv* env, jclass jclass, jlong ptr, jfloat rx, jfloat ry, jfloat xAxisRotate, jint size, jint direction, jfloat dx, float dy) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->rArcTo(rx, ry, xAxisRotate, static_cast<SkPath::ArcSize>(size), static_cast<SkPathDirection>(direction), dx, dy);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nClosePath(JNIEnv* env, jclass jclass, jlong ptr) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->close();
}
extern "C" JNIEXPORT void Java_org_jetbrains_skia_PathKt__1nAddRect
(JNIEnv* env, jclass jclass, jlong ptr, jfloat l, jfloat t, jfloat r, jfloat b, jint dirInt, jint start) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPathDirection dir = static_cast<SkPathDirection>(dirInt);
instance->addRect({l, t, r, b}, dir, start);
}
extern "C" JNIEXPORT void Java_org_jetbrains_skia_PathKt__1nAddOval
(JNIEnv* env, jclass jclass, jlong ptr, jfloat l, jfloat t, jfloat r, jfloat b, jint dirInt, jint start) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPathDirection dir = static_cast<SkPathDirection>(dirInt);
instance->addOval({l, t, r, b}, dir, start);
}
extern "C" JNIEXPORT void Java_org_jetbrains_skia_PathKt__1nAddCircle
(JNIEnv* env, jclass jclass, jlong ptr, jfloat x, jfloat y, jfloat r, jint dirInt) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPathDirection dir = static_cast<SkPathDirection>(dirInt);
instance->addCircle(x, y, r, dir);
}
extern "C" JNIEXPORT void Java_org_jetbrains_skia_PathKt__1nAddArc
(JNIEnv* env, jclass jclass, jlong ptr, jfloat l, jfloat t, jfloat r, jfloat b, jfloat startAngle, jfloat sweepAngle) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->addArc({l, t, r, b}, startAngle, sweepAngle);
}
extern "C" JNIEXPORT void Java_org_jetbrains_skia_PathKt__1nAddRRect
(JNIEnv* env, jclass jclass, jlong ptr, jfloat l, jfloat t, jfloat r, jfloat b, jfloatArray radii, jint radiiSize, jint dirInt, jint start) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkRRect rrect = skija::RRect::toSkRRect(env, l, t, r, b, radii);
SkPathDirection dir = static_cast<SkPathDirection>(dirInt);
instance->addRRect(rrect, dir, start);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nAddPoly
(JNIEnv* env, jclass jclass, jlong ptr, jfloatArray coords, jint _count, jboolean close) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
jsize len = env->GetArrayLength(coords);
jfloat* arr = env->GetFloatArrayElements(coords, 0);
instance->addPoly({reinterpret_cast<SkPoint*>(arr), len / 2}, close);
env->ReleaseFloatArrayElements(coords, arr, 0);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nAddPath
(JNIEnv* env, jclass jclass, jlong ptr, jlong srcPtr, jboolean extend) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPath* src = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(srcPtr));
SkPath::AddPathMode mode = extend ? SkPath::AddPathMode::kExtend_AddPathMode : SkPath::AddPathMode::kAppend_AddPathMode;
instance->addPath(*src, mode);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nAddPathOffset
(JNIEnv* env, jclass jclass, jlong ptr, jlong srcPtr, jfloat dx, jfloat dy, jboolean extend) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPath* src = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(srcPtr));
SkPath::AddPathMode mode = extend ? SkPath::AddPathMode::kExtend_AddPathMode : SkPath::AddPathMode::kAppend_AddPathMode;
instance->addPath(*src, dx, dy, mode);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nAddPathTransform
(JNIEnv* env, jclass jclass, jlong ptr, jlong srcPtr, jfloatArray matrixArr, jboolean extend) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPath* src = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(srcPtr));
std::unique_ptr<SkMatrix> matrix = skMatrix(env, matrixArr);
SkPath::AddPathMode mode = extend ? SkPath::AddPathMode::kExtend_AddPathMode : SkPath::AddPathMode::kAppend_AddPathMode;
instance->addPath(*src, *matrix, mode);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nReverseAddPath
(JNIEnv* env, jclass jclass, jlong ptr, jlong srcPtr) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPath* src = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(srcPtr));
instance->reverseAddPath(*src);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nOffset
(JNIEnv* env, jclass jclass, jlong ptr, jfloat dx, jfloat dy, jlong dstPtr) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPath* dst = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(dstPtr));
*dst = instance->makeOffset(dx, dy);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nTransform
(JNIEnv* env, jclass jclass, jlong ptr, jfloatArray matrixArr, jlong dstPtr, jboolean pcBool) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
SkPath* dst = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(dstPtr));
std::unique_ptr<SkMatrix> matrix = skMatrix(env, matrixArr);
// SkApplyPerspectiveClip is deleted on skia side, ignore
instance->transform(*matrix, dst);
}
extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_PathKt__1nSetLastPt
(JNIEnv* env, jclass jclass, jlong ptr, jfloat x, jfloat y) {
SkPath* instance = reinterpret_cast<SkPath*>(static_cast<uintptr_t>(ptr));
instance->setLastPt(x, y);
}
...@@ -217,21 +217,6 @@ SKIKO_EXPORT KBoolean org_jetbrains_skia_Path__1nIsRect ...@@ -217,21 +217,6 @@ SKIKO_EXPORT KBoolean org_jetbrains_skia_Path__1nIsRect
} }
} }
SKIKO_EXPORT void org_jetbrains_skia_Path__1nOffset
(KNativePointer ptr, KFloat dx, KFloat dy, KNativePointer dstPtr) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPath* dst = reinterpret_cast<SkPath*>((dstPtr));
*dst = instance->makeOffset(dx, dy);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nTransform
(KNativePointer ptr, KFloat* matrixArr, KNativePointer dstPtr) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPath* dst = reinterpret_cast<SkPath*>((dstPtr));
std::unique_ptr<SkMatrix> matrix = skMatrix(matrixArr);
*dst = instance->makeTransform(*matrix);
}
SKIKO_EXPORT KBoolean org_jetbrains_skia_Path__1nGetLastPt SKIKO_EXPORT KBoolean org_jetbrains_skia_Path__1nGetLastPt
(KNativePointer ptr, KInteropPointer resultArray) { (KNativePointer ptr, KInteropPointer resultArray) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr)); SkPath* instance = reinterpret_cast<SkPath*>((ptr));
...@@ -417,3 +402,198 @@ SKIKO_EXPORT KNativePointer org_jetbrains_skia_Path__1nMakeFromPolygon ...@@ -417,3 +402,198 @@ SKIKO_EXPORT KNativePointer org_jetbrains_skia_Path__1nMakeFromPolygon
SkPath* instance = new SkPath(path); SkPath* instance = new SkPath(path);
return reinterpret_cast<KNativePointer>(instance); return reinterpret_cast<KNativePointer>(instance);
} }
// ================ DEPRECATED ================
SKIKO_EXPORT void org_jetbrains_skia_Path__1nReset(KNativePointer ptr) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->reset();
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nRewind(KNativePointer ptr) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->rewind();
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nUpdateBoundsCache(KNativePointer ptr) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->updateBoundsCache();
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nIncReserve(KNativePointer ptr, int extraPtCount) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->incReserve(extraPtCount);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nMoveTo(KNativePointer ptr, KFloat x, KFloat y) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->moveTo(x, y);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nRMoveTo(KNativePointer ptr, KFloat dx, KFloat dy) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->rMoveTo(dx, dy);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nLineTo(KNativePointer ptr, KFloat x, KFloat y) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->lineTo(x, y);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nRLineTo(KNativePointer ptr, KFloat dx, KFloat dy) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->rLineTo(dx, dy);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nQuadTo(KNativePointer ptr, KFloat x1, KFloat y1, KFloat x2, KFloat y2) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->quadTo(x1, y1, x2, y2);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nRQuadTo(KNativePointer ptr, KFloat dx1, KFloat dy1, KFloat dx2, KFloat dy2) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->rQuadTo(dx1, dy1, dx2, dy2);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nConicTo(KNativePointer ptr, KFloat x1, KFloat y1, KFloat x2, KFloat y2, KFloat w) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->conicTo(x1, y1, x2, y2, w);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nRConicTo(KNativePointer ptr, KFloat dx1, KFloat dy1, KFloat dx2, KFloat dy2, KFloat w) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->rConicTo(dx1, dy1, dx2, dy2, w);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nCubicTo(KNativePointer ptr, KFloat x1, KFloat y1, KFloat x2, KFloat y2, KFloat x3, KFloat y3) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->cubicTo(x1, y1, x2, y2, x3, y3);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nRCubicTo(KNativePointer ptr, KFloat dx1, KFloat dy1, KFloat dx2, KFloat dy2, KFloat dx3, KFloat dy3) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->rCubicTo(dx1, dy1, dx2, dy2, dx3, dy3);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nArcTo(KNativePointer ptr, KFloat left, KFloat top, KFloat right, KFloat bottom, KFloat startAngle, KFloat sweepAngle, KBoolean forceMoveTo) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->arcTo({left, top, right, bottom}, startAngle, sweepAngle, forceMoveTo);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nTangentArcTo(KNativePointer ptr, KFloat x1, KFloat y1, KFloat x2, KFloat y2, KFloat radius) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->arcTo(x1, y1, x2, y2, radius);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nEllipticalArcTo(KNativePointer ptr, KFloat rx, KFloat ry, KFloat xAxisRotate, KInt size, KInt direction, KFloat x, float y) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->arcTo(rx, ry, xAxisRotate, static_cast<SkPath::ArcSize>(size), static_cast<SkPathDirection>(direction), x, y);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nREllipticalArcTo(KNativePointer ptr, KFloat rx, KFloat ry, KFloat xAxisRotate, KInt size, KInt direction, KFloat dx, float dy) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->rArcTo(rx, ry, xAxisRotate, static_cast<SkPath::ArcSize>(size), static_cast<SkPathDirection>(direction), dx, dy);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nClosePath(KNativePointer ptr) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->close();
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nAddRect
(KNativePointer ptr, KFloat l, KFloat t, KFloat r, KFloat b, KInt dirInt, KInt start) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPathDirection dir = static_cast<SkPathDirection>(dirInt);
instance->addRect({l, t, r, b}, dir, start);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nAddOval
(KNativePointer ptr, KFloat l, KFloat t, KFloat r, KFloat b, KInt dirInt, KInt start) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPathDirection dir = static_cast<SkPathDirection>(dirInt);
instance->addOval({l, t, r, b}, dir, start);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nAddCircle
(KNativePointer ptr, KFloat x, KFloat y, KFloat r, KInt dirInt) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPathDirection dir = static_cast<SkPathDirection>(dirInt);
instance->addCircle(x, y, r, dir);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nAddArc
(KNativePointer ptr, KFloat l, KFloat t, KFloat r, KFloat b, KFloat startAngle, KFloat sweepAngle) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->addArc({l, t, r, b}, startAngle, sweepAngle);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nAddRRect
(KNativePointer ptr, KFloat l, KFloat t, KFloat r, KFloat b, KFloat* radii, KInt radiiSize, KInt dirInt, KInt start) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkRRect rrect = skija::RRect::toSkRRect(l, t, r, b, radii, radiiSize);
SkPathDirection dir = static_cast<SkPathDirection>(dirInt);
instance->addRRect(rrect, dir, start);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nAddPoly
(KNativePointer ptr, KFloat* coords, KInt count, KBoolean close) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->addPoly({reinterpret_cast<SkPoint*>(coords), count}, close);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nAddPath
(KNativePointer ptr, KNativePointer srcPtr, KBoolean extend) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPath* src = reinterpret_cast<SkPath*>((srcPtr));
SkPath::AddPathMode mode = extend ? SkPath::AddPathMode::kExtend_AddPathMode : SkPath::AddPathMode::kAppend_AddPathMode;
instance->addPath(*src, mode);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nAddPathOffset
(KNativePointer ptr, KNativePointer srcPtr, KFloat dx, KFloat dy, KBoolean extend) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPath* src = reinterpret_cast<SkPath*>((srcPtr));
SkPath::AddPathMode mode = extend ? SkPath::AddPathMode::kExtend_AddPathMode : SkPath::AddPathMode::kAppend_AddPathMode;
instance->addPath(*src, dx, dy, mode);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nAddPathTransform
(KNativePointer ptr, KNativePointer srcPtr, KFloat* matrixArr, KBoolean extend) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPath* src = reinterpret_cast<SkPath*>((srcPtr));
std::unique_ptr<SkMatrix> matrix = skMatrix(matrixArr);
SkPath::AddPathMode mode = extend ? SkPath::AddPathMode::kExtend_AddPathMode : SkPath::AddPathMode::kAppend_AddPathMode;
instance->addPath(*src, *matrix, mode);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nReverseAddPath
(KNativePointer ptr, KNativePointer srcPtr) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPath* src = reinterpret_cast<SkPath*>((srcPtr));
instance->reverseAddPath(*src);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nOffset
(KNativePointer ptr, KFloat dx, KFloat dy, KNativePointer dstPtr) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPath* dst = reinterpret_cast<SkPath*>((dstPtr));
*dst = instance->makeOffset(dx, dy);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nTransform
(KNativePointer ptr, KFloat* matrixArr, KNativePointer dstPtr, KBoolean pcBool) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
SkPath* dst = reinterpret_cast<SkPath*>((dstPtr));
std::unique_ptr<SkMatrix> matrix = skMatrix(matrixArr);
// SkApplyPerspectiveClip is deleted on skia side, ignore
instance->transform(*matrix, dst);
}
SKIKO_EXPORT void org_jetbrains_skia_Path__1nSetLastPt
(KNativePointer ptr, KFloat x, KFloat y) {
SkPath* instance = reinterpret_cast<SkPath*>((ptr));
instance->setLastPt(x, y);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment