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
reimplement Bitmap and Path using GdkTexture and GskPath
This allows us to use GskCanvas for Bitmap rendering This increases the required GTK version to >= 4.14.
This commit is contained in:
@@ -84,8 +84,6 @@ libandroid_so = shared_library('android', [
|
||||
libtranslationlayer_so = shared_library('translation_layer_main', [
|
||||
'src/api-impl-jni/android_app_NativeActivity.c',
|
||||
'src/api-impl-jni/android_content_res_AssetManager.c',
|
||||
'src/api-impl-jni/android_graphics_Bitmap.c',
|
||||
'src/api-impl-jni/android_graphics_Canvas.c',
|
||||
'src/api-impl-jni/android_graphics_Paint.c',
|
||||
'src/api-impl-jni/android_opengl_GLES20.c',
|
||||
'src/api-impl-jni/android_os_Environment.c',
|
||||
@@ -111,6 +109,7 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
|
||||
'src/api-impl-jni/egl/com_google_android_gles_jni_EGLImpl.c',
|
||||
'src/api-impl-jni/graphics/NinePatchPaintable.c',
|
||||
'src/api-impl-jni/graphics/NinePatchPaintable.c',
|
||||
'src/api-impl-jni/graphics/android_graphics_Bitmap.c',
|
||||
'src/api-impl-jni/graphics/android_graphics_BitmapFactory.c',
|
||||
'src/api-impl-jni/graphics/android_graphics_GskCanvas.c',
|
||||
'src/api-impl-jni/graphics/android_graphics_Matrix.c',
|
||||
@@ -157,7 +156,7 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
|
||||
install_dir : get_option('libdir') / 'java/dex/android_translation_layer/natives',
|
||||
install_rpath: '$ORIGIN/:' + get_option('prefix') / get_option('libdir') / 'art',
|
||||
dependencies: [
|
||||
dependency('gtk4', version: '>=4.8'), dependency('gl'), dependency('egl'), dependency('wayland-client'), dependency('jni'),
|
||||
dependency('gtk4', version: '>=4.14'), dependency('gl'), dependency('egl'), dependency('wayland-client'), dependency('jni'),
|
||||
dependency('libportal'), dependency('sqlite3'), libskia_dep, dependency('libavcodec', version: '>=59'), dependency('libdrm'),
|
||||
dependency('gudev-1.0'), dependency('libswscale'), dependency('webkitgtk-6.0'),
|
||||
libandroidfw_dep
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "defines.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "../sk_area/include/c/sk_data.h"
|
||||
#include "../sk_area/include/c/sk_image.h"
|
||||
|
||||
#include "generated_headers/android_graphics_Bitmap.h"
|
||||
|
||||
void attach_sk_image(GdkPixbuf *pixbuf)
|
||||
{
|
||||
sk_imageinfo_t info = {
|
||||
.width = gdk_pixbuf_get_width(pixbuf),
|
||||
.height = gdk_pixbuf_get_height(pixbuf),
|
||||
.colorType = RGBA_8888_SK_COLORTYPE,
|
||||
.alphaType = UNPREMUL_SK_ALPHATYPE,
|
||||
};
|
||||
|
||||
void *pixbuf_pixels = gdk_pixbuf_get_pixels(pixbuf);
|
||||
int rowstride = gdk_pixbuf_get_rowstride(pixbuf);
|
||||
size_t pixbuf_size = rowstride * (info.height - 1)
|
||||
+ /* last row: */ info.width * ((gdk_pixbuf_get_n_channels(pixbuf) * gdk_pixbuf_get_bits_per_sample(pixbuf) + 7) / 8);
|
||||
/* use the data as-is, and don't ever free it because the pixbuf owns it */
|
||||
sk_data_t *pixels = sk_data_new_with_proc(pixbuf_pixels, pixbuf_size, NULL, NULL);
|
||||
|
||||
sk_image_t *image = sk_image_new_raster_data(&info, pixels, rowstride);
|
||||
g_object_set_data(G_OBJECT(pixbuf), "sk_image", image);
|
||||
}
|
||||
|
||||
/*
|
||||
* We use a GdkPixbuf as the backing for a bitmap.
|
||||
* We additionally create a view into it as a skia image,
|
||||
* so we can pass it to skia functions.
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1bitmap_1from_1path(JNIEnv *env, jobject this, jobject path)
|
||||
{
|
||||
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(_CSTRING(path), NULL);
|
||||
android_log_printf(ANDROID_LOG_VERBOSE, "["__FILE__"]", ">>> made pixbuf from path: >%s<, >%p<\n", _CSTRING(path), pixbuf);
|
||||
if(gdk_pixbuf_get_n_channels(pixbuf) == 3) { // no alpha, add it (skia doesn't support 24bpp)
|
||||
GdkPixbuf *old_pixbuf = pixbuf;
|
||||
pixbuf = gdk_pixbuf_add_alpha(pixbuf, false, 0, 0, 0);
|
||||
g_object_unref(old_pixbuf);
|
||||
}
|
||||
|
||||
attach_sk_image(pixbuf);
|
||||
|
||||
return _INTPTR(pixbuf);
|
||||
}
|
||||
/* new empty bitmap */
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1create(JNIEnv *env, jclass this, jint width, jint height)
|
||||
{
|
||||
GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, width, height);
|
||||
|
||||
attach_sk_image(pixbuf);
|
||||
|
||||
return _INTPTR(pixbuf);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_getWidth(JNIEnv *env, jobject this)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _PTR(_GET_LONG_FIELD(this, "pixbuf"));
|
||||
if (!pixbuf) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
return gdk_pixbuf_get_width(pixbuf);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_getHeight(JNIEnv *env, jobject this)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _PTR(_GET_LONG_FIELD(this, "pixbuf"));
|
||||
if (!pixbuf) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
return gdk_pixbuf_get_height(pixbuf);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeGetPixels(JNIEnv *env, jclass, jlong bitmapHandle, jintArray pixelArray, jint offset, jint stride, jint x, jint y, jint width, jint height, jboolean premultiplied)
|
||||
{
|
||||
int i,j;
|
||||
GdkPixbuf *pixbuf = _PTR(bitmapHandle);
|
||||
g_assert(gdk_pixbuf_get_n_channels(pixbuf) == 4);
|
||||
g_assert(gdk_pixbuf_get_colorspace(pixbuf) == GDK_COLORSPACE_RGB);
|
||||
jint *dst = (*env)->GetIntArrayElements(env, pixelArray, NULL);
|
||||
jint *d = dst + offset;
|
||||
const guint8 *src = gdk_pixbuf_read_pixels(pixbuf);
|
||||
int rowstride = gdk_pixbuf_get_rowstride(pixbuf);
|
||||
src += y * rowstride + x;
|
||||
for (i=0; i<height; i++) {
|
||||
for (j=0; j<width; j++) {
|
||||
d[j] = src[4*j+3] << 24 | src[4*j+0] << 16 | src[4*j+1] << 8 | src[4*j+2];
|
||||
}
|
||||
d += stride;
|
||||
src += rowstride;
|
||||
}
|
||||
(*env)->ReleaseIntArrayElements(env, pixelArray, dst, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Bitmap_nativeRecycle(JNIEnv *env, jclass, jlong bitmapHandle, jlong textureHandle)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _PTR(bitmapHandle);
|
||||
GdkTexture *texture = _PTR(textureHandle);
|
||||
sk_image_t *image = g_object_get_data(G_OBJECT(pixbuf), "sk_image");
|
||||
if(image)
|
||||
sk_image_unref(image);
|
||||
else
|
||||
fprintf(stderr, "nativeRecycle: pixbuf doesn't have a skia image associated: %p\n", pixbuf);
|
||||
g_object_unref(pixbuf);
|
||||
if (texture)
|
||||
g_object_unref(texture);
|
||||
return true;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1copy(JNIEnv *env, jclass, jlong src_ptr)
|
||||
{
|
||||
GdkPixbuf *src = _PTR(src_ptr);
|
||||
GdkPixbuf *copy = gdk_pixbuf_copy(src);
|
||||
sk_image_t *image = g_object_get_data(G_OBJECT(src), "sk_image");
|
||||
if(image)
|
||||
g_object_set_data(G_OBJECT(copy), "sk_image", sk_image_make_raster_image(image)); // probably?
|
||||
else
|
||||
fprintf(stderr, "native_copy: pixbuf doesn't have a skia image associated: %p\n", src);
|
||||
return _INTPTR(copy);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1subpixbuf(JNIEnv *env, jclass, jlong _pixbuf, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _PTR(_pixbuf);
|
||||
GdkPixbuf *subpixbuf = gdk_pixbuf_new_subpixbuf(pixbuf, x, y, width, height);
|
||||
attach_sk_image(subpixbuf);
|
||||
return _INTPTR(subpixbuf);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_nativeRowBytes(JNIEnv *env, jclass, jlong pixbuf_ptr)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _PTR(pixbuf_ptr);
|
||||
|
||||
return gdk_pixbuf_get_rowstride(pixbuf);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1paintable_1from_1pixbuf(JNIEnv *env, jclass, jlong pixbuf_ptr)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _PTR(pixbuf_ptr);
|
||||
return _INTPTR(gdk_texture_new_for_pixbuf(pixbuf));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeCopyPixelsToBuffer(JNIEnv *env, jclass this, jlong _pixbuf, jobject buffer)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _PTR(_pixbuf);
|
||||
size_t pixbuf_size = gdk_pixbuf_get_rowstride(pixbuf) * (gdk_pixbuf_get_height(pixbuf) - 1)
|
||||
+ /* last row: */ gdk_pixbuf_get_width(pixbuf) * ((gdk_pixbuf_get_n_channels(pixbuf) * gdk_pixbuf_get_bits_per_sample(pixbuf) + 7) / 8);
|
||||
jarray array_ref;
|
||||
jbyte *array;
|
||||
uint8_t *pixels = get_nio_buffer(env, buffer, &array_ref, &array);
|
||||
memcpy(pixels, gdk_pixbuf_get_pixels(pixbuf), pixbuf_size);
|
||||
release_nio_buffer(env, array_ref, array);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeCopyPixelsFromBuffer(JNIEnv *env, jclass this, jlong _pixbuf, jobject buffer)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _PTR(_pixbuf);
|
||||
size_t pixbuf_size = gdk_pixbuf_get_rowstride(pixbuf) * (gdk_pixbuf_get_height(pixbuf) - 1)
|
||||
+ /* last row: */ gdk_pixbuf_get_width(pixbuf) * ((gdk_pixbuf_get_n_channels(pixbuf) * gdk_pixbuf_get_bits_per_sample(pixbuf) + 7) / 8);
|
||||
jarray array_ref;
|
||||
jbyte *array;
|
||||
uint8_t *pixels = get_nio_buffer(env, buffer, &array_ref, &array);
|
||||
memcpy(gdk_pixbuf_get_pixels(pixbuf), pixels, pixbuf_size);
|
||||
release_nio_buffer(env, array_ref, array);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_native_1unref_1texture(JNIEnv *env, jclass class, jlong texture_ptr)
|
||||
{
|
||||
GdkTexture *texture = GDK_TEXTURE(_PTR(texture_ptr));
|
||||
g_object_unref(texture);
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "defines.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "../sk_area/include/c/sk_canvas.h"
|
||||
#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"
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Canvas_native_1canvas_1from_1bitmap(JNIEnv *env, jclass this, jlong _pixbuf)
|
||||
{
|
||||
GdkPixbuf *pixbuf = (GdkPixbuf *)_PTR(_pixbuf);
|
||||
|
||||
/* - copied from bitmap (TODO: refactor) - */
|
||||
sk_imageinfo_t info = {
|
||||
.width = gdk_pixbuf_get_width(pixbuf),
|
||||
.height = gdk_pixbuf_get_height(pixbuf),
|
||||
.colorType = RGBA_8888_SK_COLORTYPE, // is this correct?
|
||||
.alphaType = PREMUL_SK_ALPHATYPE,
|
||||
};
|
||||
void *pixbuf_pixels = gdk_pixbuf_get_pixels(pixbuf);
|
||||
int rowstride = gdk_pixbuf_get_rowstride(pixbuf);
|
||||
// size_t pixbuf_size = rowstride * (info.height - 1)
|
||||
// + /* last row: */ info.width * ((gdk_pixbuf_get_n_channels(pixbuf) * gdk_pixbuf_get_bits_per_sample(pixbuf) + 7) / 8);
|
||||
/* --------------------------------------- */
|
||||
|
||||
return _INTPTR(sk_canvas_new_from_raster(&info, pixbuf_pixels, /*pixbuf_size*/rowstride, NULL));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1save(JNIEnv *env, jclass this, jlong skia_canvas, jlong widget)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
|
||||
sk_canvas_save(canvas);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1restore(JNIEnv *env, jclass this, jlong skia_canvas, jlong widget)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
|
||||
sk_canvas_restore(canvas);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawLine(JNIEnv *env, jclass this_class, jlong skia_canvas, jlong widget, jfloat start_x, jfloat start_y, jfloat stop_x, jfloat stop_y, jlong skia_paint)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
sk_paint_t *paint = (sk_paint_t *)_PTR(skia_paint);
|
||||
|
||||
sk_canvas_draw_line(canvas, start_x, start_y, stop_x, stop_y, paint);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawBitmap(JNIEnv *env , jclass this_class, jlong skia_canvas, jlong widget, jlong _pixbuf,
|
||||
jfloat src_left, jfloat src_top, jfloat src_right, jfloat src_bottom,
|
||||
jfloat dst_left, jfloat dst_top, jfloat dst_right, jfloat dst_bottom,
|
||||
jlong skia_paint)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
GdkPixbuf *pixbuf = (GdkPixbuf *)_PTR(_pixbuf);
|
||||
sk_paint_t *paint = (sk_paint_t *)_PTR(skia_paint);
|
||||
|
||||
sk_image_t *image = g_object_get_data(G_OBJECT(pixbuf), "sk_image");
|
||||
if(!image) {
|
||||
fprintf(stderr, "drawBitmap: pixbuf doesn't have a skia image associated: %p\n", pixbuf);
|
||||
return;
|
||||
}
|
||||
sk_canvas_draw_image_rect(canvas, image, &(sk_rect_t){src_left, src_top, src_right, src_bottom},
|
||||
&(sk_rect_t){dst_left, dst_top, dst_right, dst_bottom}, paint);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawRect(JNIEnv *env, jclass this, jlong skia_canvas, jfloat left, jfloat top, jfloat right, jfloat bottom, jlong skia_paint)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
sk_paint_t *paint = (sk_paint_t *)_PTR(skia_paint);
|
||||
|
||||
sk_canvas_draw_rect(canvas, &(sk_rect_t){left, top, right, bottom}, paint);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawText(JNIEnv *env, jclass this, jlong skia_canvas, jobject _text, jint start, jint end, jfloat x, jfloat y, jlong skia_font, jlong skia_paint)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
sk_paint_t *paint = (sk_paint_t *)_PTR(skia_paint);
|
||||
sk_font_t *font = _PTR(skia_font);
|
||||
|
||||
const char *text = _CSTRING(_text);
|
||||
|
||||
sk_canvas_draw_simple_text(canvas, text + start, end - start, UTF8_SK_TEXT_ENCODING, x, y, font, paint);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1rotate(JNIEnv *env, jclass this, jlong skia_canvas, jlong widget, jfloat angle)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
|
||||
sk_canvas_rotate_degrees(canvas, angle);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1rotate_1and_1translate(JNIEnv *env, jclass this, jlong skia_canvas, jlong widget, jfloat angle, jfloat tx, jfloat ty)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
|
||||
sk_canvas_translate(canvas, tx, ty);
|
||||
sk_canvas_rotate_degrees(canvas, angle);
|
||||
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, jlong 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);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1destroy_1canvas(JNIEnv *env, jclass class, jlong skia_canvas)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
sk_canvas_destroy(canvas);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1scale(JNIEnv *env, jclass class, jlong skia_canvas, jfloat sx, jfloat sy)
|
||||
{
|
||||
sk_canvas_t *canvas = (sk_canvas_t *)_PTR(skia_canvas);
|
||||
sk_canvas_scale(canvas, sx, sy);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <libportal/portal.h>
|
||||
|
||||
#include "../defines.h"
|
||||
@@ -12,14 +12,14 @@ static void wallpaper_ready_cb(GObject *source, GAsyncResult *res, gpointer user
|
||||
g_object_unref(file);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_app_WallpaperManager_set_1bitmap(JNIEnv *env, jclass clazz, jlong pixbuf_ptr)
|
||||
JNIEXPORT void JNICALL Java_android_app_WallpaperManager_set_1bitmap(JNIEnv *env, jclass clazz, jlong texture_ptr)
|
||||
{
|
||||
GdkPixbuf *pixbuf = _PTR(pixbuf_ptr);
|
||||
GdkTexture *texture = _PTR(texture_ptr);
|
||||
GFileIOStream *stream;
|
||||
GFile *file = g_file_new_tmp("XXXXXX.png", &stream, NULL);
|
||||
g_io_stream_close(G_IO_STREAM(stream), NULL, NULL);
|
||||
g_object_unref(stream);
|
||||
gdk_pixbuf_save(pixbuf, g_file_get_path(file), "png", NULL, NULL);
|
||||
gdk_texture_save_to_png(texture, g_file_get_path(file));
|
||||
XdpPortal *portal = xdp_portal_new();
|
||||
xdp_portal_set_wallpaper(portal, NULL, g_file_get_uri(file), XDP_WALLPAPER_FLAG_NONE, NULL, wallpaper_ready_cb, file);
|
||||
g_object_unref(portal);
|
||||
|
||||
@@ -7,241 +7,53 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#undef android_graphics_Bitmap_DENSITY_NONE
|
||||
#define android_graphics_Bitmap_DENSITY_NONE 0L
|
||||
#undef android_graphics_Bitmap_WORKING_COMPRESS_STORAGE
|
||||
#define android_graphics_Bitmap_WORKING_COMPRESS_STORAGE 4096L
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: getWidth
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_getWidth
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: getHeight
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_getHeight
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: native_bitmap_from_path
|
||||
* Signature: (Ljava/lang/CharSequence;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1bitmap_1from_1path
|
||||
(JNIEnv *, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: native_copy
|
||||
* Method: native_create_snapshot
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1copy
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1create_1snapshot
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: native_subpixbuf
|
||||
* Signature: (JIIII)J
|
||||
* Method: native_create_texture
|
||||
* Signature: (JII)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1subpixbuf
|
||||
(JNIEnv *, jclass, jlong, jint, jint, jint, jint);
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1create_1texture
|
||||
(JNIEnv *, jclass, jlong, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: native_create
|
||||
* Signature: (II)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1create
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: native_paintable_from_pixbuf
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1paintable_1from_1pixbuf
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: native_unref_texture
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_native_1unref_1texture
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeCopy
|
||||
* Signature: (IIZ)Landroid/graphics/Bitmap;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_android_graphics_Bitmap_nativeCopy
|
||||
(JNIEnv *, jclass, jint, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeDestructor
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeDestructor
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeRecycle
|
||||
* Signature: (JJ)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Bitmap_nativeRecycle
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeReconfigure
|
||||
* Signature: (IIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeReconfigure
|
||||
(JNIEnv *, jclass, jint, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeCompress
|
||||
* Signature: (IIILjava/io/OutputStream;[B)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Bitmap_nativeCompress
|
||||
(JNIEnv *, jclass, jint, jint, jint, jobject, jbyteArray);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeErase
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeErase
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeRowBytes
|
||||
* Method: native_get_width
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_nativeRowBytes
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_native_1get_1width
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeConfig
|
||||
* Signature: (I)I
|
||||
* Method: native_get_height
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_nativeConfig
|
||||
(JNIEnv *, jclass, jint);
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_native_1get_1height
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeGetPixel
|
||||
* Signature: (IIIZ)I
|
||||
* Method: native_erase_color
|
||||
* Signature: (III)J
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_nativeGetPixel
|
||||
(JNIEnv *, jclass, jint, jint, jint, jboolean);
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1erase_1color
|
||||
(JNIEnv *, jclass, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeGetPixels
|
||||
* Signature: (J[IIIIIIIZ)V
|
||||
* Method: native_recycle
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeGetPixels
|
||||
(JNIEnv *, jclass, jlong, jintArray, jint, jint, jint, jint, jint, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeSetPixel
|
||||
* Signature: (IIIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeSetPixel
|
||||
(JNIEnv *, jclass, jint, jint, jint, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeSetPixels
|
||||
* Signature: (I[IIIIIIIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeSetPixels
|
||||
(JNIEnv *, jclass, jint, jintArray, jint, jint, jint, jint, jint, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeCopyPixelsToBuffer
|
||||
* Signature: (JLjava/nio/Buffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeCopyPixelsToBuffer
|
||||
(JNIEnv *, jclass, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeCopyPixelsFromBuffer
|
||||
* Signature: (JLjava/nio/Buffer;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeCopyPixelsFromBuffer
|
||||
(JNIEnv *, jclass, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeGenerationId
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_nativeGenerationId
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeExtractAlpha
|
||||
* Signature: (II[I)Landroid/graphics/Bitmap;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_android_graphics_Bitmap_nativeExtractAlpha
|
||||
(JNIEnv *, jclass, jint, jint, jintArray);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativePrepareToDraw
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativePrepareToDraw
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeSetAlphaAndPremultiplied
|
||||
* Signature: (IZZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeSetAlphaAndPremultiplied
|
||||
(JNIEnv *, jclass, jint, jboolean, jboolean);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeHasMipMap
|
||||
* Signature: (I)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Bitmap_nativeHasMipMap
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeSetHasMipMap
|
||||
* Signature: (IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_nativeSetHasMipMap
|
||||
(JNIEnv *, jclass, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Bitmap
|
||||
* Method: nativeSameAs
|
||||
* Signature: (II)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Bitmap_nativeSameAs
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_native_1recycle
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class android_graphics_Canvas */
|
||||
|
||||
#ifndef _Included_android_graphics_Canvas
|
||||
#define _Included_android_graphics_Canvas
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#undef android_graphics_Canvas_HAS_ALPHA_LAYER_SAVE_FLAG
|
||||
#define android_graphics_Canvas_HAS_ALPHA_LAYER_SAVE_FLAG 4L
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_canvas_from_bitmap
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Canvas_native_1canvas_1from_1bitmap
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_save
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1save
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_restore
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1restore
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_drawText
|
||||
* Signature: (JLjava/lang/CharSequence;IIFFJJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawText
|
||||
(JNIEnv *, jclass, jlong, jobject, jint, jint, jfloat, jfloat, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_drawRect
|
||||
* Signature: (JFFFFJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawRect
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_drawLine
|
||||
* Signature: (JJFFFFJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawLine
|
||||
(JNIEnv *, jclass, jlong, jlong, jfloat, jfloat, jfloat, jfloat, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_drawBitmap
|
||||
* Signature: (JJJFFFFFFFFJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawBitmap
|
||||
(JNIEnv *, jclass, jlong, jlong, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_rotate
|
||||
* Signature: (JJF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1rotate
|
||||
(JNIEnv *, jclass, jlong, jlong, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_rotate_and_translate
|
||||
* Signature: (JJFFF)V
|
||||
*/
|
||||
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);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_destroy_canvas
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1destroy_1canvas
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_scale
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1scale
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -9,164 +9,36 @@ extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: init1
|
||||
* Signature: ()J
|
||||
* Method: native_create_builder
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_init1
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_native_1create_1builder
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: init2
|
||||
* Method: native_create_path
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_init2
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_native_1create_1path
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_ref_path
|
||||
* Signature: (J)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_native_1ref_1path
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_reset
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1reset
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rewind
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rewind
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_set
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1set
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1reset
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_getFillType
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Path_native_1getFillType
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_setFillType
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1setFillType
|
||||
(JNIEnv *, jclass, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_isEmpty
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Path_native_1isEmpty
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_isRect
|
||||
* Signature: (JLandroid/graphics/RectF;)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Path_native_1isRect
|
||||
(JNIEnv *, jclass, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_computeBounds
|
||||
* Signature: (JLandroid/graphics/RectF;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1computeBounds
|
||||
(JNIEnv *, jclass, jlong, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_incReserve
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1incReserve
|
||||
(JNIEnv *, jclass, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_moveTo
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1moveTo
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rMoveTo
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rMoveTo
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_lineTo
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1lineTo
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rLineTo
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rLineTo
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_quadTo
|
||||
* Signature: (JFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1quadTo
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rQuadTo
|
||||
* Signature: (JFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rQuadTo
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_cubicTo
|
||||
* Signature: (JFFFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1cubicTo
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rCubicTo
|
||||
* Signature: (JFFFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rCubicTo
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_arcTo
|
||||
* Signature: (JLandroid/graphics/RectF;FFZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1arcTo
|
||||
(JNIEnv *, jclass, jlong, jobject, jfloat, jfloat, jboolean);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_close
|
||||
@@ -177,139 +49,83 @@ JNIEXPORT void JNICALL Java_android_graphics_Path_native_1close
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addRect
|
||||
* Signature: (JLandroid/graphics/RectF;I)V
|
||||
*/
|
||||
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: (JFFFFI)V
|
||||
*/
|
||||
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: (JLandroid/graphics/RectF;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addOval
|
||||
(JNIEnv *, jclass, jlong, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addCircle
|
||||
* Signature: (JFFFI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addCircle
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addArc
|
||||
* Signature: (JLandroid/graphics/RectF;FF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addArc
|
||||
(JNIEnv *, jclass, jlong, jobject, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addRoundRect
|
||||
* Signature: (JFFFFFFI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__JFFFFFFI
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jint);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addRoundRect
|
||||
* Signature: (JLandroid/graphics/RectF;[FI)V
|
||||
*/
|
||||
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: (JJFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJFF
|
||||
(JNIEnv *, jclass, jlong, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addPath
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJ
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_addPath
|
||||
* Signature: (JJJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJJ
|
||||
(JNIEnv *, jclass, jlong, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_offset
|
||||
* Signature: (JFFJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1offset__JFFJ
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_offset
|
||||
* Method: native_move_to
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1offset__JFF
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1move_1to
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_setLastPoint
|
||||
* Method: native_line_to
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1setLastPoint
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1line_1to
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_transform
|
||||
* Method: native_cubic_to
|
||||
* Signature: (JFFFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1cubic_1to
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_quad_to
|
||||
* Signature: (JFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1quad_1to
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rel_move_to
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rel_1move_1to
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rel_line_to
|
||||
* Signature: (JFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rel_1line_1to
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_rel_cubic_to
|
||||
* Signature: (JFFFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rel_1cubic_1to
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_add_path
|
||||
* Signature: (JJJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1transform__JJJ
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1add_1path
|
||||
(JNIEnv *, jclass, jlong, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_transform
|
||||
* Signature: (JJ)V
|
||||
* Method: native_add_rect
|
||||
* Signature: (JFFFF)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1transform__JJ
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1add_1rect
|
||||
(JNIEnv *, jclass, jlong, jfloat, jfloat, jfloat, jfloat);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: native_op
|
||||
* Signature: (JJIJ)Z
|
||||
* Method: native_get_bounds
|
||||
* Signature: (JLandroid/graphics/RectF;)V
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Path_native_1op
|
||||
(JNIEnv *, jclass, jlong, jlong, jint, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Path
|
||||
* Method: finalizer
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_finalizer
|
||||
(JNIEnv *, jclass, jlong);
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1get_1bounds
|
||||
(JNIEnv *, jclass, jlong, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -207,14 +207,6 @@ extern "C" {
|
||||
JNIEXPORT jlong JNICALL Java_android_widget_ImageButton_native_1constructor
|
||||
(JNIEnv *, jobject, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_widget_ImageButton
|
||||
* Method: native_setPixbuf
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageButton_native_1setPixbuf
|
||||
(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_widget_ImageButton
|
||||
* Method: native_setDrawable
|
||||
|
||||
@@ -207,14 +207,6 @@ extern "C" {
|
||||
JNIEXPORT jlong JNICALL Java_android_widget_ImageView_native_1constructor
|
||||
(JNIEnv *, jobject, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_widget_ImageView
|
||||
* Method: native_setPixbuf
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setPixbuf
|
||||
(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_widget_ImageView
|
||||
* Method: native_setDrawable
|
||||
|
||||
75
src/api-impl-jni/graphics/android_graphics_Bitmap.c
Normal file
75
src/api-impl-jni/graphics/android_graphics_Bitmap.c
Normal file
@@ -0,0 +1,75 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "../defines.h"
|
||||
|
||||
#include "../generated_headers/android_graphics_Bitmap.h"
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1create_1snapshot(JNIEnv *env, jclass class, jlong texture_ptr)
|
||||
{
|
||||
GtkSnapshot *snapshot = gtk_snapshot_new();
|
||||
if (texture_ptr) {
|
||||
GdkTexture *texture = GDK_TEXTURE(_PTR(texture_ptr));
|
||||
gtk_snapshot_append_texture(snapshot, texture, &GRAPHENE_RECT_INIT(0, 0, gdk_texture_get_width(texture), gdk_texture_get_height(texture)));
|
||||
g_object_unref(texture);
|
||||
}
|
||||
return _INTPTR(snapshot);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1create_1texture(JNIEnv *env, jclass class, jlong snapshot_ptr, jint width, jint height)
|
||||
{
|
||||
GtkSnapshot *snapshot = _PTR(snapshot_ptr);
|
||||
static GType renderer_type = 0;
|
||||
if (!renderer_type) {
|
||||
// Use same renderer type as for onscreen rendering.
|
||||
GdkSurface *surface = gdk_surface_new_toplevel(gdk_display_get_default());
|
||||
GskRenderer *renderer = gsk_renderer_new_for_surface(surface);
|
||||
renderer_type = G_OBJECT_TYPE(renderer);
|
||||
gsk_renderer_unrealize(renderer);
|
||||
g_object_unref(renderer);
|
||||
gdk_surface_destroy(surface);
|
||||
}
|
||||
GskRenderer *renderer = g_object_new(renderer_type, NULL);
|
||||
gsk_renderer_realize(renderer, NULL, NULL);
|
||||
GskRenderNode *node = snapshot ? gtk_snapshot_free_to_node(snapshot) : NULL;
|
||||
graphene_rect_t bounds = GRAPHENE_RECT_INIT(0, 0, width, height);
|
||||
if (!node)
|
||||
node = gsk_color_node_new(&(GdkRGBA){.alpha = 0}, &bounds);
|
||||
GdkTexture *texture = gsk_renderer_render_texture(renderer, node, &bounds);
|
||||
gsk_render_node_unref(node);
|
||||
gsk_renderer_unrealize(renderer);
|
||||
g_object_unref(renderer);
|
||||
|
||||
return _INTPTR(texture);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_native_1get_1width(JNIEnv *env, jclass class, jlong texture_ptr)
|
||||
{
|
||||
return gdk_texture_get_width(GDK_TEXTURE(_PTR(texture_ptr)));
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Bitmap_native_1get_1height(JNIEnv *env, jclass class, jlong texture_ptr)
|
||||
{
|
||||
return gdk_texture_get_height(GDK_TEXTURE(_PTR(texture_ptr)));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Bitmap_native_1erase_1color(JNIEnv *env, jclass class, jint color, jint width, jint height)
|
||||
{
|
||||
GdkRGBA rgba = {
|
||||
.red = ((color >> 16) & 0xFF) / 255.f,
|
||||
.green = ((color >> 8) & 0xFF) / 255.f,
|
||||
.blue = ((color >> 0) & 0xFF) / 255.f,
|
||||
.alpha = ((color >> 24) & 0xFF) / 255.f,
|
||||
};
|
||||
graphene_rect_t bounds = GRAPHENE_RECT_INIT(0, 0, width, height);
|
||||
GtkSnapshot *snapshot = gtk_snapshot_new();
|
||||
gtk_snapshot_append_color(snapshot, &rgba, &bounds);
|
||||
return _INTPTR(snapshot);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Bitmap_native_1recycle(JNIEnv *env, jclass class, jlong texture_ptr, jlong snapshot_ptr)
|
||||
{
|
||||
if (texture_ptr)
|
||||
g_object_unref(GDK_TEXTURE(_PTR(texture_ptr)));
|
||||
if (snapshot_ptr)
|
||||
g_object_unref(GTK_SNAPSHOT(_PTR(snapshot_ptr)));
|
||||
}
|
||||
@@ -56,5 +56,7 @@ JNIEXPORT jlong JNICALL Java_android_graphics_BitmapFactory_nativeDecodeStream(J
|
||||
|
||||
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_stream(stream, NULL, NULL);
|
||||
g_object_unref(stream);
|
||||
return _INTPTR(pixbuf);
|
||||
GdkTexture *texture = gdk_texture_new_for_pixbuf(pixbuf);
|
||||
g_object_unref(pixbuf);
|
||||
return _INTPTR(texture);
|
||||
}
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
|
||||
#include "include/c/sk_font.h"
|
||||
#include "include/c/sk_paint.h"
|
||||
#include "include/c/sk_path.h"
|
||||
|
||||
#include "../defines.h"
|
||||
#include "../util.h"
|
||||
|
||||
#include "../generated_headers/android_graphics_GskCanvas.h"
|
||||
|
||||
@@ -51,17 +49,18 @@ JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawRect(JNIEnv *
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawPath(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jlong path_ptr, jlong paint_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_iterator_t *iterator = sk_path_create_iter(path, 0);
|
||||
sk_path_verb_t verb;
|
||||
sk_point_t line[4];
|
||||
while ((verb = sk_path_iter_next(iterator, line)) != DONE_SK_PATH_VERB) {
|
||||
// TODO: use GskPath to support other verbs
|
||||
if (verb == LINE_SK_PATH_VERB) {
|
||||
Java_android_graphics_GskCanvas_native_1drawLine(env, this_class, snapshot_ptr, line[0].x, line[0].y, line[1].x, line[1].y, paint_ptr);
|
||||
}
|
||||
GtkSnapshot *snapshot = GTK_SNAPSHOT(_PTR(snapshot_ptr));
|
||||
GskPath *path = _PTR(path_ptr);
|
||||
sk_paint_t *paint = (sk_paint_t *)_PTR(paint_ptr);
|
||||
GdkRGBA gdk_color;
|
||||
sk_paint_get_color4f(paint, (sk_color4f_t *)&gdk_color);
|
||||
sk_paint_style_t style = sk_paint_get_style(paint);
|
||||
if (style == STROKE_SK_PAINT_STYLE || style == STROKE_AND_FILL_SK_PAINT_STYLE) {
|
||||
gtk_snapshot_append_stroke(snapshot, path, gsk_stroke_new(2), &gdk_color);
|
||||
}
|
||||
if (style == FILL_SK_PAINT_STYLE || style == STROKE_AND_FILL_SK_PAINT_STYLE) {
|
||||
gtk_snapshot_append_fill(snapshot, path, GSK_FILL_RULE_WINDING, &gdk_color);
|
||||
}
|
||||
sk_path_iter_destroy(iterator);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1translate(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jfloat dx, jfloat dy)
|
||||
|
||||
@@ -1,216 +1,142 @@
|
||||
#include "../sk_area/include/c/sk_path.h"
|
||||
#include <graphene.h>
|
||||
#include <gsk/gsk.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)
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_native_1create_1builder(JNIEnv *env, jclass this, jlong path_ptr)
|
||||
{
|
||||
return _INTPTR(sk_path_new());
|
||||
GskPathBuilder *builder = gsk_path_builder_new();
|
||||
if (path_ptr) {
|
||||
GskPath *path = _PTR(path_ptr);
|
||||
gsk_path_builder_add_path(builder, path);
|
||||
gsk_path_unref(path);
|
||||
}
|
||||
return _INTPTR(builder);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_init2(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_native_1create_1path(JNIEnv *env, jclass this, jlong builder_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
return _INTPTR(sk_path_clone(path));
|
||||
GskPathBuilder *builder = _PTR(builder_ptr);
|
||||
if (!builder)
|
||||
builder = gsk_path_builder_new();
|
||||
return _INTPTR(gsk_path_builder_free_to_path(builder));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_finalizer(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
JNIEXPORT jlong JNICALL Java_android_graphics_Path_native_1ref_1path(JNIEnv *env, jclass this, jlong path_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
if (path_ptr != -1)
|
||||
sk_path_delete(path);
|
||||
return _INTPTR(gsk_path_ref(_PTR(path_ptr)));
|
||||
}
|
||||
|
||||
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)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1reset(JNIEnv *env, jclass this, jlong path_ptr, jlong builder_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_rcubic_to(path, x1, y1, x2, y2, x3, y3);
|
||||
if (path_ptr)
|
||||
gsk_path_unref(_PTR(path_ptr));
|
||||
if (builder_ptr)
|
||||
gsk_path_builder_unref(_PTR(builder_ptr));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rLineTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat x, jfloat y)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1close(JNIEnv *env, jclass this, jlong builder_ptr)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_rline_to(path, x, y);
|
||||
gsk_path_builder_close(_PTR(builder_ptr));
|
||||
}
|
||||
|
||||
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)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1move_1to(JNIEnv *env, jclass this, jlong builder_ptr, jfloat x, jfloat y)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_cubic_to(path, x1, y1, x2, y2, x3, y3);
|
||||
gsk_path_builder_move_to(_PTR(builder_ptr), x, y);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJJ(JNIEnv *env, jclass class, jlong path_ptr, jlong src_ptr, jlong matrix)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1line_1to(JNIEnv *env, jclass this, jlong builder_ptr, jfloat x, jfloat y)
|
||||
{
|
||||
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);
|
||||
gsk_path_builder_line_to(_PTR(builder_ptr), x, y);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_graphics_Path_native_1getFillType(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1cubic_1to(JNIEnv *env, jclass this, jlong builder_ptr, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
return sk_path_get_filltype(path);
|
||||
gsk_path_builder_cubic_to(_PTR(builder_ptr), x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1reset(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1quad_1to(JNIEnv *env, jclass this, jlong builder_ptr, jfloat x1, jfloat y1, jfloat x2, jfloat y2)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_reset(path);
|
||||
gsk_path_builder_quad_to(_PTR(builder_ptr), x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1setFillType(JNIEnv *env, jclass class, jlong path_ptr, jint ft)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rel_1move_1to(JNIEnv *env, jclass this, jlong builder_ptr, jfloat x, jfloat y)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_set_filltype(path, ft);
|
||||
gsk_path_builder_rel_move_to(_PTR(builder_ptr), x, y);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1moveTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat x, jfloat y)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rel_1line_1to(JNIEnv *env, jclass this, jlong builder_ptr, jfloat x, jfloat y)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_move_to(path, x, y);
|
||||
gsk_path_builder_rel_line_to(_PTR(builder_ptr), x, y);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1close(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rel_1cubic_1to(JNIEnv *env, jclass this, jlong builder_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_close(path);
|
||||
gsk_path_builder_rel_cubic_to(_PTR(builder_ptr), x1, y1, x2, y2, x3, y3);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1lineTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat x, jfloat y)
|
||||
struct path_foreach_data {
|
||||
GskPathBuilder *builder;
|
||||
graphene_matrix_t *matrix;
|
||||
graphene_point_t tmp_pts[4];
|
||||
};
|
||||
static gboolean path_foreach_transform(GskPathOperation op, const graphene_point_t* pts, gsize n_pts, float weight, gpointer user_data)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_line_to(path, x, y);
|
||||
struct path_foreach_data *data = user_data;
|
||||
for (gsize i = 0; i < n_pts; i++) {
|
||||
graphene_matrix_transform_point(data->matrix, &pts[i], &data->tmp_pts[i]);
|
||||
}
|
||||
switch (op) {
|
||||
case GSK_PATH_MOVE:
|
||||
gsk_path_builder_move_to(data->builder, data->tmp_pts[0].x, data->tmp_pts[0].y);
|
||||
break;
|
||||
case GSK_PATH_CLOSE:
|
||||
gsk_path_builder_close(data->builder);
|
||||
break;
|
||||
case GSK_PATH_LINE:
|
||||
gsk_path_builder_line_to(data->builder, data->tmp_pts[1].x, data->tmp_pts[1].y);
|
||||
break;
|
||||
case GSK_PATH_QUAD:
|
||||
gsk_path_builder_quad_to(data->builder, data->tmp_pts[1].x, data->tmp_pts[1].y, data->tmp_pts[2].x, data->tmp_pts[2].y);
|
||||
break;
|
||||
case GSK_PATH_CUBIC:
|
||||
gsk_path_builder_cubic_to(data->builder, data->tmp_pts[1].x, data->tmp_pts[1].y, data->tmp_pts[2].x, data->tmp_pts[2].y, data->tmp_pts[3].x, data->tmp_pts[3].y);
|
||||
break;
|
||||
case GSK_PATH_CONIC:
|
||||
gsk_path_builder_conic_to(data->builder, data->tmp_pts[1].x, data->tmp_pts[1].y, data->tmp_pts[2].x, data->tmp_pts[2].y, weight);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rewind(JNIEnv *env, jclass class, jlong path_ptr)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1add_1path(JNIEnv *env, jclass this, jlong builder_ptr, jlong path_ptr, jlong matrix_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);
|
||||
GskPathBuilder *builder = _PTR(builder_ptr);
|
||||
GskPath *path = _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[4], v[12],
|
||||
v[1], v[5], v[13],
|
||||
v[3], v[7], v[15]};
|
||||
sk_path_transform(path, &m);
|
||||
if (graphene_matrix_is_identity(matrix)) {
|
||||
gsk_path_builder_add_path(builder, path);
|
||||
} else {
|
||||
struct path_foreach_data data = {
|
||||
.builder = builder,
|
||||
.matrix = matrix,
|
||||
};
|
||||
gsk_path_foreach(path, GSK_PATH_FOREACH_ALLOW_QUAD | GSK_PATH_FOREACH_ALLOW_CUBIC | GSK_PATH_FOREACH_ALLOW_CONIC, path_foreach_transform, &data);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_android_graphics_Path_native_1op(JNIEnv *env, jclass class, jlong path_ptr, jlong other_ptr, jint op, jlong result_ptr)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1add_1rect(JNIEnv *env, jclass this, jlong builder_ptr, jfloat left, jfloat top, jfloat right, jfloat bottom)
|
||||
{
|
||||
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);
|
||||
gsk_path_builder_add_rect(_PTR(builder_ptr), &GRAPHENE_RECT_INIT(left, top, right-left, bottom-top));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1quadTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat x1, jfloat y1, jfloat x2, jfloat y2)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1get_1bounds(JNIEnv *env, jclass this, jlong path_ptr, jobject bounds)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_quad_to(path, x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rQuadTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat dx1, jfloat dy1, jfloat dx2, jfloat dy2)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_rquad_to(path, dx1, dy1, dx2, dy2);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1rMoveTo(JNIEnv *env, jclass class, jlong path_ptr, jfloat dx, jfloat dy)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_rmove_to(path, dx, dy);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__JFFFFFFI(JNIEnv *env, jclass class, jlong path_ptr, jfloat left, jfloat top, jfloat right, jfloat bottom, jfloat rx, jfloat ry, jint dir)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_add_rounded_rect(path, &(sk_rect_t){left, top, right, bottom}, rx, ry, (sk_path_direction_t)dir);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addRoundRect__JLandroid_graphics_RectF_2_3FI(JNIEnv *env, jclass class, jlong path_ptr, jobject rect, jfloatArray radii, 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");
|
||||
jfloat *radii_array = (*env)->GetFloatArrayElements(env, radii, 0);
|
||||
sk_path_add_rounded_rect(path, &(sk_rect_t){left, top, right, bottom}, radii_array[0], radii_array[1], (sk_path_direction_t)dir);
|
||||
(*env)->ReleaseFloatArrayElements(env, radii, radii_array, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addOval(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_oval(path, &(sk_rect_t){left, top, right, bottom}, (sk_path_direction_t)dir);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addCircle(JNIEnv *env, jclass class, jlong path_ptr, jfloat x, jfloat y, jfloat radius, jint dir)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_add_circle(path, x, y, radius, (sk_path_direction_t)dir);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Path_native_1addPath__JJ(JNIEnv *env, jclass class, jlong path_ptr, jlong src_ptr)
|
||||
{
|
||||
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 void JNICALL Java_android_graphics_Path_native_1addPath__JJFF(JNIEnv *env, jclass class, jlong path_ptr, jlong src_ptr, jfloat dx, jfloat dy)
|
||||
{
|
||||
sk_path_t *path = (sk_path_t *)_PTR(path_ptr);
|
||||
sk_path_t *src = (sk_path_t *)_PTR(src_ptr);
|
||||
sk_path_add_path_offset(path, src, dx, dy, APPEND_SK_PATH_ADD_MODE);
|
||||
graphene_rect_t rect;
|
||||
gsk_path_get_bounds(_PTR(path_ptr), &rect);
|
||||
_SET_FLOAT_FIELD(bounds, "left", rect.origin.x);
|
||||
_SET_FLOAT_FIELD(bounds, "top", rect.origin.y);
|
||||
_SET_FLOAT_FIELD(bounds, "right", rect.origin.x + rect.size.width);
|
||||
_SET_FLOAT_FIELD(bounds, "bottom", rect.origin.y + rect.size.height);
|
||||
}
|
||||
|
||||
@@ -99,9 +99,6 @@ void set_up_handle_cache(JNIEnv *env)
|
||||
handle_cache.sensor_event.class = _REF((*env)->FindClass(env, "android/hardware/SensorEvent"));
|
||||
handle_cache.sensor_event.constructor = _METHOD(handle_cache.sensor_event.class, "<init>", "([FLandroid/hardware/Sensor;)V");
|
||||
|
||||
handle_cache.canvas.class = _REF((*env)->FindClass(env, "android/graphics/Canvas"));
|
||||
handle_cache.canvas.constructor = _METHOD(handle_cache.canvas.class, "<init>", "(JJ)V");
|
||||
|
||||
handle_cache.audio_track_periodic_listener.class = _REF((*env)->FindClass(env, "android/media/AudioTrack$OnPlaybackPositionUpdateListener"));
|
||||
handle_cache.audio_track_periodic_listener.onPeriodicNotification = _METHOD(handle_cache.audio_track_periodic_listener.class, "onPeriodicNotification", "(Landroid/media/AudioTrack;)V");
|
||||
|
||||
|
||||
@@ -44,10 +44,6 @@ struct handle_cache {
|
||||
jclass class;
|
||||
jmethodID constructor;
|
||||
} sensor_event;
|
||||
struct {
|
||||
jclass class;
|
||||
jmethodID constructor;
|
||||
} canvas;
|
||||
struct {
|
||||
jclass class;
|
||||
jmethodID onPeriodicNotification;
|
||||
|
||||
@@ -20,12 +20,6 @@ JNIEXPORT jlong JNICALL Java_android_widget_ImageButton_native_1constructor(JNIE
|
||||
return _INTPTR(button);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageButton_native_1setPixbuf(JNIEnv *env, jobject this, jlong widget_ptr, jlong pixbuf_ptr)
|
||||
{
|
||||
GdkPaintable *paintable = GDK_PAINTABLE(gdk_texture_new_for_pixbuf(_PTR(pixbuf_ptr)));
|
||||
Java_android_widget_ImageButton_native_1setDrawable(env, this, widget_ptr, _INTPTR(paintable));
|
||||
}
|
||||
|
||||
static void clicked_cb(GtkWidget *button, gpointer user_data) {
|
||||
printf("clicked_cb\n");
|
||||
JNIEnv *env = get_jni_env();
|
||||
|
||||
@@ -25,12 +25,6 @@ JNIEXPORT jlong JNICALL Java_android_widget_ImageView_native_1constructor(JNIEnv
|
||||
return _INTPTR(image);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setPixbuf(JNIEnv *env, jobject this, jlong widget_ptr, jlong pixbuf_ptr)
|
||||
{
|
||||
GdkPaintable *paintable = GDK_PAINTABLE(gdk_texture_new_for_pixbuf(_PTR(pixbuf_ptr)));
|
||||
Java_android_widget_ImageView_native_1setDrawable(env, this, widget_ptr, _INTPTR(paintable));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setDrawable(JNIEnv *env, jobject this, jlong widget_ptr, jlong paintable_ptr)
|
||||
{
|
||||
GtkPicture *picture = _PTR(widget_ptr);
|
||||
|
||||
@@ -10,9 +10,9 @@ public class WallpaperManager {
|
||||
}
|
||||
|
||||
public void setBitmap(Bitmap bitmap) {
|
||||
set_bitmap(bitmap.pixbuf);
|
||||
set_bitmap(bitmap.getTexture());
|
||||
}
|
||||
|
||||
private static native void set_bitmap(long pixbuf);
|
||||
private static native void set_bitmap(long texture);
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,8 +16,8 @@
|
||||
|
||||
package android.graphics;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.Resources.NotFoundException;
|
||||
import android.os.Trace;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
@@ -442,10 +442,8 @@ public class BitmapFactory {
|
||||
* decoded, or, if opts is non-null, if opts requested only the
|
||||
* size be returned (in opts.outWidth and opts.outHeight)
|
||||
*/
|
||||
public static Bitmap decodeResource(Resources res, int id, Options opts) {
|
||||
String path = res.getString(id);
|
||||
|
||||
return new Bitmap(path);
|
||||
public static Bitmap decodeResource(Resources res, int id, Options opts) throws NotFoundException {
|
||||
return decodeStreamInternal(res.openRawResource(id), null, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -456,7 +454,7 @@ public class BitmapFactory {
|
||||
* @param id The resource id of the image data
|
||||
* @return The decoded bitmap, or null if the image could not be decode.
|
||||
*/
|
||||
public static Bitmap decodeResource(Resources res, int id) {
|
||||
public static Bitmap decodeResource(Resources res, int id) throws NotFoundException {
|
||||
return decodeResource(res, id, null);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user