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
drop Skia dependency
Everything is implementede using GTK Scene Graph now. Skia is no longer needed.
This commit is contained in:
22
doc/Build.md
22
doc/Build.md
@@ -42,32 +42,12 @@ If you want to build ATL from source, you can take advantage of the packages for
|
|||||||
sudo apk add build-base meson java-common openjdk8-jdk \
|
sudo apk add build-base meson java-common openjdk8-jdk \
|
||||||
pc:alsa pc:glib-2.0 pc:gtk4 pc:gudev-1.0 pc:libportal \
|
pc:alsa pc:glib-2.0 pc:gtk4 pc:gudev-1.0 pc:libportal \
|
||||||
pc:openxr pc:vulkan pc:webkitgtk-6.0 ffmpeg-dev \
|
pc:openxr pc:vulkan pc:webkitgtk-6.0 ffmpeg-dev \
|
||||||
bionic_translation-dev art_standalone-dev skia-sharp-dev
|
bionic_translation-dev art_standalone-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
You can now skip the Additional Dependencies section and continue with the build steps from below.
|
You can now skip the Additional Dependencies section and continue with the build steps from below.
|
||||||
|
|
||||||
## Additional Dependencies
|
## Additional Dependencies
|
||||||
### Skia
|
|
||||||
If your distro ships this already (e.g. `skia-sharp` on Alpine), you can just install the package and skip this step.
|
|
||||||
|
|
||||||
Install `gn` via your system's package manager.
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/Mis012/skia.git -b with-patches-applied
|
|
||||||
cd skia
|
|
||||||
cp build/linux-self-hosted/DEPS DEPS
|
|
||||||
python3 tools/git-sync-deps
|
|
||||||
export arch=x64
|
|
||||||
gn gen "out/linux/$arch" --args='is_official_build=true skia_enable_tools=false target_os="linux" target_cpu="$arch" skia_use_icu=false skia_use_sfntly=false skia_use_piex=true skia_use_system_harfbuzz=true skia_use_system_expat=true skia_use_system_freetype2=true skia_use_system_libjpeg_turbo=true skia_use_system_libpng=true skia_use_system_libwebp=true skia_use_system_zlib=true skia_enable_gpu=true extra_cflags=[ "-DSKIA_C_DLL" ] linux_soname_version="99.9"'
|
|
||||||
ninja -C "out/linux/$arch" SkiaSharp
|
|
||||||
sudo cp out/linux/$arch/libSkiaSharp.so.99.9 /usr/local/lib64/
|
|
||||||
sudo ln -s /usr/local/lib64/libSkiaSharp.so.99.9 /usr/local/lib64/libSkiaSharp.so
|
|
||||||
```
|
|
||||||
Note:
|
|
||||||
- You can also use [this nuget package](https://www.nuget.org/api/v2/package/SkiaSharp.NativeAssets.Linux/2.88.5) if it's compatible with your distro. It's an older upstream version before the ABI break which is fixed in our skia repository.
|
|
||||||
- For `x86` or `aarch64`: set `arch` accordingly.
|
|
||||||
- On alpine: add `-fpermissive` to `--args`.
|
|
||||||
|
|
||||||
### wolfSSL
|
### wolfSSL
|
||||||
If your distro ships wolfSSL with JNI enabled already, you can just install the package and skip this step.
|
If your distro ships wolfSSL with JNI enabled already, you can just install the package and skip this step.
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
10
meson.build
10
meson.build
@@ -17,9 +17,6 @@ libart_dep = [
|
|||||||
libdl_bio_dep = [
|
libdl_bio_dep = [
|
||||||
cc.find_library('dl_bio')
|
cc.find_library('dl_bio')
|
||||||
]
|
]
|
||||||
libskia_dep = [
|
|
||||||
cc.find_library('SkiaSharp')
|
|
||||||
]
|
|
||||||
libandroidfw_dep = [
|
libandroidfw_dep = [
|
||||||
cc.find_library('androidfw', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art' ]),
|
cc.find_library('androidfw', dirs : [ '/usr' / get_option('libdir') / 'art', '/usr/local' / get_option('libdir') / 'art', get_option('prefix') / get_option('libdir') / 'art' ]),
|
||||||
]
|
]
|
||||||
@@ -84,7 +81,6 @@ libandroid_so = shared_library('android', [
|
|||||||
libtranslationlayer_so = shared_library('translation_layer_main', [
|
libtranslationlayer_so = shared_library('translation_layer_main', [
|
||||||
'src/api-impl-jni/android_app_NativeActivity.c',
|
'src/api-impl-jni/android_app_NativeActivity.c',
|
||||||
'src/api-impl-jni/android_content_res_AssetManager.c',
|
'src/api-impl-jni/android_content_res_AssetManager.c',
|
||||||
'src/api-impl-jni/android_graphics_Paint.c',
|
|
||||||
'src/api-impl-jni/android_opengl_GLES20.c',
|
'src/api-impl-jni/android_opengl_GLES20.c',
|
||||||
'src/api-impl-jni/android_os_Environment.c',
|
'src/api-impl-jni/android_os_Environment.c',
|
||||||
'src/api-impl-jni/android_os_MessageQueue.c',
|
'src/api-impl-jni/android_os_MessageQueue.c',
|
||||||
@@ -114,8 +110,6 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
|
|||||||
'src/api-impl-jni/graphics/android_graphics_GskCanvas.c',
|
'src/api-impl-jni/graphics/android_graphics_GskCanvas.c',
|
||||||
'src/api-impl-jni/graphics/android_graphics_Matrix.c',
|
'src/api-impl-jni/graphics/android_graphics_Matrix.c',
|
||||||
'src/api-impl-jni/graphics/android_graphics_Path.c',
|
'src/api-impl-jni/graphics/android_graphics_Path.c',
|
||||||
'src/api-impl-jni/graphics/android_graphics_Typeface.c',
|
|
||||||
'src/api-impl-jni/graphics/android_graphics_Typeface.c',
|
|
||||||
'src/api-impl-jni/graphics/android_graphics_drawable_Drawable.c',
|
'src/api-impl-jni/graphics/android_graphics_drawable_Drawable.c',
|
||||||
'src/api-impl-jni/graphics/android_graphics_drawable_DrawableContainer.c',
|
'src/api-impl-jni/graphics/android_graphics_drawable_DrawableContainer.c',
|
||||||
'src/api-impl-jni/location/android_location_LocationManager.c',
|
'src/api-impl-jni/location/android_location_LocationManager.c',
|
||||||
@@ -145,19 +139,17 @@ libtranslationlayer_so = shared_library('translation_layer_main', [
|
|||||||
'src/api-impl-jni/widgets/android_widget_Spinner.c',
|
'src/api-impl-jni/widgets/android_widget_Spinner.c',
|
||||||
'src/api-impl-jni/widgets/android_widget_SeekBar.c',
|
'src/api-impl-jni/widgets/android_widget_SeekBar.c',
|
||||||
'src/api-impl-jni/widgets/android_widget_TextView.c',
|
'src/api-impl-jni/widgets/android_widget_TextView.c',
|
||||||
'src/sk_area/sk_area.c',
|
|
||||||
linux_dmabuf,
|
linux_dmabuf,
|
||||||
viewporter,
|
viewporter,
|
||||||
mpris,
|
mpris,
|
||||||
portal_openuri,
|
portal_openuri,
|
||||||
] + marshal_files,
|
] + marshal_files,
|
||||||
include_directories: ['src/sk_area/'],
|
|
||||||
install: true,
|
install: true,
|
||||||
install_dir : get_option('libdir') / 'java/dex/android_translation_layer/natives',
|
install_dir : get_option('libdir') / 'java/dex/android_translation_layer/natives',
|
||||||
install_rpath: '$ORIGIN/:' + get_option('prefix') / get_option('libdir') / 'art',
|
install_rpath: '$ORIGIN/:' + get_option('prefix') / get_option('libdir') / 'art',
|
||||||
dependencies: [
|
dependencies: [
|
||||||
dependency('gtk4', version: '>=4.14'), 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('libportal'), dependency('sqlite3'), dependency('libavcodec', version: '>=59'), dependency('libdrm'),
|
||||||
dependency('gudev-1.0'), dependency('libswscale'), dependency('webkitgtk-6.0'),
|
dependency('gudev-1.0'), dependency('libswscale'), dependency('webkitgtk-6.0'),
|
||||||
libandroidfw_dep
|
libandroidfw_dep
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,101 +0,0 @@
|
|||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include "defines.h"
|
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
#include "../sk_area/include/c/sk_font.h"
|
|
||||||
#include "../sk_area/include/c/sk_paint.h"
|
|
||||||
#include "../sk_area/include/c/sk_typeface.h"
|
|
||||||
#include "generated_headers/android_graphics_Paint.h"
|
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_android_graphics_Paint_native_1constructor(JNIEnv *env, jobject this)
|
|
||||||
{
|
|
||||||
return _INTPTR(sk_paint_new());
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_Paint_native_1set_1antialias(JNIEnv *env, jobject this, jlong skia_paint, jboolean aa)
|
|
||||||
{
|
|
||||||
sk_paint_t *paint = (sk_paint_t *)_PTR(skia_paint);
|
|
||||||
|
|
||||||
sk_paint_set_antialias(paint, aa);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* NOTE: sk_color_t seems to have the same internal representation as android uses for color, so we just pass that directly */
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_Paint_native_1set_1color(JNIEnv *env, jobject this, jlong skia_paint, jint color)
|
|
||||||
{
|
|
||||||
sk_paint_t *paint = (sk_paint_t *)_PTR(skia_paint);
|
|
||||||
|
|
||||||
sk_paint_set_color(paint, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_android_graphics_Paint_native_1get_1color(JNIEnv *env, jobject this, jlong skia_paint)
|
|
||||||
{
|
|
||||||
sk_paint_t *paint = (sk_paint_t *)_PTR(skia_paint);
|
|
||||||
|
|
||||||
return sk_paint_get_color(paint);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_android_graphics_Paint_native_1create_1font(JNIEnv *env, jclass this)
|
|
||||||
{
|
|
||||||
return _INTPTR(sk_font_new()); /* TODO: recycle this */
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_Paint_native_1set_1typeface(JNIEnv *env, jclass this, jlong skia_font, jlong skia_typeface)
|
|
||||||
{
|
|
||||||
sk_font_t *font = _PTR(skia_font);
|
|
||||||
sk_typeface_t *typeface = _PTR(skia_typeface);
|
|
||||||
|
|
||||||
sk_font_set_typeface(font, typeface);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_Paint_native_1set_1text_1size(JNIEnv *env, jclass this, jlong skia_font, jfloat size)
|
|
||||||
{
|
|
||||||
sk_font_t *font = _PTR(skia_font);
|
|
||||||
|
|
||||||
sk_font_set_size(font, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jfloat JNICALL Java_android_graphics_Paint_native_1ascent(JNIEnv *env, jclass this, jlong skia_font)
|
|
||||||
{
|
|
||||||
sk_font_t *font = _PTR(skia_font);
|
|
||||||
|
|
||||||
sk_fontmetrics_t metrics;
|
|
||||||
sk_font_get_metrics(font, &metrics);
|
|
||||||
|
|
||||||
return metrics.fAscent;
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jfloat JNICALL Java_android_graphics_Paint_native_1measure_1text(JNIEnv *env, jclass this, jlong skia_font, jobject _text, jint start, jint end, jlong skia_paint)
|
|
||||||
{
|
|
||||||
sk_font_t *font = _PTR(skia_font);
|
|
||||||
sk_paint_t *paint = (sk_paint_t *)_PTR(skia_paint);
|
|
||||||
|
|
||||||
const char *text = _CSTRING(_text);
|
|
||||||
|
|
||||||
return sk_font_measure_text(font, text + start, end - start, UTF8_SK_TEXT_ENCODING, NULL, paint);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_Paint_native_1set_1stroke_1width(JNIEnv *env, jclass this, jlong skia_paint, jfloat width)
|
|
||||||
{
|
|
||||||
sk_paint_set_stroke_width(_PTR(skia_paint), width);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jfloat JNICALL Java_android_graphics_Paint_native_1get_1stroke_1width(JNIEnv *env, jclass this, jlong skia_paint)
|
|
||||||
{
|
|
||||||
return sk_paint_get_stroke_width(_PTR(skia_paint));
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_Paint_native_1set_1style(JNIEnv *env, jclass this, jlong skia_paint, jint style)
|
|
||||||
{
|
|
||||||
sk_paint_set_style(_PTR(skia_paint), (sk_paint_style_t)style);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_Paint_native_1set_1blendmode(JNIEnv *env, jclass this, jlong skia_paint, jint blendmode)
|
|
||||||
{
|
|
||||||
sk_paint_set_blendmode(_PTR(skia_paint), (sk_blendmode_t)blendmode);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL Java_android_graphics_Paint_native_1get_1style(JNIEnv *env, jclass this, jlong skia_paint)
|
|
||||||
{
|
|
||||||
return sk_paint_get_style(_PTR(skia_paint));
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "../defines.h"
|
#include "../defines.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
#include "../main-executable/back_button.h"
|
#include "../../main-executable/back_button.h"
|
||||||
#include "android_app_Activity.h"
|
#include "android_app_Activity.h"
|
||||||
#include "../generated_headers/android_app_Activity.h"
|
#include "../generated_headers/android_app_Activity.h"
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawRect
|
|||||||
/*
|
/*
|
||||||
* Class: android_graphics_GskCanvas
|
* Class: android_graphics_GskCanvas
|
||||||
* Method: native_drawPath
|
* Method: native_drawPath
|
||||||
* Signature: (JJJ)V
|
* Signature: (JJII)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawPath
|
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawPath
|
||||||
(JNIEnv *, jobject, jlong, jlong, jlong);
|
(JNIEnv *, jobject, jlong, jlong, jint, jint);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: android_graphics_GskCanvas
|
* Class: android_graphics_GskCanvas
|
||||||
@@ -68,18 +68,18 @@ JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1restore
|
|||||||
/*
|
/*
|
||||||
* Class: android_graphics_GskCanvas
|
* Class: android_graphics_GskCanvas
|
||||||
* Method: native_drawLine
|
* Method: native_drawLine
|
||||||
* Signature: (JFFFFJ)V
|
* Signature: (JFFFFIF)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawLine
|
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawLine
|
||||||
(JNIEnv *, jobject, jlong, jfloat, jfloat, jfloat, jfloat, jlong);
|
(JNIEnv *, jobject, jlong, jfloat, jfloat, jfloat, jfloat, jint, jfloat);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: android_graphics_GskCanvas
|
* Class: android_graphics_GskCanvas
|
||||||
* Method: native_drawText
|
* Method: native_drawText
|
||||||
* Signature: (JLjava/lang/String;FFJJ)V
|
* Signature: (JLjava/lang/String;FFIF)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawText
|
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawText
|
||||||
(JNIEnv *, jobject, jlong, jstring, jfloat, jfloat, jlong, jlong);
|
(JNIEnv *, jobject, jlong, jstring, jfloat, jfloat, jint, jfloat);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: android_graphics_GskCanvas
|
* Class: android_graphics_GskCanvas
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
|
||||||
#include <jni.h>
|
|
||||||
/* Header for class android_graphics_Typeface */
|
|
||||||
|
|
||||||
#ifndef _Included_android_graphics_Typeface
|
|
||||||
#define _Included_android_graphics_Typeface
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
#undef android_graphics_Typeface_NORMAL
|
|
||||||
#define android_graphics_Typeface_NORMAL 0L
|
|
||||||
#undef android_graphics_Typeface_BOLD
|
|
||||||
#define android_graphics_Typeface_BOLD 1L
|
|
||||||
#undef android_graphics_Typeface_ITALIC
|
|
||||||
#define android_graphics_Typeface_ITALIC 2L
|
|
||||||
#undef android_graphics_Typeface_BOLD_ITALIC
|
|
||||||
#define android_graphics_Typeface_BOLD_ITALIC 3L
|
|
||||||
/*
|
|
||||||
* Class: android_graphics_Typeface
|
|
||||||
* Method: native_create
|
|
||||||
* Signature: (Ljava/lang/CharSequence;I)J
|
|
||||||
*/
|
|
||||||
JNIEXPORT jlong JNICALL Java_android_graphics_Typeface_native_1create
|
|
||||||
(JNIEnv *, jclass, jobject, jint);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@@ -2,9 +2,6 @@
|
|||||||
#include <graphene.h>
|
#include <graphene.h>
|
||||||
#include <pango/pango.h>
|
#include <pango/pango.h>
|
||||||
|
|
||||||
#include "include/c/sk_font.h"
|
|
||||||
#include "include/c/sk_paint.h"
|
|
||||||
|
|
||||||
#include "../defines.h"
|
#include "../defines.h"
|
||||||
|
|
||||||
#include "../generated_headers/android_graphics_GskCanvas.h"
|
#include "../generated_headers/android_graphics_GskCanvas.h"
|
||||||
@@ -13,6 +10,12 @@
|
|||||||
#define STYLE_STROKE 1
|
#define STYLE_STROKE 1
|
||||||
#define STYLE_FILL_AND_STROKE 2
|
#define STYLE_FILL_AND_STROKE 2
|
||||||
|
|
||||||
|
#define GDK_RGBA_INIT(color) ((GdkRGBA){ \
|
||||||
|
.red = ((color >> 16) & 0xFF) / 255.f, \
|
||||||
|
.green = ((color >> 8) & 0xFF) / 255.f, \
|
||||||
|
.blue = ((color >> 0) & 0xFF) / 255.f, \
|
||||||
|
.alpha = ((color >> 24) & 0xFF) / 255.f})
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawBitmap(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jlong texture_ptr, jint x, jint y, jint width, jint height, jint color)
|
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawBitmap(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jlong texture_ptr, jint x, jint y, jint width, jint height, jint color)
|
||||||
{
|
{
|
||||||
GdkSnapshot *snapshot = (GdkSnapshot *)_PTR(snapshot_ptr);
|
GdkSnapshot *snapshot = (GdkSnapshot *)_PTR(snapshot_ptr);
|
||||||
@@ -37,28 +40,20 @@ JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawBitmap(JNIEnv
|
|||||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawRect(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jfloat left, jfloat top, jfloat right, jfloat bottom, jint color)
|
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawRect(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jfloat left, jfloat top, jfloat right, jfloat bottom, jint color)
|
||||||
{
|
{
|
||||||
GdkSnapshot *snapshot = (GdkSnapshot *)_PTR(snapshot_ptr);
|
GdkSnapshot *snapshot = (GdkSnapshot *)_PTR(snapshot_ptr);
|
||||||
GdkRGBA gdk_color = {
|
GdkRGBA gdk_color = GDK_RGBA_INIT(color);
|
||||||
(float)((color >> 16) & 0xff) / 0xff,
|
|
||||||
(float)((color >> 8) & 0xff) / 0xff,
|
|
||||||
(float)((color >> 0) & 0xff) / 0xff,
|
|
||||||
(float)((color >> 24) & 0xff) / 0xff,
|
|
||||||
};
|
|
||||||
graphene_rect_t bounds = GRAPHENE_RECT_INIT(left, top, right - left, bottom - top);
|
graphene_rect_t bounds = GRAPHENE_RECT_INIT(left, top, right - left, bottom - top);
|
||||||
gtk_snapshot_append_color(snapshot, &gdk_color, &bounds);
|
gtk_snapshot_append_color(snapshot, &gdk_color, &bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawPath(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jlong path_ptr, jlong paint_ptr)
|
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawPath(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jlong path_ptr, jint color, jint style)
|
||||||
{
|
{
|
||||||
GtkSnapshot *snapshot = GTK_SNAPSHOT(_PTR(snapshot_ptr));
|
GtkSnapshot *snapshot = GTK_SNAPSHOT(_PTR(snapshot_ptr));
|
||||||
GskPath *path = _PTR(path_ptr);
|
GskPath *path = _PTR(path_ptr);
|
||||||
sk_paint_t *paint = (sk_paint_t *)_PTR(paint_ptr);
|
GdkRGBA gdk_color = GDK_RGBA_INIT(color);
|
||||||
GdkRGBA gdk_color;
|
if (style == STYLE_STROKE || style == STYLE_FILL_AND_STROKE) {
|
||||||
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);
|
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) {
|
if (style == STYLE_FILL || style == STYLE_FILL_AND_STROKE) {
|
||||||
gtk_snapshot_append_fill(snapshot, path, GSK_FILL_RULE_WINDING, &gdk_color);
|
gtk_snapshot_append_fill(snapshot, path, GSK_FILL_RULE_WINDING, &gdk_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,37 +82,31 @@ JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1restore(JNIEnv *e
|
|||||||
gtk_snapshot_restore(snapshot);
|
gtk_snapshot_restore(snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawLine(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jfloat x0, jfloat y0, jfloat x1, jfloat y1, jlong paint_ptr)
|
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawLine(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jfloat x0, jfloat y0, jfloat x1, jfloat y1, jint color, jfloat stroke_width)
|
||||||
{
|
{
|
||||||
if (isnan(x0) || isnan(y0) || isnan(x1) || isnan(y1)) {
|
if (isnan(x0) || isnan(y0) || isnan(x1) || isnan(y1)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GdkSnapshot *snapshot = GTK_SNAPSHOT(_PTR(snapshot_ptr));
|
GdkSnapshot *snapshot = GTK_SNAPSHOT(_PTR(snapshot_ptr));
|
||||||
sk_paint_t *paint = (sk_paint_t *)_PTR(paint_ptr);
|
GdkRGBA gdk_color = GDK_RGBA_INIT(color);
|
||||||
GdkRGBA gdk_color;
|
|
||||||
sk_paint_get_color4f(paint, (sk_color4f_t *)&gdk_color);
|
|
||||||
float width = sk_paint_get_stroke_width(paint);
|
|
||||||
gtk_snapshot_save(snapshot);
|
gtk_snapshot_save(snapshot);
|
||||||
gtk_snapshot_translate(snapshot, &GRAPHENE_POINT_INIT(x0, y0));
|
gtk_snapshot_translate(snapshot, &GRAPHENE_POINT_INIT(x0, y0));
|
||||||
float rotation = atan2(y1 - y0, x1 - x0);
|
float rotation = atan2(y1 - y0, x1 - x0);
|
||||||
gtk_snapshot_rotate(snapshot, rotation * 180 / M_PI);
|
gtk_snapshot_rotate(snapshot, rotation * 180 / M_PI);
|
||||||
float length = sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
|
float length = sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
|
||||||
gtk_snapshot_append_color(snapshot, &gdk_color, &GRAPHENE_RECT_INIT(0, -width / 2, length, width));
|
gtk_snapshot_append_color(snapshot, &gdk_color, &GRAPHENE_RECT_INIT(0, -stroke_width / 2, length, stroke_width));
|
||||||
gtk_snapshot_restore(snapshot);
|
gtk_snapshot_restore(snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern GtkWidget *window;
|
extern GtkWidget *window;
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawText(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jstring text, jfloat x, jfloat y, jlong paint_ptr, jlong font_ptr)
|
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawText(JNIEnv *env, jclass this_class, jlong snapshot_ptr, jstring text, jfloat x, jfloat y, jint color, jfloat text_size)
|
||||||
{
|
{
|
||||||
GdkSnapshot *snapshot = GTK_SNAPSHOT(_PTR(snapshot_ptr));
|
GdkSnapshot *snapshot = GTK_SNAPSHOT(_PTR(snapshot_ptr));
|
||||||
sk_paint_t *paint = (sk_paint_t *)_PTR(paint_ptr);
|
GdkRGBA gdk_color = GDK_RGBA_INIT(color);
|
||||||
sk_font_t *font = (sk_font_t *)_PTR(font_ptr);
|
|
||||||
GdkRGBA gdk_color;
|
|
||||||
sk_paint_get_color4f(paint, (sk_color4f_t *)&gdk_color);
|
|
||||||
PangoLayout *layout = pango_layout_new(gtk_widget_get_pango_context(window));
|
PangoLayout *layout = pango_layout_new(gtk_widget_get_pango_context(window));
|
||||||
PangoFontDescription *description = pango_font_description_new();
|
PangoFontDescription *description = pango_font_description_new();
|
||||||
pango_font_description_set_size(description, sk_font_get_size(font) * .8f * PANGO_SCALE);
|
pango_font_description_set_size(description, text_size * .8f * PANGO_SCALE);
|
||||||
pango_layout_set_font_description(layout, description);
|
pango_layout_set_font_description(layout, description);
|
||||||
const char *str = (*env)->GetStringUTFChars(env, text, NULL);
|
const char *str = (*env)->GetStringUTFChars(env, text, NULL);
|
||||||
pango_layout_set_text(layout, str, -1);
|
pango_layout_set_text(layout, str, -1);
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#include "../defines.h"
|
|
||||||
#include "../util.h"
|
|
||||||
|
|
||||||
#include "../../sk_area/include/c/sk_typeface.h"
|
|
||||||
|
|
||||||
#include "../generated_headers/android_graphics_Typeface.h"
|
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_android_graphics_Typeface_native_1create(JNIEnv *env, jclass this, jobject _family_name, jint style)
|
|
||||||
{
|
|
||||||
/* TODO: use the family name */
|
|
||||||
return _INTPTR(sk_typeface_create_default()); /* TODO: recycle this */
|
|
||||||
}
|
|
||||||
@@ -52,7 +52,7 @@ public class GskCanvas extends Canvas {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawPath(Path path, Paint paint) {
|
public void drawPath(Path path, Paint paint) {
|
||||||
native_drawPath(snapshot, path.getGskPath(), paint.skia_paint);
|
native_drawPath(snapshot, path.getGskPath(), paint.getColor(), paint.getStyle().nativeInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,12 +69,12 @@ public class GskCanvas extends Canvas {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawText(String text, float x, float y, Paint paint) {
|
public void drawText(String text, float x, float y, Paint paint) {
|
||||||
native_drawText(snapshot, text, x, y, paint.skia_paint, paint.skia_font);
|
native_drawText(snapshot, text, x, y, paint.getColor(), paint.getTextSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLine(float startX, float startY, float stopX, float stopY, Paint paint) {
|
public void drawLine(float startX, float startY, float stopX, float stopY, Paint paint) {
|
||||||
native_drawLine(snapshot, startX, startY, stopX, stopY, paint.skia_paint);
|
native_drawLine(snapshot, startX, startY, stopX, stopY, paint.getColor(), paint.getStrokeWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -101,13 +101,13 @@ public class GskCanvas extends Canvas {
|
|||||||
|
|
||||||
protected native void native_drawBitmap(long snapshot, long texture, int x, int y, int width, int height, int color);
|
protected native void native_drawBitmap(long snapshot, long texture, int x, int y, int width, int height, int color);
|
||||||
protected native void native_drawRect(long snapshot, float left, float top, float right, float bottom, int color);
|
protected native void native_drawRect(long snapshot, float left, float top, float right, float bottom, int color);
|
||||||
protected native void native_drawPath(long snapshot, long path, long paint);
|
protected native void native_drawPath(long snapshot, long path, int color, int style);
|
||||||
protected native void native_translate(long snapshot, float dx, float dy);
|
protected native void native_translate(long snapshot, float dx, float dy);
|
||||||
protected native void native_rotate(long snapshot, float degrees);
|
protected native void native_rotate(long snapshot, float degrees);
|
||||||
protected native void native_save(long snapshot);
|
protected native void native_save(long snapshot);
|
||||||
protected native void native_restore(long snapshot);
|
protected native void native_restore(long snapshot);
|
||||||
protected native void native_drawLine(long snapshot, float startX, float startY, float stopX, float stopY, long paint);
|
protected native void native_drawLine(long snapshot, float startX, float startY, float stopX, float stopY, int color, float strokeWidth);
|
||||||
protected native void native_drawText(long snapshot, String text, float x, float y, long paint, long font);
|
protected native void native_drawText(long snapshot, String text, float x, float y, int color, float textSize);
|
||||||
protected native void native_drawRoundRect(long snapshot, float left, float top, float right, float bottom, float rx, float ry, int color, float strokeWidth, int style);
|
protected native void native_drawRoundRect(long snapshot, float left, float top, float right, float bottom, float rx, float ry, int color, float strokeWidth, int style);
|
||||||
protected native void native_scale(long snapshot, float sx, float sy);
|
protected native void native_scale(long snapshot, float sx, float sy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,14 @@ public class Paint {
|
|||||||
public static final int AUTO_HINTING_TEXT_FLAG = (1 << 11);
|
public static final int AUTO_HINTING_TEXT_FLAG = (1 << 11);
|
||||||
public static final int VERTICAL_TEXT_FLAG = (1 << 12);
|
public static final int VERTICAL_TEXT_FLAG = (1 << 12);
|
||||||
|
|
||||||
public long skia_paint = 0;
|
|
||||||
private Typeface typeface = null;
|
private Typeface typeface = null;
|
||||||
public long skia_font = 0;
|
|
||||||
ColorFilter colorFilter = null;
|
ColorFilter colorFilter = null;
|
||||||
|
private int color = 0;
|
||||||
|
private float strokeWidth = 0;
|
||||||
|
private float textSize = 7;
|
||||||
|
private Style style = Style.FILL;
|
||||||
|
|
||||||
public Paint() {
|
public Paint() {
|
||||||
skia_paint = native_constructor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Paint (int flags) {
|
public Paint (int flags) {
|
||||||
@@ -38,34 +39,25 @@ public class Paint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(int color) {
|
public void setColor(int color) {
|
||||||
native_set_color(skia_paint, color);
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
return native_get_color(skia_paint);
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAntiAlias(boolean aa) {
|
public void setAntiAlias(boolean aa) {
|
||||||
native_set_antialias(skia_paint, aa);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStrokeWidth(float width) {
|
public void setStrokeWidth(float width) {
|
||||||
native_set_stroke_width(skia_paint, width);
|
this.strokeWidth = width;
|
||||||
}
|
}
|
||||||
public void setTextSize(float size) {
|
public void setTextSize(float size) {
|
||||||
if(skia_font == 0)
|
this.textSize = size;
|
||||||
skia_font = native_create_font();
|
|
||||||
|
|
||||||
native_set_text_size(skia_font, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Typeface setTypeface(Typeface typeface) {
|
public Typeface setTypeface(Typeface typeface) {
|
||||||
this.typeface = typeface;
|
this.typeface = typeface;
|
||||||
if(skia_font == 0)
|
|
||||||
skia_font = native_create_font();
|
|
||||||
|
|
||||||
if (typeface != null)
|
|
||||||
native_set_typeface(skia_font, typeface.skia_typeface);
|
|
||||||
return this.typeface;
|
return this.typeface;
|
||||||
}
|
}
|
||||||
public void getTextBounds(String text, int start, int end, Rect bounds) {}
|
public void getTextBounds(String text, int start, int end, Rect bounds) {}
|
||||||
@@ -82,20 +74,16 @@ public class Paint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setStyle(Style style) {
|
public void setStyle(Style style) {
|
||||||
native_set_style(skia_paint, style.nativeInt);
|
this.style = style;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float ascent() {
|
public float ascent() {
|
||||||
if(skia_font == 0)
|
return 10;
|
||||||
return 0;
|
|
||||||
return native_ascent(skia_font);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float measureText(char[] text, int index, int count) { return 10; }
|
public float measureText(char[] text, int index, int count) { return 10; }
|
||||||
public float measureText(String text, int start, int end) {
|
public float measureText(String text, int start, int end) {
|
||||||
if (skia_font == 0)
|
return (end-start)*textSize;
|
||||||
skia_font = native_create_font();
|
|
||||||
return native_measure_text(skia_font, text, start, end, skia_paint);
|
|
||||||
}
|
}
|
||||||
public float measureText(String text) {
|
public float measureText(String text) {
|
||||||
return measureText(text, 0, text.length());
|
return measureText(text, 0, text.length());
|
||||||
@@ -192,7 +180,7 @@ public class Paint {
|
|||||||
public /*native*/ int getAlpha() { return 0; }
|
public /*native*/ int getAlpha() { return 0; }
|
||||||
public /*native*/ void setAlpha(int a) {}
|
public /*native*/ void setAlpha(int a) {}
|
||||||
public float getStrokeWidth() {
|
public float getStrokeWidth() {
|
||||||
return native_get_stroke_width(skia_paint);
|
return strokeWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public /*native*/ float getStrokeMiter() { return 0; }
|
public /*native*/ float getStrokeMiter() { return 0; }
|
||||||
@@ -211,9 +199,6 @@ public class Paint {
|
|||||||
public void setShadowLayer(float radius, float dx, float dy, int color) {}
|
public void setShadowLayer(float radius, float dx, float dy, int color) {}
|
||||||
|
|
||||||
public Xfermode setXfermode(Xfermode xfermode) {
|
public Xfermode setXfermode(Xfermode xfermode) {
|
||||||
if (xfermode instanceof PorterDuffXfermode) {
|
|
||||||
native_set_blendmode(skia_paint, ((PorterDuffXfermode)xfermode).mode.nativeInt);
|
|
||||||
}
|
|
||||||
return xfermode;
|
return xfermode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,21 +297,6 @@ public class Paint {
|
|||||||
public float getLetterSpacing() { return 1.0f; }
|
public float getLetterSpacing() { return 1.0f; }
|
||||||
|
|
||||||
public Style getStyle() {
|
public Style getStyle() {
|
||||||
return Style.values()[native_get_style(skia_paint)];
|
return style;
|
||||||
}
|
}
|
||||||
|
|
||||||
private native long native_constructor();
|
|
||||||
private native void native_set_antialias(long skia_paint, boolean aa);
|
|
||||||
private native void native_set_color(long skia_paint, int color);
|
|
||||||
private native int native_get_color(long skia_paint);
|
|
||||||
private static native long native_create_font();
|
|
||||||
private static native float native_ascent(long skia_font);
|
|
||||||
private static native void native_set_typeface(long skia_font, long skia_typeface);
|
|
||||||
private static native void native_set_text_size(long skia_font, float size);
|
|
||||||
private static native float native_measure_text(long skia_font, CharSequence text, int start, int end, long skia_paint);
|
|
||||||
private static native void native_set_stroke_width(long skia_font, float width);
|
|
||||||
private static native float native_get_stroke_width(long skia_font);
|
|
||||||
private static native void native_set_style(long skia_paint, int style);
|
|
||||||
private static native void native_set_blendmode(long skia_paint, int mode);
|
|
||||||
private static native int native_get_style(long skia_paint);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ public class Typeface {
|
|||||||
public static final int ITALIC = 2;
|
public static final int ITALIC = 2;
|
||||||
public static final int BOLD_ITALIC = 3;
|
public static final int BOLD_ITALIC = 3;
|
||||||
|
|
||||||
public long skia_typeface = 0;
|
|
||||||
public long native_instance = 0; // directly accessed by androidx
|
public long native_instance = 0; // directly accessed by androidx
|
||||||
|
|
||||||
public static Typeface createFromAsset(AssetManager mgr, String path) {
|
public static Typeface createFromAsset(AssetManager mgr, String path) {
|
||||||
@@ -42,7 +41,6 @@ public class Typeface {
|
|||||||
|
|
||||||
public static Typeface create(String family_name, int style) {
|
public static Typeface create(String family_name, int style) {
|
||||||
Typeface ret = new Typeface();
|
Typeface ret = new Typeface();
|
||||||
ret.skia_typeface = native_create(family_name, style);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,8 +52,6 @@ public class Typeface {
|
|||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static native long native_create(CharSequence family_name, int style);
|
|
||||||
|
|
||||||
public int getStyle() {
|
public int getStyle() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Google Inc.
|
|
||||||
* Copyright 2015 Xamarin Inc.
|
|
||||||
* Copyright 2017 Microsoft Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
|
||||||
* found in the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef gr_context_DEFINED
|
|
||||||
#define gr_context_DEFINED
|
|
||||||
|
|
||||||
#include "include/c/sk_types.h"
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_BEGIN_GUARD
|
|
||||||
|
|
||||||
// GrRecordingContext
|
|
||||||
|
|
||||||
SK_C_API void gr_recording_context_unref(gr_recording_context_t* context);
|
|
||||||
SK_C_API int gr_recording_context_get_max_surface_sample_count_for_color_type(gr_recording_context_t* context, sk_colortype_t colorType);
|
|
||||||
SK_C_API gr_backend_t gr_recording_context_get_backend(gr_recording_context_t* context);
|
|
||||||
SK_C_API bool gr_recording_context_is_abandoned(gr_recording_context_t* context);
|
|
||||||
SK_C_API int gr_recording_context_max_texture_size(gr_recording_context_t* context);
|
|
||||||
SK_C_API int gr_recording_context_max_render_target_size(gr_recording_context_t* context);
|
|
||||||
|
|
||||||
// GrDirectContext
|
|
||||||
|
|
||||||
SK_C_API gr_direct_context_t* gr_direct_context_make_gl(const gr_glinterface_t* glInterface);
|
|
||||||
SK_C_API gr_direct_context_t* gr_direct_context_make_gl_with_options(const gr_glinterface_t* glInterface, const gr_context_options_t* options);
|
|
||||||
SK_C_API gr_direct_context_t* gr_direct_context_make_vulkan(const gr_vk_backendcontext_t vkBackendContext);
|
|
||||||
SK_C_API gr_direct_context_t* gr_direct_context_make_vulkan_with_options(const gr_vk_backendcontext_t vkBackendContext, const gr_context_options_t* options);
|
|
||||||
SK_C_API gr_direct_context_t* gr_direct_context_make_metal(void* device, void* queue);
|
|
||||||
SK_C_API gr_direct_context_t* gr_direct_context_make_metal_with_options(void* device, void* queue, const gr_context_options_t* options);
|
|
||||||
|
|
||||||
// TODO: the overloads with GrContextOptions
|
|
||||||
|
|
||||||
SK_C_API bool gr_direct_context_is_abandoned(gr_direct_context_t* context);
|
|
||||||
SK_C_API void gr_direct_context_abandon_context(gr_direct_context_t* context);
|
|
||||||
SK_C_API void gr_direct_context_release_resources_and_abandon_context(gr_direct_context_t* context);
|
|
||||||
SK_C_API size_t gr_direct_context_get_resource_cache_limit(gr_direct_context_t* context);
|
|
||||||
SK_C_API void gr_direct_context_set_resource_cache_limit(gr_direct_context_t* context, size_t maxResourceBytes);
|
|
||||||
SK_C_API void gr_direct_context_get_resource_cache_usage(gr_direct_context_t* context, int* maxResources, size_t* maxResourceBytes);
|
|
||||||
SK_C_API void gr_direct_context_flush(gr_direct_context_t* context);
|
|
||||||
SK_C_API bool gr_direct_context_submit(gr_direct_context_t* context, bool syncCpu);
|
|
||||||
SK_C_API void gr_direct_context_flush_and_submit(gr_direct_context_t* context, bool syncCpu);
|
|
||||||
SK_C_API void gr_direct_context_reset_context(gr_direct_context_t* context, uint32_t state);
|
|
||||||
SK_C_API void gr_direct_context_dump_memory_statistics(const gr_direct_context_t* context, sk_tracememorydump_t* dump);
|
|
||||||
SK_C_API void gr_direct_context_free_gpu_resources(gr_direct_context_t* context);
|
|
||||||
SK_C_API void gr_direct_context_perform_deferred_cleanup(gr_direct_context_t* context, long long ms);
|
|
||||||
SK_C_API void gr_direct_context_purge_unlocked_resources_bytes(gr_direct_context_t* context, size_t bytesToPurge, bool preferScratchResources);
|
|
||||||
SK_C_API void gr_direct_context_purge_unlocked_resources(gr_direct_context_t* context, bool scratchResourcesOnly);
|
|
||||||
|
|
||||||
|
|
||||||
// GrGLInterface
|
|
||||||
|
|
||||||
SK_C_API const gr_glinterface_t* gr_glinterface_create_native_interface(void);
|
|
||||||
SK_C_API const gr_glinterface_t* gr_glinterface_assemble_interface(void* ctx, gr_gl_get_proc get);
|
|
||||||
SK_C_API const gr_glinterface_t* gr_glinterface_assemble_gl_interface(void* ctx, gr_gl_get_proc get);
|
|
||||||
SK_C_API const gr_glinterface_t* gr_glinterface_assemble_gles_interface(void* ctx, gr_gl_get_proc get);
|
|
||||||
SK_C_API const gr_glinterface_t* gr_glinterface_assemble_webgl_interface(void* ctx, gr_gl_get_proc get);
|
|
||||||
|
|
||||||
SK_C_API void gr_glinterface_unref(const gr_glinterface_t* glInterface);
|
|
||||||
SK_C_API bool gr_glinterface_validate(const gr_glinterface_t* glInterface);
|
|
||||||
SK_C_API bool gr_glinterface_has_extension(const gr_glinterface_t* glInterface, const char* extension);
|
|
||||||
|
|
||||||
// GrVkExtensions
|
|
||||||
|
|
||||||
SK_C_API gr_vk_extensions_t* gr_vk_extensions_new(void);
|
|
||||||
SK_C_API void gr_vk_extensions_delete(gr_vk_extensions_t* extensions);
|
|
||||||
SK_C_API void gr_vk_extensions_init(gr_vk_extensions_t* extensions, gr_vk_get_proc getProc, void* userData, vk_instance_t* instance, vk_physical_device_t* physDev, uint32_t instanceExtensionCount, const char** instanceExtensions, uint32_t deviceExtensionCount, const char** deviceExtensions);
|
|
||||||
SK_C_API bool gr_vk_extensions_has_extension(gr_vk_extensions_t* extensions, const char* ext, uint32_t minVersion);
|
|
||||||
|
|
||||||
// GrBackendTexture
|
|
||||||
|
|
||||||
SK_C_API gr_backendtexture_t* gr_backendtexture_new_gl(int width, int height, bool mipmapped, const gr_gl_textureinfo_t* glInfo);
|
|
||||||
SK_C_API gr_backendtexture_t* gr_backendtexture_new_vulkan(int width, int height, const gr_vk_imageinfo_t* vkInfo);
|
|
||||||
SK_C_API gr_backendtexture_t* gr_backendtexture_new_metal(int width, int height, bool mipmapped, const gr_mtl_textureinfo_t* mtlInfo);
|
|
||||||
SK_C_API void gr_backendtexture_delete(gr_backendtexture_t* texture);
|
|
||||||
|
|
||||||
SK_C_API bool gr_backendtexture_is_valid(const gr_backendtexture_t* texture);
|
|
||||||
SK_C_API int gr_backendtexture_get_width(const gr_backendtexture_t* texture);
|
|
||||||
SK_C_API int gr_backendtexture_get_height(const gr_backendtexture_t* texture);
|
|
||||||
SK_C_API bool gr_backendtexture_has_mipmaps(const gr_backendtexture_t* texture);
|
|
||||||
SK_C_API gr_backend_t gr_backendtexture_get_backend(const gr_backendtexture_t* texture);
|
|
||||||
SK_C_API bool gr_backendtexture_get_gl_textureinfo(const gr_backendtexture_t* texture, gr_gl_textureinfo_t* glInfo);
|
|
||||||
|
|
||||||
|
|
||||||
// GrBackendRenderTarget
|
|
||||||
|
|
||||||
SK_C_API gr_backendrendertarget_t* gr_backendrendertarget_new_gl(int width, int height, int samples, int stencils, const gr_gl_framebufferinfo_t* glInfo);
|
|
||||||
SK_C_API gr_backendrendertarget_t* gr_backendrendertarget_new_vulkan(int width, int height, int samples, const gr_vk_imageinfo_t* vkImageInfo);
|
|
||||||
SK_C_API gr_backendrendertarget_t* gr_backendrendertarget_new_metal(int width, int height, int samples, const gr_mtl_textureinfo_t* mtlInfo);
|
|
||||||
|
|
||||||
SK_C_API void gr_backendrendertarget_delete(gr_backendrendertarget_t* rendertarget);
|
|
||||||
|
|
||||||
SK_C_API bool gr_backendrendertarget_is_valid(const gr_backendrendertarget_t* rendertarget);
|
|
||||||
SK_C_API int gr_backendrendertarget_get_width(const gr_backendrendertarget_t* rendertarget);
|
|
||||||
SK_C_API int gr_backendrendertarget_get_height(const gr_backendrendertarget_t* rendertarget);
|
|
||||||
SK_C_API int gr_backendrendertarget_get_samples(const gr_backendrendertarget_t* rendertarget);
|
|
||||||
SK_C_API int gr_backendrendertarget_get_stencils(const gr_backendrendertarget_t* rendertarget);
|
|
||||||
SK_C_API gr_backend_t gr_backendrendertarget_get_backend(const gr_backendrendertarget_t* rendertarget);
|
|
||||||
SK_C_API bool gr_backendrendertarget_get_gl_framebufferinfo(const gr_backendrendertarget_t* rendertarget, gr_gl_framebufferinfo_t* glInfo);
|
|
||||||
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_END_GUARD
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Google Inc.
|
|
||||||
* Copyright 2015 Xamarin Inc.
|
|
||||||
* Copyright 2017 Microsoft Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
|
||||||
* found in the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef sk_bitmap_DEFINED
|
|
||||||
#define sk_bitmap_DEFINED
|
|
||||||
|
|
||||||
#include "include/c/sk_types.h"
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_BEGIN_GUARD
|
|
||||||
|
|
||||||
SK_C_API void sk_bitmap_destructor(sk_bitmap_t* cbitmap);
|
|
||||||
SK_C_API sk_bitmap_t* sk_bitmap_new(void);
|
|
||||||
SK_C_API void sk_bitmap_get_info(sk_bitmap_t* cbitmap, sk_imageinfo_t* info);
|
|
||||||
SK_C_API void* sk_bitmap_get_pixels(sk_bitmap_t* cbitmap, size_t* length);
|
|
||||||
SK_C_API size_t sk_bitmap_get_row_bytes(sk_bitmap_t* cbitmap);
|
|
||||||
SK_C_API size_t sk_bitmap_get_byte_count(sk_bitmap_t* cbitmap);
|
|
||||||
SK_C_API void sk_bitmap_reset(sk_bitmap_t* cbitmap);
|
|
||||||
SK_C_API bool sk_bitmap_is_null(sk_bitmap_t* cbitmap);
|
|
||||||
SK_C_API bool sk_bitmap_is_immutable(sk_bitmap_t* cbitmap);
|
|
||||||
SK_C_API void sk_bitmap_set_immutable(sk_bitmap_t* cbitmap);
|
|
||||||
SK_C_API void sk_bitmap_erase(sk_bitmap_t* cbitmap, sk_color_t color);
|
|
||||||
SK_C_API void sk_bitmap_erase_rect(sk_bitmap_t* cbitmap, sk_color_t color, sk_irect_t* rect);
|
|
||||||
SK_C_API uint8_t* sk_bitmap_get_addr_8(sk_bitmap_t* cbitmap, int x, int y);
|
|
||||||
SK_C_API uint16_t* sk_bitmap_get_addr_16(sk_bitmap_t* cbitmap, int x, int y);
|
|
||||||
SK_C_API uint32_t* sk_bitmap_get_addr_32(sk_bitmap_t* cbitmap, int x, int y);
|
|
||||||
SK_C_API void* sk_bitmap_get_addr(sk_bitmap_t* cbitmap, int x, int y);
|
|
||||||
SK_C_API sk_color_t sk_bitmap_get_pixel_color(sk_bitmap_t* cbitmap, int x, int y);
|
|
||||||
SK_C_API bool sk_bitmap_ready_to_draw(sk_bitmap_t* cbitmap);
|
|
||||||
SK_C_API void sk_bitmap_get_pixel_colors(sk_bitmap_t* cbitmap, sk_color_t* colors);
|
|
||||||
SK_C_API bool sk_bitmap_install_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* cinfo, void* pixels, size_t rowBytes, const sk_bitmap_release_proc releaseProc, void* context);
|
|
||||||
SK_C_API bool sk_bitmap_install_pixels_with_pixmap(sk_bitmap_t* cbitmap, const sk_pixmap_t* cpixmap);
|
|
||||||
SK_C_API bool sk_bitmap_try_alloc_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, size_t rowBytes);
|
|
||||||
SK_C_API bool sk_bitmap_try_alloc_pixels_with_flags(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, uint32_t flags);
|
|
||||||
SK_C_API void sk_bitmap_set_pixels(sk_bitmap_t* cbitmap, void* pixels);
|
|
||||||
SK_C_API bool sk_bitmap_peek_pixels(sk_bitmap_t* cbitmap, sk_pixmap_t* cpixmap);
|
|
||||||
SK_C_API bool sk_bitmap_extract_subset(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, sk_irect_t* subset);
|
|
||||||
SK_C_API bool sk_bitmap_extract_alpha(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, const sk_paint_t* paint, sk_ipoint_t* offset);
|
|
||||||
SK_C_API void sk_bitmap_notify_pixels_changed(sk_bitmap_t* cbitmap);
|
|
||||||
SK_C_API void sk_bitmap_swap(sk_bitmap_t* cbitmap, sk_bitmap_t* cother);
|
|
||||||
SK_C_API sk_shader_t* sk_bitmap_make_shader(sk_bitmap_t* cbitmap, sk_shader_tilemode_t tmx, sk_shader_tilemode_t tmy, const sk_matrix_t* cmatrix);
|
|
||||||
SK_C_API sk_shader_t* sk_bitmap_make_shader_v2(sk_bitmap_t* cbitmap, sk_shader_tilemode_t tmx, sk_shader_tilemode_t tmy, sk_sampling_options_t* sampling, const sk_matrix_t* cmatrix);
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_END_GUARD
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Google Inc.
|
|
||||||
* Copyright 2015 Xamarin Inc.
|
|
||||||
* Copyright 2017 Microsoft Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
|
||||||
* found in the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef sk_canvas_DEFINED
|
|
||||||
#define sk_canvas_DEFINED
|
|
||||||
|
|
||||||
#include "include/c/sk_types.h"
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_BEGIN_GUARD
|
|
||||||
|
|
||||||
SK_C_API void sk_canvas_destroy(sk_canvas_t* ccanvas);
|
|
||||||
SK_C_API void sk_canvas_clear(sk_canvas_t* ccanvas, sk_color_t color);
|
|
||||||
SK_C_API void sk_canvas_clear_color4f(sk_canvas_t* ccanvas, sk_color4f_t color);
|
|
||||||
SK_C_API void sk_canvas_discard(sk_canvas_t* ccanvas);
|
|
||||||
SK_C_API int sk_canvas_get_save_count(sk_canvas_t* ccanvas);
|
|
||||||
SK_C_API void sk_canvas_restore_to_count(sk_canvas_t* ccanvas, int saveCount);
|
|
||||||
SK_C_API void sk_canvas_draw_color(sk_canvas_t* ccanvas, sk_color_t color, sk_blendmode_t cmode);
|
|
||||||
SK_C_API void sk_canvas_draw_color4f(sk_canvas_t* ccanvas, sk_color4f_t color, sk_blendmode_t cmode);
|
|
||||||
SK_C_API void sk_canvas_draw_points(sk_canvas_t* ccanvas, sk_point_mode_t pointMode, size_t count, const sk_point_t points [], const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_point(sk_canvas_t* ccanvas, float x, float y, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_line(sk_canvas_t* ccanvas, float x0, float y0, float x1, float y1, sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_simple_text(sk_canvas_t* ccanvas, const void* text, size_t byte_length, sk_text_encoding_t encoding, float x, float y, const sk_font_t* cfont, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_text_blob (sk_canvas_t* ccanvas, sk_textblob_t* text, float x, float y, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_reset_matrix(sk_canvas_t* ccanvas);
|
|
||||||
SK_C_API void sk_canvas_set_matrix(sk_canvas_t* ccanvas, const sk_matrix44_t* cmatrix);
|
|
||||||
SK_C_API void sk_canvas_get_matrix(sk_canvas_t* ccanvas, sk_matrix44_t* cmatrix);
|
|
||||||
SK_C_API void sk_canvas_draw_round_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect, float rx, float ry, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_clip_rect_with_operation(sk_canvas_t* ccanvas, const sk_rect_t* crect, sk_clipop_t op, bool doAA);
|
|
||||||
SK_C_API void sk_canvas_clip_path_with_operation(sk_canvas_t* ccanvas, const sk_path_t* cpath, sk_clipop_t op, bool doAA);
|
|
||||||
SK_C_API void sk_canvas_clip_rrect_with_operation(sk_canvas_t* ccanvas, const sk_rrect_t* crect, sk_clipop_t op, bool doAA);
|
|
||||||
SK_C_API bool sk_canvas_get_local_clip_bounds(sk_canvas_t* ccanvas, sk_rect_t* cbounds);
|
|
||||||
SK_C_API bool sk_canvas_get_device_clip_bounds(sk_canvas_t* ccanvas, sk_irect_t* cbounds);
|
|
||||||
SK_C_API int sk_canvas_save(sk_canvas_t* ccanvas);
|
|
||||||
SK_C_API int sk_canvas_save_layer(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_restore(sk_canvas_t* ccanvas);
|
|
||||||
SK_C_API void sk_canvas_translate(sk_canvas_t* ccanvas, float dx, float dy);
|
|
||||||
SK_C_API void sk_canvas_scale(sk_canvas_t* ccanvas, float sx, float sy);
|
|
||||||
SK_C_API void sk_canvas_rotate_degrees(sk_canvas_t* ccanvas, float degrees);
|
|
||||||
SK_C_API void sk_canvas_rotate_radians(sk_canvas_t* ccanvas, float radians);
|
|
||||||
SK_C_API void sk_canvas_skew(sk_canvas_t* ccanvas, float sx, float sy);
|
|
||||||
SK_C_API void sk_canvas_concat(sk_canvas_t* ccanvas, const sk_matrix44_t* cmatrix);
|
|
||||||
SK_C_API bool sk_canvas_quick_reject(sk_canvas_t* ccanvas, const sk_rect_t* crect);
|
|
||||||
SK_C_API void sk_canvas_clip_region(sk_canvas_t* ccanvas, const sk_region_t* region, sk_clipop_t op);
|
|
||||||
SK_C_API void sk_canvas_draw_paint(sk_canvas_t* ccanvas, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_region(sk_canvas_t* ccanvas, const sk_region_t* cregion, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_rrect(sk_canvas_t* ccanvas, const sk_rrect_t* crect, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_circle(sk_canvas_t* ccanvas, float cx, float cy, float rad, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_oval(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_path(sk_canvas_t* ccanvas, const sk_path_t* cpath, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_image(sk_canvas_t* ccanvas, const sk_image_t* cimage, float x, float y, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_image_v2(sk_canvas_t* ccanvas, const sk_image_t* cimage, float x, float y, const sk_sampling_options_t* sampling, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_image_rect(sk_canvas_t* ccanvas, const sk_image_t* cimage, const sk_rect_t* csrcR, const sk_rect_t* cdstR, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_image_rect_v2(sk_canvas_t* ccanvas, const sk_image_t* cimage, const sk_rect_t* csrcR, const sk_rect_t* cdstR, const sk_sampling_options_t* sampling, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_picture(sk_canvas_t* ccanvas, const sk_picture_t* cpicture, const sk_matrix_t* cmatrix, const sk_paint_t* cpaint);
|
|
||||||
SK_C_API void sk_canvas_draw_drawable(sk_canvas_t* ccanvas, sk_drawable_t* cdrawable, const sk_matrix_t* cmatrix);
|
|
||||||
SK_C_API void sk_canvas_flush(sk_canvas_t* ccanvas);
|
|
||||||
SK_C_API sk_canvas_t* sk_canvas_new_from_bitmap(const sk_bitmap_t* bitmap);
|
|
||||||
SK_C_API sk_canvas_t* sk_canvas_new_from_raster(const sk_imageinfo_t* cinfo, void* pixels, size_t rowBytes, const sk_surfaceprops_t* props);
|
|
||||||
SK_C_API void sk_canvas_draw_annotation(sk_canvas_t* t, const sk_rect_t* rect, const char* key, sk_data_t* value);
|
|
||||||
SK_C_API void sk_canvas_draw_url_annotation(sk_canvas_t* t, const sk_rect_t* rect, sk_data_t* value);
|
|
||||||
SK_C_API void sk_canvas_draw_named_destination_annotation(sk_canvas_t* t, const sk_point_t* point, sk_data_t* value);
|
|
||||||
SK_C_API void sk_canvas_draw_link_destination_annotation(sk_canvas_t* t, const sk_rect_t* rect, sk_data_t* value);
|
|
||||||
SK_C_API void sk_canvas_draw_image_lattice(sk_canvas_t* ccanvas, const sk_image_t* image, const sk_lattice_t* lattice, const sk_rect_t* dst, sk_filter_mode_t mode, const sk_paint_t* paint);
|
|
||||||
SK_C_API void sk_canvas_draw_image_nine(sk_canvas_t* ccanvas, const sk_image_t* image, const sk_irect_t* center, const sk_rect_t* dst, sk_filter_mode_t mode, const sk_paint_t* paint);
|
|
||||||
SK_C_API void sk_canvas_draw_vertices(sk_canvas_t* ccanvas, const sk_vertices_t* vertices, sk_blendmode_t mode, const sk_paint_t* paint);
|
|
||||||
SK_C_API void sk_canvas_draw_arc(sk_canvas_t* ccanvas, const sk_rect_t* oval, float startAngle, float sweepAngle, bool useCenter, const sk_paint_t* paint);
|
|
||||||
SK_C_API void sk_canvas_draw_drrect(sk_canvas_t* ccanvas, const sk_rrect_t* outer, const sk_rrect_t* inner, const sk_paint_t* paint);
|
|
||||||
SK_C_API void sk_canvas_draw_atlas(sk_canvas_t* ccanvas, const sk_image_t* atlas, const sk_rsxform_t* xform, const sk_rect_t* tex, const sk_color_t* colors, int count, sk_blendmode_t mode, const sk_rect_t* cullRect, const sk_paint_t* paint);
|
|
||||||
SK_C_API void sk_canvas_draw_atlas_v2(sk_canvas_t* ccanvas, const sk_image_t* atlas, const sk_rsxform_t* xform, const sk_rect_t* tex, const sk_color_t* colors, int count, sk_blendmode_t mode, const sk_sampling_options_t* sampling, const sk_rect_t* cullRect, const sk_paint_t* paint);
|
|
||||||
SK_C_API void sk_canvas_draw_patch(sk_canvas_t* ccanvas, const sk_point_t* cubics, const sk_color_t* colors, const sk_point_t* texCoords, sk_blendmode_t mode, const sk_paint_t* paint);
|
|
||||||
SK_C_API bool sk_canvas_is_clip_empty(sk_canvas_t* ccanvas);
|
|
||||||
SK_C_API bool sk_canvas_is_clip_rect(sk_canvas_t* ccanvas);
|
|
||||||
SK_C_API sk_nodraw_canvas_t* sk_nodraw_canvas_new(int width, int height);
|
|
||||||
SK_C_API void sk_nodraw_canvas_destroy(sk_nodraw_canvas_t* t);
|
|
||||||
SK_C_API sk_nway_canvas_t* sk_nway_canvas_new(int width, int height);
|
|
||||||
SK_C_API void sk_nway_canvas_destroy(sk_nway_canvas_t* t);
|
|
||||||
SK_C_API void sk_nway_canvas_add_canvas(sk_nway_canvas_t* t, sk_canvas_t* canvas);
|
|
||||||
SK_C_API void sk_nway_canvas_remove_canvas(sk_nway_canvas_t* t, sk_canvas_t* canvas);
|
|
||||||
SK_C_API void sk_nway_canvas_remove_all(sk_nway_canvas_t* t);
|
|
||||||
SK_C_API sk_overdraw_canvas_t* sk_overdraw_canvas_new(sk_canvas_t* canvas);
|
|
||||||
SK_C_API void sk_overdraw_canvas_destroy(sk_overdraw_canvas_t* canvas);
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_END_GUARD
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Google Inc.
|
|
||||||
* Copyright 2015 Xamarin Inc.
|
|
||||||
* Copyright 2017 Microsoft Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
|
||||||
* found in the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef sk_codec_DEFINED
|
|
||||||
#define sk_codec_DEFINED
|
|
||||||
|
|
||||||
#include "include/c/sk_types.h"
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_BEGIN_GUARD
|
|
||||||
|
|
||||||
SK_C_API size_t sk_codec_min_buffered_bytes_needed(void);
|
|
||||||
|
|
||||||
SK_C_API sk_codec_t* sk_codec_new_from_stream(sk_stream_t* stream, sk_codec_result_t* result);
|
|
||||||
SK_C_API sk_codec_t* sk_codec_new_from_data(sk_data_t* data);
|
|
||||||
SK_C_API void sk_codec_destroy(sk_codec_t* codec);
|
|
||||||
SK_C_API void sk_codec_get_info(sk_codec_t* codec, sk_imageinfo_t* info);
|
|
||||||
SK_C_API sk_encodedorigin_t sk_codec_get_origin(sk_codec_t* codec);
|
|
||||||
SK_C_API void sk_codec_get_scaled_dimensions(sk_codec_t* codec, float desiredScale, sk_isize_t* dimensions);
|
|
||||||
SK_C_API bool sk_codec_get_valid_subset(sk_codec_t* codec, sk_irect_t* desiredSubset);
|
|
||||||
SK_C_API sk_encoded_image_format_t sk_codec_get_encoded_format(sk_codec_t* codec);
|
|
||||||
SK_C_API sk_codec_result_t sk_codec_get_pixels(sk_codec_t* codec, const sk_imageinfo_t* info, void* pixels, size_t rowBytes, const sk_codec_options_t* options);
|
|
||||||
SK_C_API sk_codec_result_t sk_codec_start_incremental_decode(sk_codec_t* codec, const sk_imageinfo_t* info, void* pixels, size_t rowBytes, const sk_codec_options_t* options);
|
|
||||||
SK_C_API sk_codec_result_t sk_codec_incremental_decode(sk_codec_t* codec, int* rowsDecoded);
|
|
||||||
SK_C_API sk_codec_result_t sk_codec_start_scanline_decode(sk_codec_t* codec, const sk_imageinfo_t* info, const sk_codec_options_t* options);
|
|
||||||
SK_C_API int sk_codec_get_scanlines(sk_codec_t* codec, void* dst, int countLines, size_t rowBytes);
|
|
||||||
SK_C_API bool sk_codec_skip_scanlines(sk_codec_t* codec, int countLines);
|
|
||||||
SK_C_API sk_codec_scanline_order_t sk_codec_get_scanline_order(sk_codec_t* codec);
|
|
||||||
SK_C_API int sk_codec_next_scanline(sk_codec_t* codec);
|
|
||||||
SK_C_API int sk_codec_output_scanline(sk_codec_t* codec, int inputScanline);
|
|
||||||
SK_C_API int sk_codec_get_frame_count(sk_codec_t* codec);
|
|
||||||
SK_C_API void sk_codec_get_frame_info(sk_codec_t* codec, sk_codec_frameinfo_t* frameInfo);
|
|
||||||
SK_C_API bool sk_codec_get_frame_info_for_index(sk_codec_t* codec, int index, sk_codec_frameinfo_t* frameInfo);
|
|
||||||
SK_C_API int sk_codec_get_repetition_count(sk_codec_t* codec);
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_END_GUARD
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Google Inc.
|
|
||||||
* Copyright 2015 Xamarin Inc.
|
|
||||||
* Copyright 2017 Microsoft Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
|
||||||
* found in the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef sk_colorfilter_DEFINED
|
|
||||||
#define sk_colorfilter_DEFINED
|
|
||||||
|
|
||||||
#include "include/c/sk_types.h"
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_BEGIN_GUARD
|
|
||||||
|
|
||||||
SK_C_API void sk_colorfilter_unref(sk_colorfilter_t* filter);
|
|
||||||
SK_C_API sk_colorfilter_t* sk_colorfilter_new_mode(sk_color_t c, sk_blendmode_t mode);
|
|
||||||
SK_C_API sk_colorfilter_t* sk_colorfilter_new_lighting(sk_color_t mul, sk_color_t add);
|
|
||||||
SK_C_API sk_colorfilter_t* sk_colorfilter_new_compose(sk_colorfilter_t* outer, sk_colorfilter_t* inner);
|
|
||||||
SK_C_API sk_colorfilter_t* sk_colorfilter_new_color_matrix(const float array[20]);
|
|
||||||
SK_C_API sk_colorfilter_t* sk_colorfilter_new_luma_color(void);
|
|
||||||
SK_C_API sk_colorfilter_t* sk_colorfilter_new_high_contrast(const sk_highcontrastconfig_t* config);
|
|
||||||
SK_C_API sk_colorfilter_t* sk_colorfilter_new_table(const uint8_t table[256]);
|
|
||||||
SK_C_API sk_colorfilter_t* sk_colorfilter_new_table_argb(const uint8_t tableA[256], const uint8_t tableR[256], const uint8_t tableG[256], const uint8_t tableB[256]);
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_END_GUARD
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Google Inc.
|
|
||||||
* Copyright 2015 Xamarin Inc.
|
|
||||||
* Copyright 2017 Microsoft Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
|
||||||
* found in the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef sk_colorspace_DEFINED
|
|
||||||
#define sk_colorspace_DEFINED
|
|
||||||
|
|
||||||
#include "include/c/sk_types.h"
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_BEGIN_GUARD
|
|
||||||
|
|
||||||
// TODO: skcms.h has things that may be useful
|
|
||||||
|
|
||||||
// sk_colorspace_t
|
|
||||||
|
|
||||||
SK_C_API void sk_colorspace_ref(sk_colorspace_t* colorspace);
|
|
||||||
SK_C_API void sk_colorspace_unref(sk_colorspace_t* colorspace);
|
|
||||||
SK_C_API sk_colorspace_t* sk_colorspace_new_srgb(void);
|
|
||||||
SK_C_API sk_colorspace_t* sk_colorspace_new_srgb_linear(void);
|
|
||||||
SK_C_API sk_colorspace_t* sk_colorspace_new_rgb(const sk_colorspace_transfer_fn_t* transferFn, const sk_colorspace_xyz_t* toXYZD50);
|
|
||||||
SK_C_API sk_colorspace_t* sk_colorspace_new_icc(const sk_colorspace_icc_profile_t* profile);
|
|
||||||
SK_C_API void sk_colorspace_to_profile(const sk_colorspace_t* colorspace, sk_colorspace_icc_profile_t* profile);
|
|
||||||
SK_C_API bool sk_colorspace_gamma_close_to_srgb(const sk_colorspace_t* colorspace);
|
|
||||||
SK_C_API bool sk_colorspace_gamma_is_linear(const sk_colorspace_t* colorspace);
|
|
||||||
SK_C_API bool sk_colorspace_is_numerical_transfer_fn(const sk_colorspace_t* colorspace, sk_colorspace_transfer_fn_t* transferFn);
|
|
||||||
SK_C_API bool sk_colorspace_to_xyzd50(const sk_colorspace_t* colorspace, sk_colorspace_xyz_t* toXYZD50);
|
|
||||||
SK_C_API sk_colorspace_t* sk_colorspace_make_linear_gamma(const sk_colorspace_t* colorspace);
|
|
||||||
SK_C_API sk_colorspace_t* sk_colorspace_make_srgb_gamma(const sk_colorspace_t* colorspace);
|
|
||||||
SK_C_API bool sk_colorspace_is_srgb(const sk_colorspace_t* colorspace);
|
|
||||||
SK_C_API bool sk_colorspace_equals(const sk_colorspace_t* src, const sk_colorspace_t* dst);
|
|
||||||
|
|
||||||
// sk_colorspace_transfer_fn_t
|
|
||||||
|
|
||||||
SK_C_API void sk_colorspace_transfer_fn_named_srgb(sk_colorspace_transfer_fn_t* transferFn);
|
|
||||||
SK_C_API void sk_colorspace_transfer_fn_named_2dot2(sk_colorspace_transfer_fn_t* transferFn);
|
|
||||||
SK_C_API void sk_colorspace_transfer_fn_named_linear(sk_colorspace_transfer_fn_t* transferFn);
|
|
||||||
SK_C_API void sk_colorspace_transfer_fn_named_rec2020(sk_colorspace_transfer_fn_t* transferFn);
|
|
||||||
SK_C_API void sk_colorspace_transfer_fn_named_pq(sk_colorspace_transfer_fn_t* transferFn);
|
|
||||||
SK_C_API void sk_colorspace_transfer_fn_named_hlg(sk_colorspace_transfer_fn_t* transferFn);
|
|
||||||
SK_C_API float sk_colorspace_transfer_fn_eval(const sk_colorspace_transfer_fn_t* transferFn, float x);
|
|
||||||
SK_C_API bool sk_colorspace_transfer_fn_invert(const sk_colorspace_transfer_fn_t* src, sk_colorspace_transfer_fn_t* dst);
|
|
||||||
|
|
||||||
// sk_colorspace_primaries_t
|
|
||||||
|
|
||||||
SK_C_API bool sk_colorspace_primaries_to_xyzd50(const sk_colorspace_primaries_t* primaries, sk_colorspace_xyz_t* toXYZD50);
|
|
||||||
|
|
||||||
// sk_colorspace_xyz_t
|
|
||||||
|
|
||||||
SK_C_API void sk_colorspace_xyz_named_srgb(sk_colorspace_xyz_t* xyz);
|
|
||||||
SK_C_API void sk_colorspace_xyz_named_adobe_rgb(sk_colorspace_xyz_t* xyz);
|
|
||||||
SK_C_API void sk_colorspace_xyz_named_display_p3(sk_colorspace_xyz_t* xyz);
|
|
||||||
SK_C_API void sk_colorspace_xyz_named_rec2020(sk_colorspace_xyz_t* xyz);
|
|
||||||
SK_C_API void sk_colorspace_xyz_named_xyz(sk_colorspace_xyz_t* xyz);
|
|
||||||
SK_C_API bool sk_colorspace_xyz_invert(const sk_colorspace_xyz_t* src, sk_colorspace_xyz_t* dst);
|
|
||||||
SK_C_API void sk_colorspace_xyz_concat(const sk_colorspace_xyz_t* a, const sk_colorspace_xyz_t* b, sk_colorspace_xyz_t* result);
|
|
||||||
|
|
||||||
// sk_colorspace_icc_profile_t
|
|
||||||
|
|
||||||
SK_C_API void sk_colorspace_icc_profile_delete(sk_colorspace_icc_profile_t* profile);
|
|
||||||
SK_C_API sk_colorspace_icc_profile_t* sk_colorspace_icc_profile_new(void);
|
|
||||||
SK_C_API bool sk_colorspace_icc_profile_parse(const void* buffer, size_t length, sk_colorspace_icc_profile_t* profile);
|
|
||||||
SK_C_API const uint8_t* sk_colorspace_icc_profile_get_buffer(const sk_colorspace_icc_profile_t* profile, uint32_t* size);
|
|
||||||
SK_C_API bool sk_colorspace_icc_profile_get_to_xyzd50(const sk_colorspace_icc_profile_t* profile, sk_colorspace_xyz_t* toXYZD50);
|
|
||||||
|
|
||||||
// sk_color4f_t
|
|
||||||
|
|
||||||
SK_C_API sk_color_t sk_color4f_to_color(const sk_color4f_t* color4f);
|
|
||||||
SK_C_API void sk_color4f_from_color(sk_color_t color, sk_color4f_t* color4f);
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_END_GUARD
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Google Inc.
|
|
||||||
* Copyright 2015 Xamarin Inc.
|
|
||||||
* Copyright 2017 Microsoft Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
|
||||||
* found in the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef sk_data_DEFINED
|
|
||||||
#define sk_data_DEFINED
|
|
||||||
|
|
||||||
#include "include/c/sk_types.h"
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_BEGIN_GUARD
|
|
||||||
|
|
||||||
SK_C_API sk_data_t* sk_data_new_empty(void);
|
|
||||||
SK_C_API sk_data_t* sk_data_new_with_copy(const void* src, size_t length);
|
|
||||||
SK_C_API sk_data_t* sk_data_new_subset(const sk_data_t* src, size_t offset, size_t length);
|
|
||||||
SK_C_API void sk_data_ref(const sk_data_t*);
|
|
||||||
SK_C_API void sk_data_unref(const sk_data_t*);
|
|
||||||
SK_C_API size_t sk_data_get_size(const sk_data_t*);
|
|
||||||
SK_C_API const void* sk_data_get_data(const sk_data_t*);
|
|
||||||
SK_C_API sk_data_t* sk_data_new_from_file(const char* path);
|
|
||||||
SK_C_API sk_data_t* sk_data_new_from_stream(sk_stream_t* stream, size_t length);
|
|
||||||
SK_C_API const uint8_t* sk_data_get_bytes(const sk_data_t*);
|
|
||||||
SK_C_API sk_data_t* sk_data_new_with_proc(const void* ptr, size_t length, sk_data_release_proc proc, void* ctx);
|
|
||||||
SK_C_API sk_data_t* sk_data_new_uninitialized(size_t size);
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_END_GUARD
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Google Inc.
|
|
||||||
* Copyright 2015 Xamarin Inc.
|
|
||||||
* Copyright 2017 Microsoft Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
|
||||||
* found in the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef sk_document_DEFINED
|
|
||||||
#define sk_document_DEFINED
|
|
||||||
|
|
||||||
#include "include/c/sk_types.h"
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_BEGIN_GUARD
|
|
||||||
|
|
||||||
SK_C_API void sk_document_unref(sk_document_t* document);
|
|
||||||
|
|
||||||
SK_C_API sk_document_t* sk_document_create_pdf_from_stream(sk_wstream_t* stream);
|
|
||||||
SK_C_API sk_document_t* sk_document_create_pdf_from_stream_with_metadata(sk_wstream_t* stream, const sk_document_pdf_metadata_t* metadata);
|
|
||||||
|
|
||||||
SK_C_API sk_document_t* sk_document_create_xps_from_stream(sk_wstream_t* stream, float dpi);
|
|
||||||
|
|
||||||
SK_C_API sk_canvas_t* sk_document_begin_page(sk_document_t* document, float width, float height, const sk_rect_t* content);
|
|
||||||
SK_C_API void sk_document_end_page(sk_document_t* document);
|
|
||||||
SK_C_API void sk_document_close(sk_document_t* document);
|
|
||||||
SK_C_API void sk_document_abort(sk_document_t* document);
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_END_GUARD
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2015 Xamarin Inc.
|
|
||||||
* Copyright 2017 Microsoft Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Use of this source code is governed by a BSD-style license that can be
|
|
||||||
* found in the LICENSE file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef sk_drawable_DEFINED
|
|
||||||
#define sk_drawable_DEFINED
|
|
||||||
|
|
||||||
#include "include/c/sk_types.h"
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_BEGIN_GUARD
|
|
||||||
|
|
||||||
typedef struct sk_drawable_t sk_drawable_t;
|
|
||||||
|
|
||||||
SK_C_API void sk_drawable_unref (sk_drawable_t*);
|
|
||||||
SK_C_API uint32_t sk_drawable_get_generation_id (sk_drawable_t*);
|
|
||||||
SK_C_API void sk_drawable_get_bounds (sk_drawable_t*, sk_rect_t*);
|
|
||||||
SK_C_API void sk_drawable_draw (sk_drawable_t*, sk_canvas_t*, const sk_matrix_t*);
|
|
||||||
SK_C_API sk_picture_t* sk_drawable_new_picture_snapshot(sk_drawable_t*);
|
|
||||||
SK_C_API void sk_drawable_notify_drawing_changed (sk_drawable_t*);
|
|
||||||
|
|
||||||
SK_C_PLUS_PLUS_END_GUARD
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user