You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
implement android.graphics.Path using skia
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "../sk_area/include/c/sk_font.h"
|
||||
#include "../sk_area/include/c/sk_image.h"
|
||||
#include "../sk_area/include/c/sk_typeface.h"
|
||||
#include "../sk_area/include/c/sk_types.h"
|
||||
|
||||
#include "generated_headers/android_graphics_Canvas.h"
|
||||
|
||||
@@ -105,3 +106,12 @@ JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1rotate_1and_1transla
|
||||
sk_canvas_translate(canvas, -tx, -ty);
|
||||
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawPath(JNIEnv *env, jclass class, jlong skia_canvas, jlong path_ptr, long skia_paint)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_paint_t *paint = (sk_paint_t *)_PTR(skia_paint);
|
||||
|
||||
sk_canvas_draw_path(canvas, path, paint);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,14 @@ JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1rotate
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1rotate_1and_1translate
|
||||
(JNIEnv *, jclass, jlong, jlong, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_drawPath
|
||||
* Signature: (JJJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawPath
|
||||
(JNIEnv *, jclass, jlong, jlong, jlong);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -10,306 +10,306 @@ extern "C" {
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: init1
|
||||
* Signature: ()I
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Path_init1
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_init1
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: init2
|
||||
* Signature: (I)I
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Path_init2
|
||||
(JNIEnv *, jclass, jint);
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_init2
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_reset
|
||||
* Signature: (I)V
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1reset
|
||||
(JNIEnv *, jclass, jint);
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rewind
|
||||
* Signature: (I)V
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rewind
|
||||
(JNIEnv *, jclass, jint);
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_set
|
||||
* Signature: (II)V
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1set
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_getFillType
|
||||
* Signature: (I)I
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Path_native_1getFillType
|
||||
(JNIEnv *, jclass, jint);
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_setFillType
|
||||
* Signature: (II)V
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1setFillType
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
(JNIEnv *, jclass, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_isEmpty
|
||||
* Signature: (I)Z
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Path_native_1isEmpty
|
||||
(JNIEnv *, jclass, jint);
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_isRect
|
||||
* Signature: (ILandroid/graphics/RectF;)Z
|
||||
* Signature: (JLandroid/graphics/RectF;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Path_native_1isRect
|
||||
(JNIEnv *, jclass, jint, jobject);
|
||||
(JNIEnv *, jclass, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_computeBounds
|
||||
* Signature: (ILandroid/graphics/RectF;)V
|
||||
* Signature: (JLandroid/graphics/RectF;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1computeBounds
|
||||
(JNIEnv *, jclass, jint, jobject);
|
||||
(JNIEnv *, jclass, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_incReserve
|
||||
* Signature: (II)V
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1incReserve
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
(JNIEnv *, jclass, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_moveTo
|
||||
* Signature: (IFF)V
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1moveTo
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat);
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rMoveTo
|
||||
* Signature: (IFF)V
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rMoveTo
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat);
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_lineTo
|
||||
* Signature: (IFF)V
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1lineTo
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat);
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rLineTo
|
||||
* Signature: (IFF)V
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rLineTo
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat);
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_quadTo
|
||||
* Signature: (IFFFF)V
|
||||
* Signature: (JFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1quadTo
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat, jfloat, jfloat);
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rQuadTo
|
||||
* Signature: (IFFFF)V
|
||||
* Signature: (JFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rQuadTo
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat, jfloat, jfloat);
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_cubicTo
|
||||
* Signature: (IFFFFFF)V
|
||||
* Signature: (JFFFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1cubicTo
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat);
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rCubicTo
|
||||
* Signature: (IFFFFFF)V
|
||||
* Signature: (JFFFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rCubicTo
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat);
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_arcTo
|
||||
* Signature: (ILandroid/graphics/RectF;FFZ)V
|
||||
* Signature: (JLandroid/graphics/RectF;FFZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1arcTo
|
||||
(JNIEnv *, jclass, jint, jobject, jfloat, jfloat, jboolean);
|
||||
(JNIEnv *, jclass, jlong, jobject, jfloat, jfloat, jboolean);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_close
|
||||
* Signature: (I)V
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1close
|
||||
(JNIEnv *, jclass, jint);
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addRect
|
||||
* Signature: (ILandroid/graphics/RectF;I)V
|
||||
* Signature: (JLandroid/graphics/RectF;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRect__ILandroid_graphics_RectF_2I
|
||||
(JNIEnv *, jclass, jint, jobject, jint);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRect__JLandroid_graphics_RectF_2I
|
||||
(JNIEnv *, jclass, jlong, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addRect
|
||||
* Signature: (IFFFFI)V
|
||||
* Signature: (JFFFFI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRect__IFFFFI
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat, jfloat, jfloat, jint);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRect__JFFFFI
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addOval
|
||||
* Signature: (ILandroid/graphics/RectF;I)V
|
||||
* Signature: (JLandroid/graphics/RectF;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addOval
|
||||
(JNIEnv *, jclass, jint, jobject, jint);
|
||||
(JNIEnv *, jclass, jlong, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addCircle
|
||||
* Signature: (IFFFI)V
|
||||
* Signature: (JFFFI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addCircle
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat, jfloat, jint);
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addArc
|
||||
* Signature: (ILandroid/graphics/RectF;FF)V
|
||||
* Signature: (JLandroid/graphics/RectF;FF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addArc
|
||||
(JNIEnv *, jclass, jint, jobject, jfloat, jfloat);
|
||||
(JNIEnv *, jclass, jlong, jobject, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addRoundRect
|
||||
* Signature: (ILandroid/graphics/RectF;FFI)V
|
||||
* Signature: (JLandroid/graphics/RectF;FFI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__ILandroid_graphics_RectF_2FFI
|
||||
(JNIEnv *, jclass, jint, jobject, jfloat, jfloat, jint);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__JLandroid_graphics_RectF_2FFI
|
||||
(JNIEnv *, jclass, jlong, jobject, jfloat, jfloat, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addRoundRect
|
||||
* Signature: (ILandroid/graphics/RectF;[FI)V
|
||||
* Signature: (JLandroid/graphics/RectF;[FI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__ILandroid_graphics_RectF_2_3FI
|
||||
(JNIEnv *, jclass, jint, jobject, jfloatArray, jint);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__JLandroid_graphics_RectF_2_3FI
|
||||
(JNIEnv *, jclass, jlong, jobject, jfloatArray, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addPath
|
||||
* Signature: (IIFF)V
|
||||
* Signature: (JJFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__IIFF
|
||||
(JNIEnv *, jclass, jint, jint, jfloat, jfloat);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJFF
|
||||
(JNIEnv *, jclass, jlong, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addPath
|
||||
* Signature: (II)V
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__II
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJ
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addPath
|
||||
* Signature: (IIJ)V
|
||||
* Signature: (JJJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__IIJ
|
||||
(JNIEnv *, jclass, jint, jint, jlong);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJJ
|
||||
(JNIEnv *, jclass, jlong, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_offset
|
||||
* Signature: (IFFI)V
|
||||
* Signature: (JFFJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1offset__IFFI
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat, jint);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1offset__JFFJ
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_offset
|
||||
* Signature: (IFF)V
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1offset__IFF
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1offset__JFF
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_setLastPoint
|
||||
* Signature: (IFF)V
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1setLastPoint
|
||||
(JNIEnv *, jclass, jint, jfloat, jfloat);
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_transform
|
||||
* Signature: (IJI)V
|
||||
* Signature: (JJJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1transform__IJI
|
||||
(JNIEnv *, jclass, jint, jlong, jint);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1transform__JJJ
|
||||
(JNIEnv *, jclass, jlong, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_transform
|
||||
* Signature: (IJ)V
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1transform__IJ
|
||||
(JNIEnv *, jclass, jint, jlong);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1transform__JJ
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_op
|
||||
* Signature: (IIII)Z
|
||||
* Signature: (JJIJ)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Path_native_1op
|
||||
(JNIEnv *, jclass, jint, jint, jint, jint);
|
||||
(JNIEnv *, jclass, jlong, jlong, jint, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: finalizer
|
||||
* Signature: (I)V
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_finalizer
|
||||
(JNIEnv *, jclass, jint);
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -116,10 +116,10 @@ JNIEXPORT jboolean JNICALL Java_android_graphics_Region_nativeSetRect
|
||||
/*
|
||||
* Class: android_graphics_Region
|
||||
* Method: nativeSetPath
|
||||
* Signature: (III)Z
|
||||
* Signature: (IJI)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Region_nativeSetPath
|
||||
(JNIEnv *, jclass, jint, jint, jint);
|
||||
(JNIEnv *, jclass, jint, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Region
|
||||
@@ -132,10 +132,10 @@ JNIEXPORT jboolean JNICALL Java_android_graphics_Region_nativeGetBounds
|
||||
/*
|
||||
* Class: android_graphics_Region
|
||||
* Method: nativeGetBoundaryPath
|
||||
* Signature: (II)Z
|
||||
* Signature: (IJ)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Region_nativeGetBoundaryPath
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
(JNIEnv *, jclass, jint, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Region
|
||||
|
||||
148
src/api-impl-jni/graphics/android_graphics_Path.c
Normal file
148
src/api-impl-jni/graphics/android_graphics_Path.c
Normal file
@@ -0,0 +1,148 @@
|
||||
#include "../sk_area/include/c/sk_path.h"
|
||||
#include <graphene.h>
|
||||
|
||||
#include "../defines.h"
|
||||
#include "../util.h"
|
||||
|
||||
#include "../generated_headers/android_graphics_Path.h"
|
||||
#include "include/c/sk_types.h"
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_init1(JNIEnv *env, jclass class)
|
||||
{
|
||||
return _INTPTR(sk_path_new());
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_init2(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
return _INTPTR(sk_path_clone(path));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_finalizer(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
if (path_ptr != -1)
|
||||
sk_path_delete(path);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rCubicTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_rcubic_to(path, x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rLineTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat x, jfloat y)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_rline_to(path, x, y);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1cubicTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_cubic_to(path, x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJJ(JNIEnv *env, jclass class, jlong path_ptr, jlong src_ptr, jlong matrix)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_t *src = (sk_path_t *)_PTR(src_ptr);
|
||||
sk_path_add_path(path, src, APPEND_SK_PATH_ADD_MODE);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Path_native_1getFillType(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
return sk_path_get_filltype(path);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1reset(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_reset(path);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1setFillType(JNIEnv *env, jclass class, jlong path_ptr, jint ft)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_set_filltype(path, ft);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1moveTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat x, jfloat y)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_move_to(path, x, y);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1close(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_close(path);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1lineTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat x, jfloat y)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_line_to(path, x, y);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rewind(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_rewind(path);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Path_native_1isEmpty(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
return !sk_path_count_points(path) && !sk_path_count_verbs(path);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1computeBounds(JNIEnv *env, jclass class, jlong path_ptr, jobject rect)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_rect_t bounds;
|
||||
sk_path_get_bounds(path, &bounds);
|
||||
_SET_FLOAT_FIELD(rect, "left", bounds.left);
|
||||
_SET_FLOAT_FIELD(rect, "top", bounds.top);
|
||||
_SET_FLOAT_FIELD(rect, "right", bounds.right);
|
||||
_SET_FLOAT_FIELD(rect, "bottom", bounds.bottom);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1arcTo(JNIEnv *env, jclass class, jlong path_ptr, jobject oval, jfloat startAngle, jfloat sweepAngle, jboolean forceMoveTo)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
float left = _GET_FLOAT_FIELD(oval, "left");
|
||||
float top = _GET_FLOAT_FIELD(oval, "top");
|
||||
float right = _GET_FLOAT_FIELD(oval, "right");
|
||||
float bottom = _GET_FLOAT_FIELD(oval, "bottom");
|
||||
sk_path_arc_to_with_oval(path, &(sk_rect_t){left, top, right, bottom}, startAngle, sweepAngle, forceMoveTo);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRect__JLandroid_graphics_RectF_2I(JNIEnv *env, jclass class, jlong path_ptr, jobject rect, jint dir)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
float left = _GET_FLOAT_FIELD(rect, "left");
|
||||
float top = _GET_FLOAT_FIELD(rect, "top");
|
||||
float right = _GET_FLOAT_FIELD(rect, "right");
|
||||
float bottom = _GET_FLOAT_FIELD(rect, "bottom");
|
||||
sk_path_add_rect(path, &(sk_rect_t){left, top, right, bottom}, (sk_path_direction_t)dir);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1transform__JJ(JNIEnv *env, jclass class, jlong path_ptr, jlong matrix_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
graphene_matrix_t *matrix = (graphene_matrix_t *)_PTR(matrix_ptr);
|
||||
float v[16];
|
||||
graphene_matrix_to_float(matrix, v);
|
||||
sk_matrix_t m = {v[0], v[1], v[3], v[4], v[5], v[7], v[12], v[13], v[15]};
|
||||
sk_path_transform(path, &m);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Path_native_1op(JNIEnv *env, jclass class, jlong path_ptr, jlong other_ptr, jint op, jlong result_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_t *other = (sk_path_t *)_PTR(other_ptr);
|
||||
sk_path_t *result = (sk_path_t *)_PTR(result_ptr);
|
||||
return sk_pathop_op(path, other, (sk_pathop_t)op, result);
|
||||
}
|
||||
Reference in New Issue
Block a user