drop Skia dependency

Everything is implementede using GTK Scene Graph now. Skia is no longer
needed.
This commit is contained in:
Julian Winkler 2024-12-19 21:11:53 +01:00
parent cd2c69cf73
commit f3bc468a1c
48 changed files with 45 additions and 3219 deletions

View file

@ -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 \
pc:alsa pc:glib-2.0 pc:gtk4 pc:gudev-1.0 pc:libportal \
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.
## 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
If your distro ships wolfSSL with JNI enabled already, you can just install the package and skip this step.
```sh

View file

@ -17,9 +17,6 @@ libart_dep = [
libdl_bio_dep = [
cc.find_library('dl_bio')
]
libskia_dep = [
cc.find_library('SkiaSharp')
]
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' ]),
]
@ -84,7 +81,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_Paint.c',
'src/api-impl-jni/android_opengl_GLES20.c',
'src/api-impl-jni/android_os_Environment.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_Matrix.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_DrawableContainer.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_SeekBar.c',
'src/api-impl-jni/widgets/android_widget_TextView.c',
'src/sk_area/sk_area.c',
linux_dmabuf,
viewporter,
mpris,
portal_openuri,
] + marshal_files,
include_directories: ['src/sk_area/'],
install: true,
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.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'),
libandroidfw_dep
],

View file

@ -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));
}

View file

@ -6,7 +6,7 @@
#include "../defines.h"
#include "../util.h"
#include "../main-executable/back_button.h"
#include "../../main-executable/back_button.h"
#include "android_app_Activity.h"
#include "../generated_headers/android_app_Activity.h"

View file

@ -28,10 +28,10 @@ JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawRect
/*
* Class: android_graphics_GskCanvas
* Method: native_drawPath
* Signature: (JJJ)V
* Signature: (JJII)V
*/
JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1drawPath
(JNIEnv *, jobject, jlong, jlong, jlong);
(JNIEnv *, jobject, jlong, jlong, jint, jint);
/*
* Class: android_graphics_GskCanvas
@ -68,18 +68,18 @@ JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1restore
/*
* Class: android_graphics_GskCanvas
* Method: native_drawLine
* Signature: (JFFFFJ)V
* Signature: (JFFFFIF)V
*/
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
* Method: native_drawText
* Signature: (JLjava/lang/String;FFJJ)V
* Signature: (JLjava/lang/String;FFIF)V
*/
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

View file

@ -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

View file

@ -2,9 +2,6 @@
#include <graphene.h>
#include <pango/pango.h>
#include "include/c/sk_font.h"
#include "include/c/sk_paint.h"
#include "../defines.h"
#include "../generated_headers/android_graphics_GskCanvas.h"
@ -13,6 +10,12 @@
#define STYLE_STROKE 1
#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)
{
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)
{
GdkSnapshot *snapshot = (GdkSnapshot *)_PTR(snapshot_ptr);
GdkRGBA gdk_color = {
(float)((color >> 16) & 0xff) / 0xff,
(float)((color >> 8) & 0xff) / 0xff,
(float)((color >> 0) & 0xff) / 0xff,
(float)((color >> 24) & 0xff) / 0xff,
};
GdkRGBA gdk_color = GDK_RGBA_INIT(color);
graphene_rect_t bounds = GRAPHENE_RECT_INIT(left, top, right - left, bottom - top);
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));
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) {
GdkRGBA gdk_color = GDK_RGBA_INIT(color);
if (style == STYLE_STROKE || style == STYLE_FILL_AND_STROKE) {
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);
}
}
@ -87,37 +82,31 @@ JNIEXPORT void JNICALL Java_android_graphics_GskCanvas_native_1restore(JNIEnv *e
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)) {
return;
}
GdkSnapshot *snapshot = GTK_SNAPSHOT(_PTR(snapshot_ptr));
sk_paint_t *paint = (sk_paint_t *)_PTR(paint_ptr);
GdkRGBA gdk_color;
sk_paint_get_color4f(paint, (sk_color4f_t *)&gdk_color);
float width = sk_paint_get_stroke_width(paint);
GdkRGBA gdk_color = GDK_RGBA_INIT(color);
gtk_snapshot_save(snapshot);
gtk_snapshot_translate(snapshot, &GRAPHENE_POINT_INIT(x0, y0));
float rotation = atan2(y1 - y0, x1 - x0);
gtk_snapshot_rotate(snapshot, rotation * 180 / M_PI);
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);
}
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));
sk_paint_t *paint = (sk_paint_t *)_PTR(paint_ptr);
sk_font_t *font = (sk_font_t *)_PTR(font_ptr);
GdkRGBA gdk_color;
sk_paint_get_color4f(paint, (sk_color4f_t *)&gdk_color);
GdkRGBA gdk_color = GDK_RGBA_INIT(color);
PangoLayout *layout = pango_layout_new(gtk_widget_get_pango_context(window));
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);
const char *str = (*env)->GetStringUTFChars(env, text, NULL);
pango_layout_set_text(layout, str, -1);

View file

@ -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 */
}

View file

@ -52,7 +52,7 @@ public class GskCanvas extends Canvas {
@Override
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
@ -69,12 +69,12 @@ public class GskCanvas extends Canvas {
@Override
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
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
@ -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_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_rotate(long snapshot, float degrees);
protected native void native_save(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_drawText(long snapshot, String text, float x, float y, long paint, long font);
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, 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_scale(long snapshot, float sx, float sy);
}

View file

@ -17,13 +17,14 @@ public class Paint {
public static final int AUTO_HINTING_TEXT_FLAG = (1 << 11);
public static final int VERTICAL_TEXT_FLAG = (1 << 12);
public long skia_paint = 0;
private Typeface typeface = null;
public long skia_font = 0;
ColorFilter colorFilter = null;
private int color = 0;
private float strokeWidth = 0;
private float textSize = 7;
private Style style = Style.FILL;
public Paint() {
skia_paint = native_constructor();
}
public Paint (int flags) {
@ -38,34 +39,25 @@ public class Paint {
}
public void setColor(int color) {
native_set_color(skia_paint, color);
this.color = color;
}
public int getColor() {
return native_get_color(skia_paint);
return color;
}
public void setAntiAlias(boolean aa) {
native_set_antialias(skia_paint, aa);
}
public void setStrokeWidth(float width) {
native_set_stroke_width(skia_paint, width);
this.strokeWidth = width;
}
public void setTextSize(float size) {
if(skia_font == 0)
skia_font = native_create_font();
native_set_text_size(skia_font, size);
this.textSize = size;
}
public Typeface setTypeface(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;
}
public void getTextBounds(String text, int start, int end, Rect bounds) {}
@ -82,20 +74,16 @@ public class Paint {
}
public void setStyle(Style style) {
native_set_style(skia_paint, style.nativeInt);
this.style = style;
}
public float ascent() {
if(skia_font == 0)
return 0;
return native_ascent(skia_font);
return 10;
}
public float measureText(char[] text, int index, int count) { return 10; }
public float measureText(String text, int start, int end) {
if (skia_font == 0)
skia_font = native_create_font();
return native_measure_text(skia_font, text, start, end, skia_paint);
return (end-start)*textSize;
}
public float measureText(String text) {
return measureText(text, 0, text.length());
@ -192,7 +180,7 @@ public class Paint {
public /*native*/ int getAlpha() { return 0; }
public /*native*/ void setAlpha(int a) {}
public float getStrokeWidth() {
return native_get_stroke_width(skia_paint);
return strokeWidth;
}
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 Xfermode setXfermode(Xfermode xfermode) {
if (xfermode instanceof PorterDuffXfermode) {
native_set_blendmode(skia_paint, ((PorterDuffXfermode)xfermode).mode.nativeInt);
}
return xfermode;
}
@ -312,21 +297,6 @@ public class Paint {
public float getLetterSpacing() { return 1.0f; }
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);
}

View file

@ -33,7 +33,6 @@ public class Typeface {
public static final int ITALIC = 2;
public static final int BOLD_ITALIC = 3;
public long skia_typeface = 0;
public long native_instance = 0; // directly accessed by androidx
public static Typeface createFromAsset(AssetManager mgr, String path) {
@ -42,7 +41,6 @@ public class Typeface {
public static Typeface create(String family_name, int style) {
Typeface ret = new Typeface();
ret.skia_typeface = native_create(family_name, style);
return ret;
}
@ -54,8 +52,6 @@ public class Typeface {
return DEFAULT;
}
private static native long native_create(CharSequence family_name, int style);
public int getStyle() {
return 0;
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,68 +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_font_DEFINED
#define sk_font_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
// sk_font_t
SK_C_API sk_font_t* sk_font_new(void);
SK_C_API sk_font_t* sk_font_new_with_values(sk_typeface_t* typeface, float size, float scaleX, float skewX);
SK_C_API void sk_font_delete(sk_font_t* font);
SK_C_API bool sk_font_is_force_auto_hinting(const sk_font_t* font);
SK_C_API void sk_font_set_force_auto_hinting(sk_font_t* font, bool value);
SK_C_API bool sk_font_is_embedded_bitmaps(const sk_font_t* font);
SK_C_API void sk_font_set_embedded_bitmaps(sk_font_t* font, bool value);
SK_C_API bool sk_font_is_subpixel(const sk_font_t* font);
SK_C_API void sk_font_set_subpixel(sk_font_t* font, bool value);
SK_C_API bool sk_font_is_linear_metrics(const sk_font_t* font);
SK_C_API void sk_font_set_linear_metrics(sk_font_t* font, bool value);
SK_C_API bool sk_font_is_embolden(const sk_font_t* font);
SK_C_API void sk_font_set_embolden(sk_font_t* font, bool value);
SK_C_API bool sk_font_is_baseline_snap(const sk_font_t* font);
SK_C_API void sk_font_set_baseline_snap(sk_font_t* font, bool value);
SK_C_API sk_font_edging_t sk_font_get_edging(const sk_font_t* font);
SK_C_API void sk_font_set_edging(sk_font_t* font, sk_font_edging_t value);
SK_C_API sk_font_hinting_t sk_font_get_hinting(const sk_font_t* font);
SK_C_API void sk_font_set_hinting(sk_font_t* font, sk_font_hinting_t value);
SK_C_API sk_typeface_t* sk_font_get_typeface(const sk_font_t* font);
SK_C_API void sk_font_set_typeface(sk_font_t* font, sk_typeface_t* value);
SK_C_API float sk_font_get_size(const sk_font_t* font);
SK_C_API void sk_font_set_size(sk_font_t* font, float value);
SK_C_API float sk_font_get_scale_x(const sk_font_t* font);
SK_C_API void sk_font_set_scale_x(sk_font_t* font, float value);
SK_C_API float sk_font_get_skew_x(const sk_font_t* font);
SK_C_API void sk_font_set_skew_x(sk_font_t* font, float value);
SK_C_API int sk_font_text_to_glyphs(const sk_font_t* font, const void* text, size_t byteLength, sk_text_encoding_t encoding, uint16_t glyphs[], int maxGlyphCount);
SK_C_API uint16_t sk_font_unichar_to_glyph(const sk_font_t* font, int32_t uni);
SK_C_API void sk_font_unichars_to_glyphs(const sk_font_t* font, const int32_t uni[], int count, uint16_t glyphs[]);
SK_C_API float sk_font_measure_text(const sk_font_t* font, const void* text, size_t byteLength, sk_text_encoding_t encoding, sk_rect_t* bounds, const sk_paint_t* paint);
// NOTE: it appears that .NET Framework 4.7 has an issue with returning float?
// https://github.com/mono/SkiaSharp/issues/1409
SK_C_API void sk_font_measure_text_no_return(const sk_font_t* font, const void* text, size_t byteLength, sk_text_encoding_t encoding, sk_rect_t* bounds, const sk_paint_t* paint, float* measuredWidth);
SK_C_API size_t sk_font_break_text(const sk_font_t* font, const void* text, size_t byteLength, sk_text_encoding_t encoding, float maxWidth, float* measuredWidth, const sk_paint_t* paint);
SK_C_API void sk_font_get_widths_bounds(const sk_font_t* font, const uint16_t glyphs[], int count, float widths[], sk_rect_t bounds[], const sk_paint_t* paint);
SK_C_API void sk_font_get_pos(const sk_font_t* font, const uint16_t glyphs[], int count, sk_point_t pos[], sk_point_t* origin);
SK_C_API void sk_font_get_xpos(const sk_font_t* font, const uint16_t glyphs[], int count, float xpos[], float origin);
SK_C_API bool sk_font_get_path(const sk_font_t* font, uint16_t glyph, sk_path_t* path);
SK_C_API void sk_font_get_paths(const sk_font_t* font, uint16_t glyphs[], int count, const sk_glyph_path_proc glyphPathProc, void* context);
SK_C_API float sk_font_get_metrics(const sk_font_t* font, sk_fontmetrics_t* metrics);
// sk_text_utils
SK_C_API void sk_text_utils_get_path(const void* text, size_t length, sk_text_encoding_t encoding, float x, float y, const sk_font_t* font, sk_path_t* path);
SK_C_API void sk_text_utils_get_pos_path(const void* text, size_t length, sk_text_encoding_t encoding, const sk_point_t pos[], const sk_font_t* font, sk_path_t* path);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,39 +0,0 @@
/*
* Copyright 2019 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_general_DEFINED
#define sk_general_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
// ref counting
SK_C_API bool sk_refcnt_unique(const sk_refcnt_t* refcnt);
SK_C_API int sk_refcnt_get_ref_count(const sk_refcnt_t* refcnt);
SK_C_API void sk_refcnt_safe_ref(sk_refcnt_t* refcnt);
SK_C_API void sk_refcnt_safe_unref(sk_refcnt_t* refcnt);
SK_C_API bool sk_nvrefcnt_unique(const sk_nvrefcnt_t* refcnt);
SK_C_API int sk_nvrefcnt_get_ref_count(const sk_nvrefcnt_t* refcnt);
SK_C_API void sk_nvrefcnt_safe_ref(sk_nvrefcnt_t* refcnt);
SK_C_API void sk_nvrefcnt_safe_unref(sk_nvrefcnt_t* refcnt);
// color type
SK_C_API sk_colortype_t sk_colortype_get_default_8888(void);
// library information
SK_C_API int sk_version_get_milestone(void);
SK_C_API int sk_version_get_increment(void);
SK_C_API const char* sk_version_get_string(void);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,45 +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_graphics_DEFINED
#define sk_graphics_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API void sk_graphics_init(void);
// purge
SK_C_API void sk_graphics_purge_font_cache(void);
SK_C_API void sk_graphics_purge_resource_cache(void);
SK_C_API void sk_graphics_purge_all_caches(void);
// font cache
SK_C_API size_t sk_graphics_get_font_cache_used(void);
SK_C_API size_t sk_graphics_get_font_cache_limit(void);
SK_C_API size_t sk_graphics_set_font_cache_limit(size_t bytes);
SK_C_API int sk_graphics_get_font_cache_count_used(void);
SK_C_API int sk_graphics_get_font_cache_count_limit(void);
SK_C_API int sk_graphics_set_font_cache_count_limit(int count);
// resource cache
SK_C_API size_t sk_graphics_get_resource_cache_total_bytes_used(void);
SK_C_API size_t sk_graphics_get_resource_cache_total_byte_limit(void);
SK_C_API size_t sk_graphics_set_resource_cache_total_byte_limit(size_t newLimit);
SK_C_API size_t sk_graphics_get_resource_cache_single_allocation_byte_limit(void);
SK_C_API size_t sk_graphics_set_resource_cache_single_allocation_byte_limit(size_t newLimit);
// dump
SK_C_API void sk_graphics_dump_memory_statistics(sk_tracememorydump_t* dump);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,56 +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_image_DEFINED
#define sk_image_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API void sk_image_ref(const sk_image_t* cimage);
SK_C_API void sk_image_unref(const sk_image_t* cimage);
SK_C_API sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t* cinfo, const void* pixels, size_t rowBytes);
SK_C_API sk_image_t* sk_image_new_raster_copy_with_pixmap(const sk_pixmap_t* pixmap);
SK_C_API sk_image_t* sk_image_new_raster_data(const sk_imageinfo_t* cinfo, sk_data_t* pixels, size_t rowBytes);
SK_C_API sk_image_t* sk_image_new_raster(const sk_pixmap_t* pixmap, sk_image_raster_release_proc releaseProc, void* context);
SK_C_API sk_image_t* sk_image_new_from_bitmap(const sk_bitmap_t* cbitmap);
SK_C_API sk_image_t* sk_image_new_from_encoded(const sk_data_t* cdata);
SK_C_API sk_image_t* sk_image_new_from_texture(gr_recording_context_t* context, const gr_backendtexture_t* texture, gr_surfaceorigin_t origin, sk_colortype_t colorType, sk_alphatype_t alpha, const sk_colorspace_t* colorSpace, const sk_image_texture_release_proc releaseProc, void* releaseContext);
SK_C_API sk_image_t* sk_image_new_from_adopted_texture(gr_recording_context_t* context, const gr_backendtexture_t* texture, gr_surfaceorigin_t origin, sk_colortype_t colorType, sk_alphatype_t alpha, const sk_colorspace_t* colorSpace);
SK_C_API sk_image_t* sk_image_new_from_picture(sk_picture_t* picture, const sk_isize_t* dimensions, const sk_matrix_t* cmatrix, const sk_paint_t* paint, bool useFloatingPointBitDepth, const sk_colorspace_t* colorSpace, const sk_surfaceprops_t* props);
SK_C_API int sk_image_get_width(const sk_image_t* cimage);
SK_C_API int sk_image_get_height(const sk_image_t* cimage);
SK_C_API uint32_t sk_image_get_unique_id(const sk_image_t* cimage);
SK_C_API sk_alphatype_t sk_image_get_alpha_type(const sk_image_t* image);
SK_C_API sk_colortype_t sk_image_get_color_type(const sk_image_t* image);
SK_C_API sk_colorspace_t* sk_image_get_colorspace(const sk_image_t* image);
SK_C_API bool sk_image_is_alpha_only(const sk_image_t* image);
SK_C_API sk_shader_t* sk_image_make_shader(const sk_image_t* image, sk_shader_tilemode_t tileX, sk_shader_tilemode_t tileY, const sk_matrix_t* cmatrix);
SK_C_API sk_shader_t* sk_image_make_shader_v2(const sk_image_t* image, sk_shader_tilemode_t tileX, sk_shader_tilemode_t tileY, const sk_sampling_options_t* sampling, const sk_matrix_t* cmatrix);
SK_C_API bool sk_image_peek_pixels(const sk_image_t* image, sk_pixmap_t* pixmap);
SK_C_API bool sk_image_is_texture_backed(const sk_image_t* image);
SK_C_API bool sk_image_is_lazy_generated(const sk_image_t* image);
SK_C_API bool sk_image_is_valid(const sk_image_t* image, gr_recording_context_t* context);
SK_C_API bool sk_image_read_pixels(const sk_image_t* image, const sk_imageinfo_t* dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY, sk_image_caching_hint_t cachingHint);
SK_C_API bool sk_image_read_pixels_into_pixmap(const sk_image_t* image, const sk_pixmap_t* dst, int srcX, int srcY, sk_image_caching_hint_t cachingHint);
SK_C_API bool sk_image_scale_pixels(const sk_image_t* image, const sk_pixmap_t* dst, sk_image_caching_hint_t cachingHint);
SK_C_API bool sk_image_scale_pixels_v2(const sk_image_t* image, const sk_pixmap_t* dst, const sk_sampling_options_t* sampling, sk_image_caching_hint_t cachingHint);
SK_C_API sk_data_t* sk_image_ref_encoded(const sk_image_t* cimage);
SK_C_API sk_image_t* sk_image_make_subset_raster(const sk_image_t* cimage, const sk_irect_t* subset);
SK_C_API sk_image_t* sk_image_make_subset(const sk_image_t* cimage, gr_direct_context_t* context, const sk_irect_t* subset);
SK_C_API sk_image_t* sk_image_make_texture_image(const sk_image_t* cimage, gr_direct_context_t* context, bool mipmapped, bool budgeted);
SK_C_API sk_image_t* sk_image_make_non_texture_image(const sk_image_t* cimage);
SK_C_API sk_image_t* sk_image_make_raster_image(const sk_image_t* cimage);
SK_C_API sk_image_t* sk_image_make_with_filter_raster(const sk_image_t* cimage, const sk_imagefilter_t* filter, const sk_irect_t* subset, const sk_irect_t* clipBounds, sk_irect_t* outSubset, sk_ipoint_t* outOffset);
SK_C_API sk_image_t* sk_image_make_with_filter(const sk_image_t* cimage, gr_recording_context_t* context, const sk_imagefilter_t* filter, const sk_irect_t* subset, const sk_irect_t* clipBounds, sk_irect_t* outSubset, sk_ipoint_t* outOffset);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,54 +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_imagefilter_DEFINED
#define sk_imagefilter_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
// sk_imagefilter_t
SK_C_API void sk_imagefilter_unref(sk_imagefilter_t* cfilter);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_alpha_threshold(const sk_region_t* region, float innerThreshold, float outerThreshold, const sk_imagefilter_t* input);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_arithmetic(float k1, float k2, float k3, float k4, bool enforcePMColor, const sk_imagefilter_t* background, const sk_imagefilter_t* foreground, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_blend(sk_blendmode_t mode, const sk_imagefilter_t* background, const sk_imagefilter_t* foreground, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_blur(float sigmaX, float sigmaY, sk_shader_tilemode_t tileMode, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_color_filter(sk_colorfilter_t* cf, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_compose(const sk_imagefilter_t* outer, const sk_imagefilter_t* inner);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_displacement_map_effect(sk_color_channel_t xChannelSelector, sk_color_channel_t yChannelSelector, float scale, const sk_imagefilter_t* displacement, const sk_imagefilter_t* color, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_drop_shadow(float dx, float dy, float sigmaX, float sigmaY, sk_color_t color, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_drop_shadow_only(float dx, float dy, float sigmaX, float sigmaY, sk_color_t color, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_image(sk_image_t* image, const sk_rect_t* srcRect, const sk_rect_t* dstRect, const sk_sampling_options_t* sampling);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_image_simple(sk_image_t* image, const sk_sampling_options_t* sampling);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_magnifier(const sk_rect_t* lensBounds, float zoomAmount, float inset, const sk_sampling_options_t* sampling, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_matrix_convolution(const sk_isize_t* kernelSize, const float kernel[], float gain, float bias, const sk_ipoint_t* kernelOffset, sk_shader_tilemode_t ctileMode, bool convolveAlpha, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_matrix_transform(const sk_matrix_t* cmatrix, const sk_sampling_options_t* sampling, const sk_imagefilter_t* input);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_merge(const sk_imagefilter_t* cfilters[], int count, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_merge_simple(const sk_imagefilter_t* first, const sk_imagefilter_t* second, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_offset(float dx, float dy, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_picture(const sk_picture_t* picture);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_picture_with_rect(const sk_picture_t* picture, const sk_rect_t* targetRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_shader(const sk_shader_t* shader, bool dither, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_tile(const sk_rect_t* src, const sk_rect_t* dst, const sk_imagefilter_t* input);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_dilate(float radiusX, float radiusY, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_erode(float radiusX, float radiusY, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_distant_lit_diffuse(const sk_point3_t* direction, sk_color_t lightColor, float surfaceScale, float kd, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_point_lit_diffuse(const sk_point3_t* location, sk_color_t lightColor, float surfaceScale, float kd, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_spot_lit_diffuse(const sk_point3_t* location, const sk_point3_t* target, float specularExponent, float cutoffAngle, sk_color_t lightColor, float surfaceScale, float kd, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_distant_lit_specular(const sk_point3_t* direction, sk_color_t lightColor, float surfaceScale, float ks, float shininess, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_point_lit_specular(const sk_point3_t* location, sk_color_t lightColor, float surfaceScale, float ks, float shininess, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_API sk_imagefilter_t* sk_imagefilter_new_spot_lit_specular(const sk_point3_t* location, const sk_point3_t* target, float specularExponent, float cutoffAngle, sk_color_t lightColor, float surfaceScale, float ks, float shininess, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,28 +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_maskfilter_DEFINED
#define sk_maskfilter_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API void sk_maskfilter_ref(sk_maskfilter_t*);
SK_C_API void sk_maskfilter_unref(sk_maskfilter_t*);
SK_C_API sk_maskfilter_t* sk_maskfilter_new_blur(sk_blurstyle_t, float sigma);
SK_C_API sk_maskfilter_t* sk_maskfilter_new_blur_with_flags(sk_blurstyle_t, float sigma, bool respectCTM);
SK_C_API sk_maskfilter_t* sk_maskfilter_new_table(const uint8_t table[256]);
SK_C_API sk_maskfilter_t* sk_maskfilter_new_gamma(float gamma);
SK_C_API sk_maskfilter_t* sk_maskfilter_new_clip(uint8_t min, uint8_t max);
SK_C_API sk_maskfilter_t* sk_maskfilter_new_shader(sk_shader_t* cshader);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,30 +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_matrix_DEFINED
#define sk_matrix_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API bool sk_matrix_try_invert (sk_matrix_t *matrix, sk_matrix_t *result);
SK_C_API void sk_matrix_concat (sk_matrix_t *result, sk_matrix_t *first, sk_matrix_t *second);
SK_C_API void sk_matrix_pre_concat (sk_matrix_t *result, sk_matrix_t *matrix);
SK_C_API void sk_matrix_post_concat (sk_matrix_t *result, sk_matrix_t *matrix);
SK_C_API void sk_matrix_map_rect (sk_matrix_t *matrix, sk_rect_t *dest, sk_rect_t *source);
SK_C_API void sk_matrix_map_points (sk_matrix_t *matrix, sk_point_t *dst, sk_point_t *src, int count);
SK_C_API void sk_matrix_map_vectors (sk_matrix_t *matrix, sk_point_t *dst, sk_point_t *src, int count);
SK_C_API void sk_matrix_map_xy (sk_matrix_t *matrix, float x, float y, sk_point_t* result);
SK_C_API void sk_matrix_map_vector (sk_matrix_t *matrix, float x, float y, sk_point_t* result);
SK_C_API float sk_matrix_map_radius (sk_matrix_t *matrix, float radius);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,55 +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_paint_DEFINED
#define sk_paint_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API sk_paint_t* sk_paint_new(void);
SK_C_API sk_paint_t* sk_paint_clone(sk_paint_t*);
SK_C_API void sk_paint_delete(sk_paint_t*);
SK_C_API void sk_paint_reset(sk_paint_t*);
SK_C_API bool sk_paint_is_antialias(const sk_paint_t*);
SK_C_API void sk_paint_set_antialias(sk_paint_t*, bool);
SK_C_API sk_color_t sk_paint_get_color(const sk_paint_t*);
SK_C_API void sk_paint_get_color4f(const sk_paint_t* paint, sk_color4f_t* color);
SK_C_API void sk_paint_set_color(sk_paint_t*, sk_color_t);
SK_C_API void sk_paint_set_color4f(sk_paint_t* paint, sk_color4f_t* color, sk_colorspace_t* colorspace);
SK_C_API sk_paint_style_t sk_paint_get_style(const sk_paint_t*);
SK_C_API void sk_paint_set_style(sk_paint_t*, sk_paint_style_t);
SK_C_API float sk_paint_get_stroke_width(const sk_paint_t*);
SK_C_API void sk_paint_set_stroke_width(sk_paint_t*, float width);
SK_C_API float sk_paint_get_stroke_miter(const sk_paint_t*);
SK_C_API void sk_paint_set_stroke_miter(sk_paint_t*, float miter);
SK_C_API sk_stroke_cap_t sk_paint_get_stroke_cap(const sk_paint_t*);
SK_C_API void sk_paint_set_stroke_cap(sk_paint_t*, sk_stroke_cap_t);
SK_C_API sk_stroke_join_t sk_paint_get_stroke_join(const sk_paint_t*);
SK_C_API void sk_paint_set_stroke_join(sk_paint_t*, sk_stroke_join_t);
SK_C_API void sk_paint_set_shader(sk_paint_t*, sk_shader_t*);
SK_C_API void sk_paint_set_maskfilter(sk_paint_t*, sk_maskfilter_t*);
SK_C_API void sk_paint_set_blendmode(sk_paint_t*, sk_blendmode_t);
SK_C_API bool sk_paint_is_dither(const sk_paint_t*);
SK_C_API void sk_paint_set_dither(sk_paint_t*, bool);
SK_C_API sk_shader_t* sk_paint_get_shader(sk_paint_t*);
SK_C_API sk_maskfilter_t* sk_paint_get_maskfilter(sk_paint_t*);
SK_C_API void sk_paint_set_colorfilter(sk_paint_t*, sk_colorfilter_t*);
SK_C_API sk_colorfilter_t* sk_paint_get_colorfilter(sk_paint_t*);
SK_C_API void sk_paint_set_imagefilter(sk_paint_t*, sk_imagefilter_t*);
SK_C_API sk_imagefilter_t* sk_paint_get_imagefilter(sk_paint_t*);
SK_C_API sk_blendmode_t sk_paint_get_blendmode(sk_paint_t*);
SK_C_API sk_path_effect_t* sk_paint_get_path_effect(sk_paint_t* cpaint);
SK_C_API void sk_paint_set_path_effect(sk_paint_t* cpaint, sk_path_effect_t* effect);
SK_C_API bool sk_paint_get_fill_path(const sk_paint_t* cpaint, const sk_path_t* src, sk_path_t* dst, const sk_rect_t* cullRect, const sk_matrix_t* cmatrix);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,114 +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_path_DEFINED
#define sk_path_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
/* Path */
SK_C_API sk_path_t* sk_path_new(void);
SK_C_API void sk_path_delete(sk_path_t*);
SK_C_API void sk_path_move_to(sk_path_t*, float x, float y);
SK_C_API void sk_path_line_to(sk_path_t*, float x, float y);
SK_C_API void sk_path_quad_to(sk_path_t*, float x0, float y0, float x1, float y1);
SK_C_API void sk_path_conic_to(sk_path_t*, float x0, float y0, float x1, float y1, float w);
SK_C_API void sk_path_cubic_to(sk_path_t*, float x0, float y0, float x1, float y1, float x2, float y2);
SK_C_API void sk_path_arc_to(sk_path_t*, float rx, float ry, float xAxisRotate, sk_path_arc_size_t largeArc, sk_path_direction_t sweep, float x, float y);
SK_C_API void sk_path_rarc_to(sk_path_t*, float rx, float ry, float xAxisRotate, sk_path_arc_size_t largeArc, sk_path_direction_t sweep, float x, float y);
SK_C_API void sk_path_arc_to_with_oval(sk_path_t*, const sk_rect_t* oval, float startAngle, float sweepAngle, bool forceMoveTo);
SK_C_API void sk_path_arc_to_with_points(sk_path_t*, float x1, float y1, float x2, float y2, float radius);
SK_C_API void sk_path_close(sk_path_t*);
SK_C_API void sk_path_add_rect(sk_path_t*, const sk_rect_t*, sk_path_direction_t);
SK_C_API void sk_path_add_rrect(sk_path_t*, const sk_rrect_t*, sk_path_direction_t);
SK_C_API void sk_path_add_rrect_start(sk_path_t*, const sk_rrect_t*, sk_path_direction_t, uint32_t);
SK_C_API void sk_path_add_rounded_rect(sk_path_t*, const sk_rect_t*, float, float, sk_path_direction_t);
SK_C_API void sk_path_add_oval(sk_path_t*, const sk_rect_t*, sk_path_direction_t);
SK_C_API void sk_path_add_circle(sk_path_t*, float x, float y, float radius, sk_path_direction_t dir);
SK_C_API void sk_path_get_bounds(const sk_path_t*, sk_rect_t*);
SK_C_API void sk_path_compute_tight_bounds(const sk_path_t*, sk_rect_t*);
SK_C_API void sk_path_rmove_to(sk_path_t*, float dx, float dy);
SK_C_API void sk_path_rline_to(sk_path_t*, float dx, float yd);
SK_C_API void sk_path_rquad_to(sk_path_t*, float dx0, float dy0, float dx1, float dy1);
SK_C_API void sk_path_rconic_to(sk_path_t*, float dx0, float dy0, float dx1, float dy1, float w);
SK_C_API void sk_path_rcubic_to(sk_path_t*, float dx0, float dy0, float dx1, float dy1, float dx2, float dy2);
SK_C_API void sk_path_add_rect_start(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir, uint32_t startIndex);
SK_C_API void sk_path_add_arc(sk_path_t* cpath, const sk_rect_t* crect, float startAngle, float sweepAngle);
SK_C_API sk_path_filltype_t sk_path_get_filltype(sk_path_t*);
SK_C_API void sk_path_set_filltype(sk_path_t*, sk_path_filltype_t);
SK_C_API void sk_path_transform(sk_path_t* cpath, const sk_matrix_t* cmatrix);
SK_C_API void sk_path_transform_to_dest(const sk_path_t* cpath, const sk_matrix_t* cmatrix, sk_path_t* destination);
SK_C_API sk_path_t* sk_path_clone(const sk_path_t* cpath);
SK_C_API void sk_path_add_path_offset (sk_path_t* cpath, sk_path_t* other, float dx, float dy, sk_path_add_mode_t add_mode);
SK_C_API void sk_path_add_path_matrix (sk_path_t* cpath, sk_path_t* other, sk_matrix_t *matrix, sk_path_add_mode_t add_mode);
SK_C_API void sk_path_add_path (sk_path_t* cpath, sk_path_t* other, sk_path_add_mode_t add_mode);
SK_C_API void sk_path_add_path_reverse (sk_path_t* cpath, sk_path_t* other);
SK_C_API void sk_path_reset (sk_path_t* cpath);
SK_C_API void sk_path_rewind (sk_path_t* cpath);
SK_C_API int sk_path_count_points (const sk_path_t* cpath);
SK_C_API int sk_path_count_verbs (const sk_path_t* cpath);
SK_C_API void sk_path_get_point (const sk_path_t* cpath, int index, sk_point_t* point);
SK_C_API int sk_path_get_points (const sk_path_t* cpath, sk_point_t* points, int max);
SK_C_API bool sk_path_contains (const sk_path_t* cpath, float x, float y);
SK_C_API bool sk_path_parse_svg_string (sk_path_t* cpath, const char* str);
SK_C_API void sk_path_to_svg_string (const sk_path_t* cpath, sk_string_t* str);
SK_C_API bool sk_path_get_last_point (const sk_path_t* cpath, sk_point_t* point);
SK_C_API int sk_path_convert_conic_to_quads(const sk_point_t* p0, const sk_point_t* p1, const sk_point_t* p2, float w, sk_point_t* pts, int pow2);
SK_C_API void sk_path_add_poly(sk_path_t* cpath, const sk_point_t* points, int count, bool close);
SK_C_API uint32_t sk_path_get_segment_masks(sk_path_t* cpath);
SK_C_API bool sk_path_is_oval(sk_path_t* cpath, sk_rect_t* bounds);
SK_C_API bool sk_path_is_rrect(sk_path_t* cpath, sk_rrect_t* bounds);
SK_C_API bool sk_path_is_line(sk_path_t* cpath, sk_point_t line [2]);
SK_C_API bool sk_path_is_rect(sk_path_t* cpath, sk_rect_t* rect, bool* isClosed, sk_path_direction_t* direction);
SK_C_API bool sk_path_is_convex(const sk_path_t* cpath);
/* Iterators */
SK_C_API sk_path_iterator_t* sk_path_create_iter (sk_path_t *cpath, int forceClose);
SK_C_API sk_path_verb_t sk_path_iter_next (sk_path_iterator_t *iterator, sk_point_t points [4]);
SK_C_API float sk_path_iter_conic_weight (sk_path_iterator_t *iterator);
SK_C_API int sk_path_iter_is_close_line (sk_path_iterator_t *iterator);
SK_C_API int sk_path_iter_is_closed_contour (sk_path_iterator_t *iterator);
SK_C_API void sk_path_iter_destroy (sk_path_iterator_t *iterator);
/* Raw iterators */
SK_C_API sk_path_rawiterator_t* sk_path_create_rawiter (sk_path_t *cpath);
SK_C_API sk_path_verb_t sk_path_rawiter_peek (sk_path_rawiterator_t *iterator);
SK_C_API sk_path_verb_t sk_path_rawiter_next (sk_path_rawiterator_t *iterator, sk_point_t points [4]);
SK_C_API float sk_path_rawiter_conic_weight (sk_path_rawiterator_t *iterator);
SK_C_API void sk_path_rawiter_destroy (sk_path_rawiterator_t *iterator);
/* Path Ops */
SK_C_API bool sk_pathop_op(const sk_path_t* one, const sk_path_t* two, sk_pathop_t op, sk_path_t* result);
SK_C_API bool sk_pathop_simplify(const sk_path_t* path, sk_path_t* result);
SK_C_API bool sk_pathop_tight_bounds(const sk_path_t* path, sk_rect_t* result);
SK_C_API bool sk_pathop_as_winding(const sk_path_t* path, sk_path_t* result);
/* Path Op Builder */
SK_C_API sk_opbuilder_t* sk_opbuilder_new(void);
SK_C_API void sk_opbuilder_destroy(sk_opbuilder_t* builder);
SK_C_API void sk_opbuilder_add(sk_opbuilder_t* builder, const sk_path_t* path, sk_pathop_t op);
SK_C_API bool sk_opbuilder_resolve(sk_opbuilder_t* builder, sk_path_t* result);
/* Path Measure */
SK_C_API sk_pathmeasure_t* sk_pathmeasure_new(void);
SK_C_API sk_pathmeasure_t* sk_pathmeasure_new_with_path(const sk_path_t* path, bool forceClosed, float resScale);
SK_C_API void sk_pathmeasure_destroy(sk_pathmeasure_t* pathMeasure);
SK_C_API void sk_pathmeasure_set_path(sk_pathmeasure_t* pathMeasure, const sk_path_t* path, bool forceClosed);
SK_C_API float sk_pathmeasure_get_length(sk_pathmeasure_t* pathMeasure);
SK_C_API bool sk_pathmeasure_get_pos_tan(sk_pathmeasure_t* pathMeasure, float distance, sk_point_t* position, sk_vector_t* tangent);
SK_C_API bool sk_pathmeasure_get_matrix(sk_pathmeasure_t* pathMeasure, float distance, sk_matrix_t* matrix, sk_pathmeasure_matrixflags_t flags);
SK_C_API bool sk_pathmeasure_get_segment(sk_pathmeasure_t* pathMeasure, float start, float stop, sk_path_t* dst, bool startWithMoveTo);
SK_C_API bool sk_pathmeasure_is_closed(sk_pathmeasure_t* pathMeasure);
SK_C_API bool sk_pathmeasure_next_contour(sk_pathmeasure_t* pathMeasure);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,30 +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_patheffect_DEFINED
#define sk_patheffect_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API void sk_path_effect_unref(sk_path_effect_t* t);
SK_C_API sk_path_effect_t* sk_path_effect_create_compose(sk_path_effect_t* outer, sk_path_effect_t* inner);
SK_C_API sk_path_effect_t* sk_path_effect_create_sum(sk_path_effect_t* first, sk_path_effect_t* second);
SK_C_API sk_path_effect_t* sk_path_effect_create_discrete(float segLength, float deviation, uint32_t seedAssist /*0*/);
SK_C_API sk_path_effect_t* sk_path_effect_create_corner(float radius);
SK_C_API sk_path_effect_t* sk_path_effect_create_1d_path(const sk_path_t* path, float advance, float phase, sk_path_effect_1d_style_t style);
SK_C_API sk_path_effect_t* sk_path_effect_create_2d_line(float width, const sk_matrix_t* matrix);
SK_C_API sk_path_effect_t* sk_path_effect_create_2d_path(const sk_matrix_t* matrix, const sk_path_t* path);
SK_C_API sk_path_effect_t* sk_path_effect_create_dash(const float intervals[], int count, float phase);
SK_C_API sk_path_effect_t* sk_path_effect_create_trim(float start, float stop, sk_path_effect_trim_mode_t mode);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,37 +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_picture_DEFINED
#define sk_picture_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API sk_picture_recorder_t* sk_picture_recorder_new(void);
SK_C_API void sk_picture_recorder_delete(sk_picture_recorder_t*);
SK_C_API sk_canvas_t* sk_picture_recorder_begin_recording(sk_picture_recorder_t*, const sk_rect_t*);
SK_C_API sk_picture_t* sk_picture_recorder_end_recording(sk_picture_recorder_t*);
SK_C_API sk_drawable_t* sk_picture_recorder_end_recording_as_drawable(sk_picture_recorder_t*);
SK_C_API sk_canvas_t* sk_picture_get_recording_canvas(sk_picture_recorder_t* crec);
SK_C_API void sk_picture_ref(sk_picture_t*);
SK_C_API void sk_picture_unref(sk_picture_t*);
SK_C_API uint32_t sk_picture_get_unique_id(sk_picture_t*);
SK_C_API void sk_picture_get_cull_rect(sk_picture_t*, sk_rect_t*);
SK_C_API sk_shader_t* sk_picture_make_shader(sk_picture_t* src, sk_shader_tilemode_t tmx, sk_shader_tilemode_t tmy, sk_filter_mode_t mode, const sk_matrix_t* localMatrix, const sk_rect_t* tile);
SK_C_API sk_data_t* sk_picture_serialize_to_data(const sk_picture_t* picture);
SK_C_API void sk_picture_serialize_to_stream(const sk_picture_t* picture, sk_wstream_t* stream);
SK_C_API sk_picture_t* sk_picture_deserialize_from_stream(sk_stream_t* stream);
SK_C_API sk_picture_t* sk_picture_deserialize_from_data(sk_data_t* data);
SK_C_API sk_picture_t* sk_picture_deserialize_from_memory(void* buffer, size_t length);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,60 +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_pixmap_DEFINED
#define sk_pixmap_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
// SkPixmap
SK_C_API void sk_pixmap_destructor(sk_pixmap_t* cpixmap);
SK_C_API sk_pixmap_t* sk_pixmap_new(void);
SK_C_API sk_pixmap_t* sk_pixmap_new_with_params(const sk_imageinfo_t* cinfo, const void* addr, size_t rowBytes);
SK_C_API void sk_pixmap_reset(sk_pixmap_t* cpixmap);
SK_C_API void sk_pixmap_reset_with_params(sk_pixmap_t* cpixmap, const sk_imageinfo_t* cinfo, const void* addr, size_t rowBytes);
SK_C_API void sk_pixmap_set_colorspace(sk_pixmap_t* cpixmap, sk_colorspace_t* colorspace);
SK_C_API bool sk_pixmap_extract_subset(const sk_pixmap_t* cpixmap, sk_pixmap_t* result, const sk_irect_t* subset);
SK_C_API void sk_pixmap_get_info(const sk_pixmap_t* cpixmap, sk_imageinfo_t* cinfo);
SK_C_API size_t sk_pixmap_get_row_bytes(const sk_pixmap_t* cpixmap);
SK_C_API sk_colorspace_t* sk_pixmap_get_colorspace(const sk_pixmap_t* cpixmap);
SK_C_API bool sk_pixmap_compute_is_opaque(const sk_pixmap_t* cpixmap);
SK_C_API sk_color_t sk_pixmap_get_pixel_color(const sk_pixmap_t* cpixmap, int x, int y);
SK_C_API void sk_pixmap_get_pixel_color4f(const sk_pixmap_t* cpixmap, int x, int y, sk_color4f_t* color);
SK_C_API float sk_pixmap_get_pixel_alphaf(const sk_pixmap_t* cpixmap, int x, int y);
SK_C_API void* sk_pixmap_get_writable_addr(const sk_pixmap_t* cpixmap);
SK_C_API void* sk_pixmap_get_writeable_addr_with_xy(const sk_pixmap_t* cpixmap, int x, int y);
SK_C_API bool sk_pixmap_read_pixels(const sk_pixmap_t* cpixmap, const sk_imageinfo_t* dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY);
SK_C_API bool sk_pixmap_scale_pixels(const sk_pixmap_t* cpixmap, const sk_pixmap_t* dst, const sk_sampling_options_t* sampling);
SK_C_API bool sk_pixmap_erase_color(const sk_pixmap_t* cpixmap, sk_color_t color, const sk_irect_t* subset);
SK_C_API bool sk_pixmap_erase_color4f(const sk_pixmap_t* cpixmap, const sk_color4f_t* color, const sk_irect_t* subset);
// Sk*Encoder
SK_C_API bool sk_webpencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, const sk_webpencoder_options_t* options);
SK_C_API bool sk_jpegencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, const sk_jpegencoder_options_t* options);
SK_C_API bool sk_pngencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, const sk_pngencoder_options_t* options);
// SkSwizzle
SK_C_API void sk_swizzle_swap_rb(uint32_t* dest, const uint32_t* src, int count);
// SkColor
SK_C_API sk_color_t sk_color_unpremultiply(const sk_pmcolor_t pmcolor);
SK_C_API sk_pmcolor_t sk_color_premultiply(const sk_color_t color);
SK_C_API void sk_color_unpremultiply_array(const sk_pmcolor_t* pmcolors, int size, sk_color_t* colors);
SK_C_API void sk_color_premultiply_array(const sk_color_t* colors, int size, sk_pmcolor_t* pmcolors);
SK_C_API void sk_color_get_bit_shift(int* a, int* r, int* g, int* b);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,69 +0,0 @@
/*
* Copyright 2014 Google Inc.
* Copyright 2015 Xamarin Inc.
* Copyright 2016 Bluebeam 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_region_DEFINED
#define sk_region_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
// sk_region_t
SK_C_API sk_region_t* sk_region_new(void);
SK_C_API void sk_region_delete(sk_region_t* r);
SK_C_API bool sk_region_is_empty(const sk_region_t* r);
SK_C_API bool sk_region_is_rect(const sk_region_t* r);
SK_C_API bool sk_region_is_complex(const sk_region_t* r);
SK_C_API void sk_region_get_bounds(const sk_region_t* r, sk_irect_t* rect);
SK_C_API bool sk_region_get_boundary_path(const sk_region_t* r, sk_path_t* path);
SK_C_API bool sk_region_set_empty(sk_region_t* r);
SK_C_API bool sk_region_set_rect(sk_region_t* r, const sk_irect_t* rect);
SK_C_API bool sk_region_set_rects(sk_region_t* r, const sk_irect_t* rects, int count);
SK_C_API bool sk_region_set_region(sk_region_t* r, const sk_region_t* region);
SK_C_API bool sk_region_set_path(sk_region_t* r, const sk_path_t* t, const sk_region_t* clip);
SK_C_API bool sk_region_intersects_rect(const sk_region_t* r, const sk_irect_t* rect);
SK_C_API bool sk_region_intersects(const sk_region_t* r, const sk_region_t* src);
SK_C_API bool sk_region_contains_point(const sk_region_t* r, int x, int y);
SK_C_API bool sk_region_contains_rect(const sk_region_t* r, const sk_irect_t* rect);
SK_C_API bool sk_region_contains(const sk_region_t* r, const sk_region_t* region);
SK_C_API bool sk_region_quick_contains(const sk_region_t* r, const sk_irect_t* rect);
SK_C_API bool sk_region_quick_reject_rect(const sk_region_t* r, const sk_irect_t* rect);
SK_C_API bool sk_region_quick_reject(const sk_region_t* r, const sk_region_t* region);
SK_C_API void sk_region_translate(sk_region_t* r, int x, int y);
SK_C_API bool sk_region_op_rect(sk_region_t* r, const sk_irect_t* rect, sk_region_op_t op);
SK_C_API bool sk_region_op(sk_region_t* r, const sk_region_t* region, sk_region_op_t op);
// sk_region_iterator_t
SK_C_API sk_region_iterator_t* sk_region_iterator_new(const sk_region_t* region);
SK_C_API void sk_region_iterator_delete(sk_region_iterator_t* iter);
SK_C_API bool sk_region_iterator_rewind(sk_region_iterator_t* iter);
SK_C_API bool sk_region_iterator_done(const sk_region_iterator_t* iter);
SK_C_API void sk_region_iterator_next(sk_region_iterator_t* iter);
SK_C_API void sk_region_iterator_rect(const sk_region_iterator_t* iter, sk_irect_t* rect);
// sk_region_cliperator_t
SK_C_API sk_region_cliperator_t* sk_region_cliperator_new(const sk_region_t* region, const sk_irect_t* clip);
SK_C_API void sk_region_cliperator_delete(sk_region_cliperator_t* iter);
SK_C_API bool sk_region_cliperator_done(sk_region_cliperator_t* iter);
SK_C_API void sk_region_cliperator_next(sk_region_cliperator_t* iter);
SK_C_API void sk_region_cliperator_rect(const sk_region_cliperator_t* iter, sk_irect_t* rect);
// sk_region_spanerator_t
SK_C_API sk_region_spanerator_t* sk_region_spanerator_new(const sk_region_t* region, int y, int left, int right);
SK_C_API void sk_region_spanerator_delete(sk_region_spanerator_t* iter);
SK_C_API bool sk_region_spanerator_next(sk_region_spanerator_t* iter, int* left, int* right);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,40 +0,0 @@
/*
* Copyright 2014 Google Inc.
* Copyright 2016 Xamarin Inc.
* Copyright 2018 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_rrect_DEFINED
#define sk_rrect_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API sk_rrect_t* sk_rrect_new(void);
SK_C_API sk_rrect_t* sk_rrect_new_copy(const sk_rrect_t* rrect);
SK_C_API void sk_rrect_delete(const sk_rrect_t* rrect);
SK_C_API sk_rrect_type_t sk_rrect_get_type(const sk_rrect_t* rrect);
SK_C_API void sk_rrect_get_rect(const sk_rrect_t* rrect, sk_rect_t* rect);
SK_C_API void sk_rrect_get_radii(const sk_rrect_t* rrect, sk_rrect_corner_t corner, sk_vector_t* radii);
SK_C_API float sk_rrect_get_width(const sk_rrect_t* rrect);
SK_C_API float sk_rrect_get_height(const sk_rrect_t* rrect);
SK_C_API void sk_rrect_set_empty(sk_rrect_t* rrect);
SK_C_API void sk_rrect_set_rect(sk_rrect_t* rrect, const sk_rect_t* rect);
SK_C_API void sk_rrect_set_oval(sk_rrect_t* rrect, const sk_rect_t* rect);
SK_C_API void sk_rrect_set_rect_xy(sk_rrect_t* rrect, const sk_rect_t* rect, float xRad, float yRad);
SK_C_API void sk_rrect_set_nine_patch(sk_rrect_t* rrect, const sk_rect_t* rect, float leftRad, float topRad, float rightRad, float bottomRad);
SK_C_API void sk_rrect_set_rect_radii(sk_rrect_t* rrect, const sk_rect_t* rect, const sk_vector_t* radii);
SK_C_API void sk_rrect_inset(sk_rrect_t* rrect, float dx, float dy);
SK_C_API void sk_rrect_outset(sk_rrect_t* rrect, float dx, float dy);
SK_C_API void sk_rrect_offset(sk_rrect_t* rrect, float dx, float dy);
SK_C_API bool sk_rrect_contains(const sk_rrect_t* rrect, const sk_rect_t* rect);
SK_C_API bool sk_rrect_is_valid(const sk_rrect_t* rrect);
SK_C_API bool sk_rrect_transform(sk_rrect_t* rrect, const sk_matrix_t* matrix, sk_rrect_t* dest);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,34 +0,0 @@
/*
* Copyright 2020 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_runtimeeffect_DEFINED
#define sk_runtimeeffect_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API sk_runtimeeffect_t* sk_runtimeeffect_make_for_color_filter(sk_string_t* sksl, sk_string_t* error);
SK_C_API sk_runtimeeffect_t* sk_runtimeeffect_make_for_shader(sk_string_t* sksl, sk_string_t* error);
SK_C_API void sk_runtimeeffect_unref(sk_runtimeeffect_t* effect);
SK_C_API sk_shader_t* sk_runtimeeffect_make_shader(sk_runtimeeffect_t* effect, sk_data_t* uniforms, sk_flattenable_t** children, size_t childCount, const sk_matrix_t* localMatrix);
SK_C_API sk_colorfilter_t* sk_runtimeeffect_make_color_filter(sk_runtimeeffect_t* effect, sk_data_t* uniforms, sk_flattenable_t** children, size_t childCount);
SK_C_API size_t sk_runtimeeffect_get_uniform_byte_size(const sk_runtimeeffect_t* effect);
SK_C_API size_t sk_runtimeeffect_get_uniforms_size(const sk_runtimeeffect_t* effect);
SK_C_API void sk_runtimeeffect_get_uniform_name(const sk_runtimeeffect_t* effect, int index, sk_string_t* name);
SK_C_API void sk_runtimeeffect_get_uniform_from_index(const sk_runtimeeffect_t* effect, int index, sk_runtimeeffect_uniform_t* cuniform);
SK_C_API void sk_runtimeeffect_get_uniform_from_name(const sk_runtimeeffect_t* effect, const char* name, size_t len, sk_runtimeeffect_uniform_t* cuniform);
SK_C_API size_t sk_runtimeeffect_get_children_size(const sk_runtimeeffect_t* effect);
SK_C_API void sk_runtimeeffect_get_child_name(const sk_runtimeeffect_t* effect, int index, sk_string_t* name);
SK_C_API void sk_runtimeeffect_get_child_from_index(const sk_runtimeeffect_t* effect, int index, sk_runtimeeffect_child_t* cchild);
SK_C_API void sk_runtimeeffect_get_child_from_name(const sk_runtimeeffect_t* effect, const char* name, size_t len, sk_runtimeeffect_child_t* cchild);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,49 +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_shader_DEFINED
#define sk_shader_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
// SkShader
SK_C_API void sk_shader_ref(sk_shader_t* shader);
SK_C_API void sk_shader_unref(sk_shader_t* shader);
SK_C_API sk_shader_t* sk_shader_with_local_matrix(const sk_shader_t* shader, const sk_matrix_t* localMatrix);
SK_C_API sk_shader_t* sk_shader_with_color_filter(const sk_shader_t* shader, const sk_colorfilter_t* filter);
// SkShaders
SK_C_API sk_shader_t* sk_shader_new_empty(void);
SK_C_API sk_shader_t* sk_shader_new_color(sk_color_t color);
SK_C_API sk_shader_t* sk_shader_new_color4f(const sk_color4f_t* color, const sk_colorspace_t* colorspace);
SK_C_API sk_shader_t* sk_shader_new_blend(sk_blendmode_t mode, const sk_shader_t* dst, const sk_shader_t* src);
// SkGradientShader
SK_C_API sk_shader_t* sk_shader_new_linear_gradient(const sk_point_t points[2], const sk_color_t colors[], const float colorPos[], int colorCount, sk_shader_tilemode_t tileMode, const sk_matrix_t* localMatrix);
SK_C_API sk_shader_t* sk_shader_new_linear_gradient_color4f(const sk_point_t points[2], const sk_color4f_t* colors, const sk_colorspace_t* colorspace, const float colorPos[], int colorCount, sk_shader_tilemode_t tileMode, const sk_matrix_t* localMatrix);
SK_C_API sk_shader_t* sk_shader_new_radial_gradient(const sk_point_t* center, float radius, const sk_color_t colors[], const float colorPos[], int colorCount, sk_shader_tilemode_t tileMode, const sk_matrix_t* localMatrix);
SK_C_API sk_shader_t* sk_shader_new_radial_gradient_color4f(const sk_point_t* center, float radius, const sk_color4f_t* colors, const sk_colorspace_t* colorspace, const float colorPos[], int colorCount, sk_shader_tilemode_t tileMode, const sk_matrix_t* localMatrix);
SK_C_API sk_shader_t* sk_shader_new_sweep_gradient(const sk_point_t* center, const sk_color_t colors[], const float colorPos[], int colorCount, sk_shader_tilemode_t tileMode, float startAngle, float endAngle, const sk_matrix_t* localMatrix);
SK_C_API sk_shader_t* sk_shader_new_sweep_gradient_color4f(const sk_point_t* center, const sk_color4f_t* colors, const sk_colorspace_t* colorspace, const float colorPos[], int colorCount, sk_shader_tilemode_t tileMode, float startAngle, float endAngle, const sk_matrix_t* localMatrix);
SK_C_API sk_shader_t* sk_shader_new_two_point_conical_gradient(const sk_point_t* start, float startRadius, const sk_point_t* end, float endRadius, const sk_color_t colors[], const float colorPos[], int colorCount, sk_shader_tilemode_t tileMode, const sk_matrix_t* localMatrix);
SK_C_API sk_shader_t* sk_shader_new_two_point_conical_gradient_color4f(const sk_point_t* start, float startRadius, const sk_point_t* end, float endRadius, const sk_color4f_t* colors, const sk_colorspace_t* colorspace, const float colorPos[], int colorCount, sk_shader_tilemode_t tileMode, const sk_matrix_t* localMatrix);
// SkPerlinNoiseShader
SK_C_API sk_shader_t* sk_shader_new_perlin_noise_fractal_noise(float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, const sk_isize_t* tileSize);
SK_C_API sk_shader_t* sk_shader_new_perlin_noise_turbulence(float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, const sk_isize_t* tileSize);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,94 +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_stream_DEFINED
#define sk_stream_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API void sk_stream_asset_destroy(sk_stream_asset_t* cstream);
////////////////////////////////////////////////////////////////////////////////
SK_C_API sk_stream_filestream_t* sk_filestream_new(const char* path);
SK_C_API void sk_filestream_destroy(sk_stream_filestream_t* cstream);
SK_C_API bool sk_filestream_is_valid(sk_stream_filestream_t* cstream);
////////////////////////////////////////////////////////////////////////////////
SK_C_API sk_stream_memorystream_t* sk_memorystream_new(void);
SK_C_API sk_stream_memorystream_t* sk_memorystream_new_with_length(size_t length);
SK_C_API sk_stream_memorystream_t* sk_memorystream_new_with_data(const void* data, size_t length, bool copyData);
SK_C_API sk_stream_memorystream_t* sk_memorystream_new_with_skdata(sk_data_t* data);
SK_C_API void sk_memorystream_set_memory(sk_stream_memorystream_t* cmemorystream, const void* data, size_t length, bool copyData);
SK_C_API void sk_memorystream_destroy(sk_stream_memorystream_t* cstream);
////////////////////////////////////////////////////////////////////////////////
SK_C_API size_t sk_stream_read(sk_stream_t* cstream, void* buffer, size_t size);
SK_C_API size_t sk_stream_peek(sk_stream_t* cstream, void* buffer, size_t size);
SK_C_API size_t sk_stream_skip(sk_stream_t* cstream, size_t size);
SK_C_API bool sk_stream_is_at_end(sk_stream_t* cstream);
SK_C_API bool sk_stream_read_s8(sk_stream_t* cstream, int8_t* buffer);
SK_C_API bool sk_stream_read_s16(sk_stream_t* cstream, int16_t* buffer);
SK_C_API bool sk_stream_read_s32(sk_stream_t* cstream, int32_t* buffer);
SK_C_API bool sk_stream_read_u8(sk_stream_t* cstream, uint8_t* buffer);
SK_C_API bool sk_stream_read_u16(sk_stream_t* cstream, uint16_t* buffer);
SK_C_API bool sk_stream_read_u32(sk_stream_t* cstream, uint32_t* buffer);
SK_C_API bool sk_stream_read_bool(sk_stream_t* cstream, bool* buffer);
SK_C_API bool sk_stream_rewind(sk_stream_t* cstream);
SK_C_API bool sk_stream_has_position(sk_stream_t* cstream);
SK_C_API size_t sk_stream_get_position(sk_stream_t* cstream);
SK_C_API bool sk_stream_seek(sk_stream_t* cstream, size_t position);
SK_C_API bool sk_stream_move(sk_stream_t* cstream, long offset);
SK_C_API bool sk_stream_has_length(sk_stream_t* cstream);
SK_C_API size_t sk_stream_get_length(sk_stream_t* cstream);
SK_C_API const void* sk_stream_get_memory_base(sk_stream_t* cstream);
SK_C_API sk_stream_t* sk_stream_fork(sk_stream_t* cstream);
SK_C_API sk_stream_t* sk_stream_duplicate(sk_stream_t* cstream);
SK_C_API void sk_stream_destroy(sk_stream_t* cstream);
////////////////////////////////////////////////////////////////////////////////
SK_C_API sk_wstream_filestream_t* sk_filewstream_new(const char* path);
SK_C_API void sk_filewstream_destroy(sk_wstream_filestream_t* cstream);
SK_C_API bool sk_filewstream_is_valid(sk_wstream_filestream_t* cstream);
SK_C_API sk_wstream_dynamicmemorystream_t* sk_dynamicmemorywstream_new(void);
SK_C_API sk_stream_asset_t* sk_dynamicmemorywstream_detach_as_stream(sk_wstream_dynamicmemorystream_t* cstream);
SK_C_API sk_data_t* sk_dynamicmemorywstream_detach_as_data(sk_wstream_dynamicmemorystream_t* cstream);
SK_C_API void sk_dynamicmemorywstream_copy_to(sk_wstream_dynamicmemorystream_t* cstream, void* data);
SK_C_API bool sk_dynamicmemorywstream_write_to_stream(sk_wstream_dynamicmemorystream_t* cstream, sk_wstream_t* dst);
SK_C_API void sk_dynamicmemorywstream_destroy(sk_wstream_dynamicmemorystream_t* cstream);
////////////////////////////////////////////////////////////////////////////////
SK_C_API bool sk_wstream_write(sk_wstream_t* cstream, const void* buffer, size_t size);
SK_C_API bool sk_wstream_newline(sk_wstream_t* cstream);
SK_C_API void sk_wstream_flush(sk_wstream_t* cstream);
SK_C_API size_t sk_wstream_bytes_written(sk_wstream_t* cstream);
SK_C_API bool sk_wstream_write_8(sk_wstream_t* cstream, uint8_t value);
SK_C_API bool sk_wstream_write_16(sk_wstream_t* cstream, uint16_t value);
SK_C_API bool sk_wstream_write_32(sk_wstream_t* cstream, uint32_t value);
SK_C_API bool sk_wstream_write_text(sk_wstream_t* cstream, const char* value);
SK_C_API bool sk_wstream_write_dec_as_text(sk_wstream_t* cstream, int32_t value);
SK_C_API bool sk_wstream_write_bigdec_as_text(sk_wstream_t* cstream, int64_t value, int minDigits);
SK_C_API bool sk_wstream_write_hex_as_text(sk_wstream_t* cstream, uint32_t value, int minDigits);
SK_C_API bool sk_wstream_write_scalar_as_text(sk_wstream_t* cstream, float value);
SK_C_API bool sk_wstream_write_bool(sk_wstream_t* cstream, bool value);
SK_C_API bool sk_wstream_write_scalar(sk_wstream_t* cstream, float value);
SK_C_API bool sk_wstream_write_packed_uint(sk_wstream_t* cstream, size_t value);
SK_C_API bool sk_wstream_write_stream(sk_wstream_t* cstream, sk_stream_t* input, size_t length);
SK_C_API int sk_wstream_get_size_of_packed_uint(size_t value);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,25 +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_string_DEFINED
#define sk_string_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API sk_string_t* sk_string_new_empty(void);
SK_C_API sk_string_t* sk_string_new_with_copy(const char* src, size_t length);
SK_C_API void sk_string_destructor(const sk_string_t*);
SK_C_API size_t sk_string_get_size(const sk_string_t*);
SK_C_API const char* sk_string_get_c_str(const sk_string_t*);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -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_surface_DEFINED
#define sk_surface_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
// surface
SK_C_API sk_surface_t* sk_surface_new_null(int width, int height);
SK_C_API sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t*, size_t rowBytes, const sk_surfaceprops_t*);
SK_C_API sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t*, void* pixels, size_t rowBytes, const sk_surface_raster_release_proc releaseProc, void* context, const sk_surfaceprops_t* props);
SK_C_API sk_surface_t* sk_surface_new_backend_texture(gr_recording_context_t* context, const gr_backendtexture_t* texture, gr_surfaceorigin_t origin, int samples, sk_colortype_t colorType, sk_colorspace_t* colorspace, const sk_surfaceprops_t* props);
SK_C_API sk_surface_t* sk_surface_new_backend_render_target(gr_recording_context_t* context, const gr_backendrendertarget_t* target, gr_surfaceorigin_t origin, sk_colortype_t colorType, sk_colorspace_t* colorspace, const sk_surfaceprops_t* props);
SK_C_API sk_surface_t* sk_surface_new_render_target(gr_recording_context_t* context, bool budgeted, const sk_imageinfo_t* cinfo, int sampleCount, gr_surfaceorigin_t origin, const sk_surfaceprops_t* props, bool shouldCreateWithMips);
SK_C_API sk_surface_t* sk_surface_new_metal_layer(gr_recording_context_t* context, gr_mtl_handle_t layer, gr_surfaceorigin_t origin, int sampleCount, sk_colortype_t colorType, sk_colorspace_t* colorspace, const sk_surfaceprops_t* props, gr_mtl_handle_t* drawable);
SK_C_API sk_surface_t* sk_surface_new_metal_view(gr_recording_context_t* context, gr_mtl_handle_t mtkView, gr_surfaceorigin_t origin, int sampleCount, sk_colortype_t colorType, sk_colorspace_t* colorspace, const sk_surfaceprops_t* props);
SK_C_API void sk_surface_unref(sk_surface_t*);
SK_C_API sk_canvas_t* sk_surface_get_canvas(sk_surface_t*);
SK_C_API sk_image_t* sk_surface_new_image_snapshot(sk_surface_t*);
SK_C_API sk_image_t* sk_surface_new_image_snapshot_with_crop(sk_surface_t* surface, const sk_irect_t* bounds);
SK_C_API void sk_surface_draw(sk_surface_t* surface, sk_canvas_t* canvas, float x, float y, const sk_paint_t* paint);
SK_C_API bool sk_surface_peek_pixels(sk_surface_t* surface, sk_pixmap_t* pixmap);
SK_C_API bool sk_surface_read_pixels(sk_surface_t* surface, sk_imageinfo_t* dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY);
SK_C_API const sk_surfaceprops_t* sk_surface_get_props(sk_surface_t* surface);
SK_C_API void sk_surface_flush(sk_surface_t* surface);
SK_C_API void sk_surface_flush_and_submit(sk_surface_t* surface, bool syncCpu);
SK_C_API gr_recording_context_t* sk_surface_get_recording_context(sk_surface_t* surface);
// surface props
SK_C_API sk_surfaceprops_t* sk_surfaceprops_new(uint32_t flags, sk_pixelgeometry_t geometry);
SK_C_API void sk_surfaceprops_delete(sk_surfaceprops_t* props);
SK_C_API uint32_t sk_surfaceprops_get_flags(sk_surfaceprops_t* props);
SK_C_API sk_pixelgeometry_t sk_surfaceprops_get_pixel_geometry(sk_surfaceprops_t* props);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,21 +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_svg_DEFINED
#define sk_svg_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API sk_canvas_t* sk_svgcanvas_create_with_stream(const sk_rect_t* bounds, sk_wstream_t* stream);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,41 +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_textblob_DEFINED
#define sk_textblob_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
// sk_textblob_t
SK_C_API void sk_textblob_ref(const sk_textblob_t* blob);
SK_C_API void sk_textblob_unref(const sk_textblob_t* blob);
SK_C_API uint32_t sk_textblob_get_unique_id(const sk_textblob_t* blob);
SK_C_API void sk_textblob_get_bounds(const sk_textblob_t* blob, sk_rect_t* bounds);
SK_C_API int sk_textblob_get_intercepts(const sk_textblob_t* blob, const float bounds[2], float intervals[], const sk_paint_t* paint);
// sk_textblob_builder_t
SK_C_API sk_textblob_builder_t* sk_textblob_builder_new(void);
SK_C_API void sk_textblob_builder_delete(sk_textblob_builder_t* builder);
SK_C_API sk_textblob_t* sk_textblob_builder_make(sk_textblob_builder_t* builder);
SK_C_API void sk_textblob_builder_alloc_run(sk_textblob_builder_t* builder, const sk_font_t* font, int count, float x, float y, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer);
SK_C_API void sk_textblob_builder_alloc_run_pos_h(sk_textblob_builder_t* builder, const sk_font_t* font, int count, float y, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer);
SK_C_API void sk_textblob_builder_alloc_run_pos(sk_textblob_builder_t* builder, const sk_font_t* font, int count, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer);
SK_C_API void sk_textblob_builder_alloc_run_rsxform(sk_textblob_builder_t* builder, const sk_font_t* font, int count, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer);
SK_C_API void sk_textblob_builder_alloc_run_text(sk_textblob_builder_t* builder, const sk_font_t* font, int count, float x, float y, int textByteCount, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer);
SK_C_API void sk_textblob_builder_alloc_run_text_pos_h(sk_textblob_builder_t* builder, const sk_font_t* font, int count, float y, int textByteCount, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer);
SK_C_API void sk_textblob_builder_alloc_run_text_pos(sk_textblob_builder_t* builder, const sk_font_t* font, int count, int textByteCount, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer);
SK_C_API void sk_textblob_builder_alloc_run_text_rsxform(sk_textblob_builder_t* builder, const sk_font_t* font, int count, int textByteCount, const sk_rect_t* bounds, sk_textblob_builder_runbuffer_t* runbuffer);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,80 +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_typeface_DEFINED
#define sk_typeface_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
// typeface
SK_C_API void sk_typeface_unref(sk_typeface_t* typeface);
SK_C_API sk_fontstyle_t* sk_typeface_get_fontstyle(const sk_typeface_t* typeface);
SK_C_API int sk_typeface_get_font_weight(const sk_typeface_t* typeface);
SK_C_API int sk_typeface_get_font_width(const sk_typeface_t* typeface);
SK_C_API sk_font_style_slant_t sk_typeface_get_font_slant(const sk_typeface_t* typeface);
SK_C_API bool sk_typeface_is_fixed_pitch(const sk_typeface_t* typeface);
SK_C_API sk_typeface_t* sk_typeface_create_default(void);
SK_C_API sk_typeface_t* sk_typeface_ref_default(void);
SK_C_API sk_typeface_t* sk_typeface_create_from_name(const char* familyName, const sk_fontstyle_t* style);
SK_C_API sk_typeface_t* sk_typeface_create_from_file(const char* path, int index);
SK_C_API sk_typeface_t* sk_typeface_create_from_stream(sk_stream_asset_t* stream, int index);
SK_C_API sk_typeface_t* sk_typeface_create_from_data(sk_data_t* data, int index);
SK_C_API void sk_typeface_unichars_to_glyphs(const sk_typeface_t* typeface, const int32_t unichars[], int count, uint16_t glyphs[]);
SK_C_API uint16_t sk_typeface_unichar_to_glyph(const sk_typeface_t* typeface, const int32_t unichar);
SK_C_API int sk_typeface_count_glyphs(const sk_typeface_t* typeface);
SK_C_API int sk_typeface_count_tables(const sk_typeface_t* typeface);
SK_C_API int sk_typeface_get_table_tags(const sk_typeface_t* typeface, sk_font_table_tag_t tags[]);
SK_C_API size_t sk_typeface_get_table_size(const sk_typeface_t* typeface, sk_font_table_tag_t tag);
SK_C_API size_t sk_typeface_get_table_data(const sk_typeface_t* typeface, sk_font_table_tag_t tag, size_t offset, size_t length, void* data);
SK_C_API sk_data_t* sk_typeface_copy_table_data(const sk_typeface_t* typeface, sk_font_table_tag_t tag);
SK_C_API int sk_typeface_get_units_per_em(const sk_typeface_t* typeface);
SK_C_API bool sk_typeface_get_kerning_pair_adjustments(const sk_typeface_t* typeface, const uint16_t glyphs[], int count, int32_t adjustments[]);
// TODO: createFamilyNameIterator
SK_C_API sk_string_t* sk_typeface_get_family_name(const sk_typeface_t* typeface);
SK_C_API sk_stream_asset_t* sk_typeface_open_stream(const sk_typeface_t* typeface, int* ttcIndex);
// font manager
SK_C_API sk_fontmgr_t* sk_fontmgr_create_default(void);
SK_C_API sk_fontmgr_t* sk_fontmgr_ref_default(void);
SK_C_API void sk_fontmgr_unref(sk_fontmgr_t*);
SK_C_API int sk_fontmgr_count_families(sk_fontmgr_t*);
SK_C_API void sk_fontmgr_get_family_name(sk_fontmgr_t*, int index, sk_string_t* familyName);
SK_C_API sk_fontstyleset_t* sk_fontmgr_create_styleset(sk_fontmgr_t*, int index);
SK_C_API sk_fontstyleset_t* sk_fontmgr_match_family(sk_fontmgr_t*, const char* familyName);
SK_C_API sk_typeface_t* sk_fontmgr_match_family_style(sk_fontmgr_t*, const char* familyName, sk_fontstyle_t* style);
SK_C_API sk_typeface_t* sk_fontmgr_match_family_style_character(sk_fontmgr_t*, const char* familyName, sk_fontstyle_t* style, const char** bcp47, int bcp47Count, int32_t character);
SK_C_API sk_typeface_t* sk_fontmgr_create_from_data(sk_fontmgr_t*, sk_data_t* data, int index);
SK_C_API sk_typeface_t* sk_fontmgr_create_from_stream(sk_fontmgr_t*, sk_stream_asset_t* stream, int index);
SK_C_API sk_typeface_t* sk_fontmgr_create_from_file(sk_fontmgr_t*, const char* path, int index);
// font style
SK_C_API sk_fontstyle_t* sk_fontstyle_new(int weight, int width, sk_font_style_slant_t slant);
SK_C_API void sk_fontstyle_delete(sk_fontstyle_t* fs);
SK_C_API int sk_fontstyle_get_weight(const sk_fontstyle_t* fs);
SK_C_API int sk_fontstyle_get_width(const sk_fontstyle_t* fs);
SK_C_API sk_font_style_slant_t sk_fontstyle_get_slant(const sk_fontstyle_t* fs);
// font style set
SK_C_API sk_fontstyleset_t* sk_fontstyleset_create_empty(void);
SK_C_API void sk_fontstyleset_unref(sk_fontstyleset_t* fss);
SK_C_API int sk_fontstyleset_get_count(sk_fontstyleset_t* fss);
SK_C_API void sk_fontstyleset_get_style(sk_fontstyleset_t* fss, int index, sk_fontstyle_t* fs, sk_string_t* style);
SK_C_API sk_typeface_t* sk_fontstyleset_create_typeface(sk_fontstyleset_t* fss, int index);
SK_C_API sk_typeface_t* sk_fontstyleset_match_style(sk_fontstyleset_t* fss, sk_fontstyle_t* style);
SK_C_PLUS_PLUS_END_GUARD
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,23 +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_vertices_DEFINED
#define sk_vertices_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API void sk_vertices_unref(sk_vertices_t* cvertices);
SK_C_API void sk_vertices_ref(sk_vertices_t* cvertices);
SK_C_API sk_vertices_t* sk_vertices_make_copy(sk_vertices_vertex_mode_t vmode, int vertexCount, const sk_point_t* positions, const sk_point_t* texs, const sk_color_t* colors, int indexCount, const uint16_t* indices);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,49 +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 skottie_DEFINED
#define skottie_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
/*
* skottie::Animation
*/
SK_C_API void skottie_animation_keepalive(void);
SK_C_API skottie_animation_t* skottie_animation_make_from_string(const char* data, size_t length);
SK_C_API skottie_animation_t* skottie_animation_make_from_data(const char* data, size_t length);
SK_C_API skottie_animation_t* skottie_animation_make_from_stream(sk_stream_t* stream);
SK_C_API skottie_animation_t* skottie_animation_make_from_file(const char* path);
SK_C_API void skottie_animation_ref(skottie_animation_t* instance);
SK_C_API void skottie_animation_unref(skottie_animation_t* instance);
SK_C_API void skottie_animation_delete(skottie_animation_t *instance);
SK_C_API void skottie_animation_render(skottie_animation_t *instance, sk_canvas_t *canvas, sk_rect_t *dst);
SK_C_API void skottie_animation_render_with_flags(skottie_animation_t *instance, sk_canvas_t *canvas, sk_rect_t *dst, skottie_animation_renderflags_t flags);
SK_C_API void skottie_animation_seek(skottie_animation_t *instance, float t, sksg_invalidation_controller_t *ic);
SK_C_API void skottie_animation_seek_frame(skottie_animation_t *instance, float t, sksg_invalidation_controller_t *ic);
SK_C_API void skottie_animation_seek_frame_time(skottie_animation_t *instance, float t, sksg_invalidation_controller_t *ic);
SK_C_API double skottie_animation_get_duration(skottie_animation_t *instance);
SK_C_API double skottie_animation_get_fps(skottie_animation_t *instance);
SK_C_API double skottie_animation_get_in_point(skottie_animation_t *instance);
SK_C_API double skottie_animation_get_out_point(skottie_animation_t *instance);
SK_C_API void skottie_animation_get_version(skottie_animation_t *instance, sk_string_t* version);
SK_C_API void skottie_animation_get_size(skottie_animation_t *instance, sk_size_t* size);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,28 +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 sksg_invalidationcontroller_DEFINED
#define sksg_invalidationcontroller_DEFINED
#include "include/c/sk_types.h"
SK_C_PLUS_PLUS_BEGIN_GUARD
SK_C_API sksg_invalidation_controller_t* sksg_invalidation_controller_new(void);
SK_C_API void sksg_invalidation_controller_delete(sksg_invalidation_controller_t* instance);
SK_C_API void sksg_invalidation_controller_inval(sksg_invalidation_controller_t* instance, sk_rect_t* rect, sk_matrix_t* matrix);
SK_C_API void sksg_invalidation_controller_get_bounds(sksg_invalidation_controller_t* instance, sk_rect_t* bounds);
SK_C_API void sksg_invalidation_controller_begin(sksg_invalidation_controller_t* instance);
SK_C_API void sksg_invalidation_controller_end(sksg_invalidation_controller_t* instance);
SK_C_API void sksg_invalidation_controller_reset(sksg_invalidation_controller_t* instance);
SK_C_PLUS_PLUS_END_GUARD
#endif

View file

@ -1,134 +0,0 @@
#include <gtk/gtk.h>
#include <epoxy/egl.h>
#include <epoxy/gl.h>
#include "include/c/sk_canvas.h"
#include "include/c/sk_data.h"
#include "include/c/sk_image.h"
#include "include/c/sk_paint.h"
#include "include/c/sk_path.h"
#include "include/c/sk_surface.h"
#include "include/c/gr_context.h"
#include "sk_area.h"
G_DEFINE_TYPE(SKArea, sk_area, GTK_TYPE_GL_AREA)
static void sk_area_init(SKArea *sk_area)
{
}
static void sk_area_dispose(GObject *sk_area)
{
G_OBJECT_CLASS(sk_area_parent_class)->dispose(sk_area);
}
static void sk_area_unroot(GtkWidget *widget)
{
SKArea *sk_area = SK_AREA_WIDGET(widget);
if(sk_area->surface) {
sk_surface_unref(sk_area->surface);
sk_area->surface = NULL;
sk_area->canvas = NULL;
}
if(sk_area->render_target) {
gr_backendrendertarget_delete(sk_area->render_target);
sk_area->render_target = NULL;
}
if(sk_area->gr_context) {
gr_direct_context_abandon_context(sk_area->gr_context);
sk_area->gr_context = NULL;
}
if(sk_area->gl_interface) {
gr_glinterface_unref(sk_area->gl_interface);
sk_area->gl_interface = NULL;
}
GTK_WIDGET_CLASS(sk_area_parent_class)->unroot(widget);
}
typedef gboolean (*render_func)(GtkGLArea *, GdkGLContext *);
static gboolean render(SKArea *sk_area, GdkGLContext *context);
static void sk_area_class_init(SKAreaClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS(class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(class);
object_class->dispose = sk_area_dispose;
widget_class->unroot = sk_area_unroot;
class->parent_class.render = (render_func)render;
}
GtkWidget * sk_area_new(void)
{
return g_object_new(sk_area_get_type(), NULL);
}
static gr_gl_func_ptr egl_get_gl_proc(void* unused, const char name[]) {
return eglGetProcAddress(name);
}
static gboolean render(SKArea *sk_area, GdkGLContext *context)
{
bool reiniting = false;
if(!sk_area->draw_func)
return true;
int width = gtk_widget_get_width(GTK_WIDGET(sk_area));
int height = gtk_widget_get_height(GTK_WIDGET(sk_area));
if(!sk_area->gr_context) {
if(!sk_area->gl_interface)
sk_area->gl_interface = gr_glinterface_assemble_interface(NULL, egl_get_gl_proc);
sk_area->gr_context = gr_direct_context_make_gl(sk_area->gl_interface);
reiniting = true;
}
gr_direct_context_reset_context(sk_area->gr_context, 0xffffffff);
if((width != sk_area->prev_width || height != sk_area->prev_height) || reiniting) {
GLint framebuffer = 0;
GLint stencil_bits = 0;
GLint samples = 0;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &framebuffer);
glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &stencil_bits);
glGetIntegerv(GL_SAMPLES, &samples);
if(sk_area->surface) {
sk_surface_unref(sk_area->surface);
sk_area->surface = NULL;
sk_area->canvas = NULL;
}
if(sk_area->render_target)
gr_backendrendertarget_delete(sk_area->render_target);
gr_gl_framebufferinfo_t gl_info = {.fFBOID = framebuffer, .fFormat = GL_RGBA8};
sk_area->render_target = gr_backendrendertarget_new_gl(width, height, samples, stencil_bits, &gl_info);
sk_area->surface = sk_surface_new_backend_render_target((gr_recording_context_t *)sk_area->gr_context, sk_area->render_target, BOTTOM_LEFT_GR_SURFACE_ORIGIN, RGBA_8888_SK_COLORTYPE, NULL, NULL);
sk_area->canvas = sk_surface_get_canvas(sk_area->surface);
}
// TODO - allegedly android doesn't clear the canvas between frames, but clearly at least gravity defied seems to expect us to do so
sk_canvas_clear(sk_area->canvas, sk_color_set_argb(0x0, 0x00, 0x00, 0x00));
sk_area->draw_func(sk_area, sk_area->canvas, sk_area->draw_func_data);
sk_canvas_flush(sk_area->canvas);
gr_direct_context_flush(sk_area->gr_context);
sk_area->prev_width = width;
sk_area->prev_height = height;
return true;
}
void sk_area_set_draw_func(SKArea *sk_area, void (* draw_func)(SKArea *sk_area, sk_canvas_t *canvas, gpointer data), gpointer data)
{
sk_area->draw_func = draw_func;
sk_area->draw_func_data = data;
}

View file

@ -1,31 +0,0 @@
#ifndef SK_AREA_H
#define SK_AREA_H
#include "include/c/sk_canvas.h"
G_DECLARE_FINAL_TYPE(SKArea, sk_area, SK_AREA, WIDGET, GtkGLArea)
struct _SKArea
{
GtkGLArea parent_instance;
void (* draw_func)(SKArea *sk_area, sk_canvas_t *canvas, gpointer data);
gpointer draw_func_data;
const gr_glinterface_t *gl_interface;
gr_direct_context_t *gr_context;
sk_surface_t* surface;
sk_canvas_t* canvas;
gr_backendrendertarget_t *render_target;
int prev_width;
int prev_height;
};
struct _SKAreaClass
{
GtkGLAreaClass parent_class;
};
GtkWidget * sk_area_new(void);
void sk_area_set_draw_func(SKArea *sk_area, void (*draw_func)(SKArea *sk_area, sk_canvas_t *canvas, gpointer data), gpointer data);
#endif