#
{
'sources': [
- # Xamarin created files
- '<(skia_include_path)/c/xamarin/sk_x_types.h',
- '<(skia_include_path)/c/xamarin/sk_x_bitmap.h',
- '<(skia_include_path)/c/xamarin/sk_x_canvas.h',
- '<(skia_include_path)/c/xamarin/sk_x_codec.h',
- '<(skia_include_path)/c/xamarin/sk_x_data.h',
- '<(skia_include_path)/c/xamarin/sk_x_document.h',
- '<(skia_include_path)/c/xamarin/sk_x_image.h',
- '<(skia_include_path)/c/xamarin/sk_x_maskfilter.h',
- '<(skia_include_path)/c/xamarin/sk_x_matrix.h',
- '<(skia_include_path)/c/xamarin/sk_x_imagefilter.h',
- '<(skia_include_path)/c/xamarin/sk_x_colorfilter.h',
- '<(skia_include_path)/c/xamarin/sk_x_paint.h',
- '<(skia_include_path)/c/xamarin/sk_x_path.h',
- '<(skia_include_path)/c/xamarin/sk_x_patheffect.h',
- '<(skia_include_path)/c/xamarin/sk_x_shader.h',
- '<(skia_include_path)/c/xamarin/sk_x_stream.h',
- '<(skia_include_path)/c/xamarin/sk_x_typeface.h',
- '<(skia_include_path)/c/xamarin/sk_x_string.h',
- '<(skia_src_path)/c/xamarin/sk_x_types_priv.h',
- '<(skia_src_path)/c/xamarin/sk_x_bitmap.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_canvas.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_codec.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_data.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_document.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_enums.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_image.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_maskfilter.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_matrix.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_imagefilter.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_colorfilter.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_paint.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_path.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_patheffect.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_shader.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_stream.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_typeface.cpp',
- '<(skia_src_path)/c/xamarin/sk_x_string.cpp',
-
+ '<(skia_include_path)/c/sk_bitmap.h',
'<(skia_include_path)/c/sk_canvas.h',
+ '<(skia_include_path)/c/sk_codec.h',
+ '<(skia_include_path)/c/sk_colorfilter.h',
'<(skia_include_path)/c/sk_data.h',
+ '<(skia_include_path)/c/sk_document.h',
'<(skia_include_path)/c/sk_image.h',
+ '<(skia_include_path)/c/sk_imagefilter.h',
'<(skia_include_path)/c/sk_maskfilter.h',
'<(skia_include_path)/c/sk_matrix.h',
'<(skia_include_path)/c/sk_paint.h',
'<(skia_include_path)/c/sk_path.h',
+ '<(skia_include_path)/c/sk_patheffect.h',
'<(skia_include_path)/c/sk_picture.h',
'<(skia_include_path)/c/sk_shader.h',
+ '<(skia_include_path)/c/sk_stream.h',
+ '<(skia_include_path)/c/sk_string.h',
'<(skia_include_path)/c/sk_surface.h',
+ '<(skia_include_path)/c/sk_typeface.h',
'<(skia_include_path)/c/sk_types.h',
- '<(skia_src_path)/c/sk_c_from_to.h',
+ '<(skia_src_path)/c/sk_bitmap.cpp',
+ '<(skia_src_path)/c/sk_canvas.cpp',
+ '<(skia_src_path)/c/sk_codec.cpp',
+ '<(skia_src_path)/c/sk_colorfilter.cpp',
+ '<(skia_src_path)/c/sk_data.cpp',
+ '<(skia_src_path)/c/sk_document.cpp',
+ '<(skia_src_path)/c/sk_enums.cpp',
+ '<(skia_src_path)/c/sk_image.cpp',
+ '<(skia_src_path)/c/sk_imagefilter.cpp',
+ '<(skia_src_path)/c/sk_maskfilter.cpp',
+ '<(skia_src_path)/c/sk_matrix.cpp',
'<(skia_src_path)/c/sk_paint.cpp',
+ '<(skia_src_path)/c/sk_path.cpp',
+ '<(skia_src_path)/c/sk_patheffect.cpp',
+ '<(skia_src_path)/c/sk_picture.cpp',
+ '<(skia_src_path)/c/sk_shader.cpp',
+ '<(skia_src_path)/c/sk_stream.cpp',
+ '<(skia_src_path)/c/sk_string.cpp',
'<(skia_src_path)/c/sk_surface.cpp',
+ '<(skia_src_path)/c/sk_typeface.cpp',
'<(skia_src_path)/c/sk_types_priv.h',
'<(skia_src_path)/core/Sk4px.h',
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_bitmap_DEFINED
+#define sk_bitmap_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+SK_API void sk_bitmap_destructor(sk_bitmap_t* cbitmap);
+SK_API sk_bitmap_t* sk_bitmap_new();
+SK_API void sk_bitmap_get_info(sk_bitmap_t* cbitmap, sk_imageinfo_t* info);
+SK_API void* sk_bitmap_get_pixels(sk_bitmap_t* cbitmap, size_t* length);
+SK_API size_t sk_bitmap_get_row_bytes(sk_bitmap_t* cbitmap);
+SK_API size_t sk_bitmap_get_byte_count(sk_bitmap_t* cbitmap);
+SK_API void sk_bitmap_reset(sk_bitmap_t* cbitmap);
+SK_API bool sk_bitmap_is_null(sk_bitmap_t* cbitmap);
+SK_API bool sk_bitmap_is_immutable(sk_bitmap_t* cbitmap);
+SK_API void sk_bitmap_set_immutable(sk_bitmap_t* cbitmap);
+SK_API bool sk_bitmap_is_volatile(sk_bitmap_t* cbitmap);
+SK_API void sk_bitmap_set_volatile(sk_bitmap_t* cbitmap, bool value);
+SK_API void sk_bitmap_erase(sk_bitmap_t* cbitmap, sk_color_t color);
+SK_API void sk_bitmap_erase_rect(sk_bitmap_t* cbitmap, sk_color_t color, sk_irect_t* rect);
+SK_API sk_color_t sk_bitmap_get_pixel_color(sk_bitmap_t* cbitmap, int x, int y);
+SK_API void sk_bitmap_set_pixel_color(sk_bitmap_t* cbitmap, int x, int y, sk_color_t color);
+SK_API bool sk_bitmap_copy(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, sk_colortype_t ct);
+SK_API bool sk_bitmap_can_copy_to(sk_bitmap_t* cbitmap, sk_colortype_t ct);
+SK_API void sk_bitmap_lock_pixels(sk_bitmap_t* cbitmap);
+SK_API void sk_bitmap_unlock_pixels(sk_bitmap_t* cbitmap);
+SK_API void sk_bitmap_get_pixel_colors(sk_bitmap_t* cbitmap, sk_color_t* colors);
+SK_API void sk_bitmap_set_pixel_colors(sk_bitmap_t* cbitmap, const sk_color_t* colors);
+SK_API bool sk_bitmap_try_alloc_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, size_t rowBytes);
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
SK_API void sk_canvas_draw_picture(sk_canvas_t*, const sk_picture_t*,
const sk_matrix_t*, const sk_paint_t*);
+SK_API void sk_canvas_clear(sk_canvas_t*, sk_color_t);
+/**
+ This makes the contents of the canvas undefined. Subsequent calls that
+ require reading the canvas contents will produce undefined results. Examples
+ include blending and readPixels. The actual implementation is backend-
+ dependent and one legal implementation is to do nothing. Like clear(), this
+ ignores the clip.
+
+ This function should only be called if the caller intends to subsequently
+ draw to the canvas. The canvas may do real work at discard() time in order
+ to optimize performance on subsequent draws. Thus, if you call this and then
+ never draw to the canvas subsequently you may pay a perfomance penalty.
+*/
+SK_API void sk_canvas_discard(sk_canvas_t*);
+/**
+ Returns the number of matrix/clip states on the SkCanvas' private stack.
+ This will equal # save() calls - # restore() calls + 1. The save count on
+ a new canvas is 1.
+*/
+SK_API int sk_canvas_get_save_count(sk_canvas_t*);
+/**
+ Efficient way to pop any calls to sk_canvas_save() that happened after the save
+ count reached saveCount. It is an error for saveCount to be greater than
+ getSaveCount(). To pop all the way back to the initial matrix/clip context
+ pass saveCount == 1.
+*/
+SK_API void sk_canvas_restore_to_count(sk_canvas_t*, int saveCount);
+/**
+ Draws with the specified color and mode.
+**/
+SK_API void sk_canvas_draw_color(sk_canvas_t* ccanvas, sk_color_t color, sk_xfermode_mode_t mode);
+/**
+ Draw a series of points, interpreted based on the sk_point_mode_t mode. For
+ all modes, the count parameter is interpreted as the total number of
+ points. For LINES_SK_POINT_MODE mode, count/2 line segments are drawn.
+ For POINTS_SK_POINT_MODE mode, each point is drawn centered at its coordinate, and its
+ size is specified by the paint's stroke-width. It draws as a square,
+ unless the paint's cap-type is round, in which the points are drawn as
+ circles.
+ For LINES_SK_POINT_MODE mode, each pair of points is drawn as a line segment,
+ respecting the paint's settings for cap/join/width.
+ For POLYGON_SK_POINT_MODE mode, the entire array is drawn as a series of connected
+ line segments.
+ Note that, while similar, LINES_SK_POINT_MODE and POLYGON_SK_POINT_MODE modes draw slightly
+ differently than the equivalent path built with a series of moveto,
+ lineto calls, in that the path will draw all of its contours at once,
+ with no interactions if contours intersect each other (think XOR
+ xfermode). sk_canvas_draw_paint always draws each element one at a time.
+*/
+SK_API void sk_canvas_draw_points(sk_canvas_t*, sk_point_mode_t, size_t, const sk_point_t[], const sk_paint_t*);
+/**
+ Draws a single point with the specified paint
+*/
+SK_API void sk_canvas_draw_point(sk_canvas_t*, float, float, const sk_paint_t*);
+/**
+ Draws a single point with the specified paint
+*/
+SK_API void sk_canvas_draw_point_color(sk_canvas_t*, float, float, sk_color_t);
+/**
+ Draws a line from x0,y0 to x1,y1
+*/
+SK_API void sk_canvas_draw_line(sk_canvas_t* ccanvas, float x0, float y0, float x1, float y1, sk_paint_t* cpaint);
+/**
+ Draw the text, with origin at (x,y), using the specified paint.
+ The origin is interpreted based on the Align setting in the paint.
+
+ @param text The text to be drawn
+ @param byteLength The number of bytes to read from the text parameter
+ @param x The x-coordinate of the origin of the text being drawn
+ @param y The y-coordinate of the origin of the text being drawn
+ @param paint The paint used for the text (e.g. color, size, style)
+*/
+SK_API void sk_canvas_draw_text (sk_canvas_t*, const char *text, size_t byteLength, float x, float y, const sk_paint_t* paint);
+/**
+ Draw the text, with each character/glyph origin specified by the pos[]
+ array. The origin is interpreted by the Align setting in the paint.
+ @param text The text to be drawn
+ @param byteLength The number of bytes to read from the text parameter
+ @param pos Array of positions, used to position each character
+ @param paint The paint used for the text (e.g. color, size, style)
+*/
+SK_API void sk_canvas_draw_pos_text (sk_canvas_t*, const char *text, size_t byteLength, const sk_point_t[], const sk_paint_t* paint);
+SK_API void sk_canvas_draw_text_on_path (sk_canvas_t*, const char *text, size_t byteLength, const sk_path_t*path, float hOffset, float vOffset, const sk_paint_t* paint);
+SK_API void sk_canvas_draw_bitmap(sk_canvas_t* ccanvas, const sk_bitmap_t* cbitmap, float x, float y, const sk_paint_t* cpaint);
+SK_API void sk_canvas_draw_bitmap_rect(sk_canvas_t* ccanvas, const sk_bitmap_t* cbitmap, const sk_rect_t* csrcR, const sk_rect_t* cdstR, const sk_paint_t* cpaint);
+SK_API void sk_canvas_reset_matrix(sk_canvas_t* ccanvas);
+SK_API void sk_canvas_set_matrix(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix);
+SK_API void sk_canvas_get_total_matrix(sk_canvas_t* ccanvas, sk_matrix_t* cmatrix);
+/**
+ Draw the specified rounded rectangle using the specified paint. The
+ rectangle will be filled or stroked based on the style in the
+ paint.
+*/
+SK_API void sk_canvas_draw_round_rect(sk_canvas_t*, const sk_rect_t*, float rx, float ry, const sk_paint_t*);
+/**
+ Modify the current clip with the specified rectangle.
+*/
+SK_API void sk_canvas_clip_rect_with_operation(sk_canvas_t* t, const sk_rect_t* crect, sk_region_op_t op, bool doAA);
+/**
+ Modify the current clip with the specified path.
+*/
+SK_API void sk_canvas_clip_path_with_operation(sk_canvas_t* t, const sk_path_t* crect, sk_region_op_t op, bool doAA);
+
+/** Return the bounds of the current clip (in local coordinates) in the
+ bounds parameter, and return true if it is non-empty. This can be useful
+ in a way similar to quickReject, in that it tells you that drawing
+ outside of these bounds will be clipped out.
+*/
+SK_API bool sk_canvas_get_clip_bounds(sk_canvas_t* t, sk_rect_t* cbounds);
+/** Return the bounds of the current clip, in device coordinates; returns
+ true if non-empty. Maybe faster than getting the clip explicitly and
+ then taking its bounds.
+*/
+SK_API bool sk_canvas_get_clip_device_bounds(sk_canvas_t* t, sk_irect_t* cbounds);
+
SK_C_PLUS_PLUS_END_GUARD
#endif
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_codec_DEFINED
+#define sk_codec_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+SK_API size_t sk_codec_min_buffered_bytes_needed();
+
+// TODO: png chunk reader
+SK_API sk_codec_t* sk_codec_new_from_stream(sk_stream_t* stream);
+SK_API sk_codec_t* sk_codec_new_from_data(sk_data_t* data);
+
+SK_API void sk_codec_destroy(sk_codec_t* codec);
+SK_API void sk_codec_get_info(sk_codec_t* codec, sk_imageinfo_t* info);
+SK_API sk_colorspace_t* sk_codec_get_color_space(sk_codec_t* codec);
+SK_API sk_codec_origin_t sk_codec_get_origin(sk_codec_t* codec);
+SK_API void sk_codec_get_scaled_dimensions(sk_codec_t* codec, float desiredScale, sk_isize_t* dimensions);
+SK_API void sk_codec_get_valid_subset(sk_codec_t* codec, sk_irect_t* desiredSubset);
+SK_API sk_encoded_format_t sk_codec_get_encoded_format(sk_codec_t* codec);
+SK_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_color_t ctable[], int* ctableCount);
+SK_API sk_codec_result_t sk_codec_get_pixels_using_defaults(sk_codec_t* codec, const sk_imageinfo_t* info, void* pixels, size_t rowBytes);
+
+// TODO color space
+// TODO: SK_API sk_encodedinfo_t sk_codec_get_encoded_info(sk_codec_t* codec);
+// TODO: more...
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_colorfilter_DEFINED
+#define sk_colorfilter_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+SK_API void sk_colorfilter_unref(sk_colorfilter_t* filter);
+SK_API sk_colorfilter_t* sk_colorfilter_new_mode(sk_color_t c, sk_xfermode_mode_t mode);
+SK_API sk_colorfilter_t* sk_colorfilter_new_lighting(sk_color_t mul, sk_color_t add);
+SK_API sk_colorfilter_t* sk_colorfilter_new_compose(sk_colorfilter_t* outer, sk_colorfilter_t* inner);
+SK_API sk_colorfilter_t* sk_colorfilter_new_color_cube(sk_data_t* cubeData, int cubeDimension);
+SK_API sk_colorfilter_t* sk_colorfilter_new_color_matrix(const float array[20]);
+SK_API sk_colorfilter_t* sk_colorfilter_new_luma_color();
+SK_API sk_colorfilter_t* sk_colorfilter_new_table(const uint8_t table[256]);
+SK_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
*/
SK_API const void* sk_data_get_data(const sk_data_t*);
+SK_API sk_data_t* sk_data_new_from_file(const char* path);
+SK_API sk_data_t* sk_data_new_from_stream(sk_stream_t* stream, size_t length);
+SK_API const uint8_t* sk_data_get_bytes(const sk_data_t*);
+
SK_C_PLUS_PLUS_END_GUARD
#endif
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_document_DEFINED
+#define sk_document_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+SK_API void sk_document_unref(sk_document_t* document);
+
+SK_API sk_document_t* sk_document_create_pdf_from_stream(sk_wstream_t* stream, float dpi);
+SK_API sk_document_t* sk_document_create_pdf_from_filename(const char* path, float dpi);
+
+//SK_API sk_document_t* sk_document_create_xps_from_stream(sk_wstream_t* stream, float dpi);
+//SK_API sk_document_t* sk_document_create_xps_from_filename(const char* path, float dpi);
+
+SK_API sk_canvas_t* sk_document_begin_page(sk_document_t* document, float width, float height, const sk_rect_t* content);
+SK_API void sk_document_end_page(sk_document_t* document);
+SK_API bool sk_document_close(sk_document_t* document);
+SK_API void sk_document_abort(sk_document_t* document);
+
+// TODO: setMetadata
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
*/
SK_API uint32_t sk_image_get_unique_id(const sk_image_t*);
+/**
+ * Encode the image's pixels using the specified format and quality
+ * and return the result as a new image in a
+ * sk_data_t, which the caller must manage: call sk_data_unref() when
+ * they are done.
+ *
+ * If the image type cannot be encoded, this will return NULL.
+ */
+SK_API sk_data_t* sk_image_encode_specific(const sk_image_t* cimage, sk_image_encoder_t encoder, int quality);
+
+SK_API sk_image_t* sk_image_new_from_bitmap (const sk_bitmap_t *cbitmap);
+
SK_C_PLUS_PLUS_END_GUARD
#endif
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_imagefilter_DEFINED
+#define sk_imagefilter_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+SK_API sk_imagefilter_croprect_t* sk_imagefilter_croprect_new();
+SK_API sk_imagefilter_croprect_t* sk_imagefilter_croprect_new_with_rect(const sk_rect_t* rect, uint32_t flags);
+SK_API void sk_imagefilter_croprect_destructor(sk_imagefilter_croprect_t* cropRect);
+SK_API void sk_imagefilter_croprect_get_rect(sk_imagefilter_croprect_t* cropRect, sk_rect_t* rect);
+SK_API uint32_t sk_imagefilter_croprect_get_flags(sk_imagefilter_croprect_t* cropRect);
+SK_API void sk_imagefilter_unref(sk_imagefilter_t*);
+SK_API sk_imagefilter_t* sk_imagefilter_new_matrix(
+ const sk_matrix_t* matrix,
+ sk_filter_quality_t quality,
+ sk_imagefilter_t* input /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_alpha_threshold(
+ const sk_irect_t* region,
+ float innerThreshold,
+ float outerThreshold,
+ sk_imagefilter_t* input /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_blur(
+ float sigmaX,
+ float sigmaY,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_color_filter(
+ sk_colorfilter_t* cf,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_compose(
+ sk_imagefilter_t* outer,
+ sk_imagefilter_t* inner);
+SK_API sk_imagefilter_t* sk_imagefilter_new_displacement_map_effect(
+ sk_displacement_map_effect_channel_selector_type_t xChannelSelector,
+ sk_displacement_map_effect_channel_selector_type_t yChannelSelector,
+ float scale,
+ sk_imagefilter_t* displacement,
+ sk_imagefilter_t* color /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_drop_shadow(
+ float dx,
+ float dy,
+ float sigmaX,
+ float sigmaY,
+ sk_color_t color,
+ sk_drop_shadow_image_filter_shadow_mode_t shadowMode,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_distant_lit_diffuse(
+ const sk_point3_t* direction,
+ sk_color_t lightColor,
+ float surfaceScale,
+ float kd,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_point_lit_diffuse(
+ const sk_point3_t* location,
+ sk_color_t lightColor,
+ float surfaceScale,
+ float kd,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_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,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_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,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_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,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_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,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_magnifier(
+ const sk_rect_t* src,
+ float inset,
+ sk_imagefilter_t* input /*NULL*/);
+SK_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_matrix_convolution_tilemode_t tileMode,
+ bool convolveAlpha,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_merge(
+ sk_imagefilter_t* filters[],
+ int count,
+ const sk_xfermode_mode_t modes[] /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_dilate(
+ int radiusX,
+ int radiusY,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_erode(
+ int radiusX,
+ int radiusY,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_offset(
+ float dx,
+ float dy,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_picture(
+ sk_picture_t* picture);
+SK_API sk_imagefilter_t* sk_imagefilter_new_picture_with_croprect(
+ sk_picture_t* picture,
+ const sk_rect_t* cropRect);
+SK_API sk_imagefilter_t* sk_imagefilter_new_picture_for_localspace(
+ sk_picture_t* picture,
+ const sk_rect_t* cropRect,
+ sk_filter_quality_t filterQuality);
+SK_API sk_imagefilter_t* sk_imagefilter_new_rect_shader(
+ sk_shader_t* shader,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+SK_API sk_imagefilter_t* sk_imagefilter_new_tile(
+ const sk_rect_t* src,
+ const sk_rect_t* dst,
+ sk_imagefilter_t* input);
+SK_API sk_imagefilter_t* sk_imagefilter_new_xfermode(
+ sk_xfermode_mode_t mode,
+ sk_imagefilter_t* background,
+ sk_imagefilter_t* foreground /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/);
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
#include "sk_types.h"
-typedef enum {
- NORMAL_SK_BLUR_STYLE, //!< fuzzy inside and outside
- SOLID_SK_BLUR_STYLE, //!< solid inside, fuzzy outside
- OUTER_SK_BLUR_STYLE, //!< nothing inside, fuzzy outside
- INNER_SK_BLUR_STYLE, //!< fuzzy inside, nothing outside
-} sk_blurstyle_t;
-
SK_C_PLUS_PLUS_BEGIN_GUARD
/**
*/
SK_API sk_maskfilter_t* sk_maskfilter_new_blur(sk_blurstyle_t, float sigma);
+SK_API sk_maskfilter_t* sk_maskfilter_new_emboss(
+ float blurSigma,
+ const float direction[3],
+ float ambient,
+ float specular);
+SK_API sk_maskfilter_t* sk_maskfilter_new_table(
+ const uint8_t table[256]);
+SK_API sk_maskfilter_t* sk_maskfilter_new_gamma(
+ float gamma);
+SK_API sk_maskfilter_t* sk_maskfilter_new_clip(
+ uint8_t min,
+ uint8_t max);
+
SK_C_PLUS_PLUS_END_GUARD
#endif
*/
SK_API void sk_paint_set_stroke_miter(sk_paint_t*, float miter);
-typedef enum {
- BUTT_SK_STROKE_CAP,
- ROUND_SK_STROKE_CAP,
- SQUARE_SK_STROKE_CAP
-} sk_stroke_cap_t;
-
/**
Return the paint's stroke cap type, controlling how the start and
end of stroked lines and paths are treated.
*/
SK_API void sk_paint_set_stroke_cap(sk_paint_t*, sk_stroke_cap_t);
-typedef enum {
- MITER_SK_STROKE_JOIN,
- ROUND_SK_STROKE_JOIN,
- BEVEL_SK_STROKE_JOIN
-} sk_stroke_join_t;
-
/**
Return the paint's stroke join type, specifies the treatment that
is applied to corners in paths and rectangles
*/
SK_API void sk_paint_set_xfermode_mode(sk_paint_t*, sk_xfermode_mode_t);
+/**
+ Return true iff the paint has dithering enabled.
+ */
+SK_API bool sk_paint_is_dither(const sk_paint_t*);
+/**
+ Set to true to enable dithering, false to disable it on this
+ sk_paint_t.
+ */
+SK_API void sk_paint_set_dither(sk_paint_t*, bool);
+/**
+ Return true iff the paint has verticaltext enabled.
+ */
+SK_API bool sk_paint_is_verticaltext(const sk_paint_t*);
+/**
+ Set to true to enable verticaltext, false to disable it on this
+ sk_paint_t.
+ */
+SK_API void sk_paint_set_verticaltext(sk_paint_t*, bool);
+SK_API sk_shader_t* sk_paint_get_shader(sk_paint_t*);
+SK_API sk_maskfilter_t* sk_paint_get_maskfilter(sk_paint_t*);
+SK_API void sk_paint_set_colorfilter(sk_paint_t*, sk_colorfilter_t*);
+SK_API sk_colorfilter_t* sk_paint_get_colorfilter(sk_paint_t*);
+SK_API void sk_paint_set_imagefilter(sk_paint_t*, sk_imagefilter_t*);
+SK_API sk_imagefilter_t* sk_paint_get_imagefilter(sk_paint_t*);
+SK_API sk_xfermode_mode_t sk_paint_get_xfermode_mode(sk_paint_t*);
+/**
+ * Get or set the paint's filter quality.
+*/
+SK_API void sk_paint_set_filter_quality(sk_paint_t*, sk_filter_quality_t);
+SK_API sk_filter_quality_t sk_paint_get_filter_quality(sk_paint_t *);
+/**
+ * Get the paint's typeface
+ */
+SK_API sk_typeface_t* sk_paint_get_typeface(sk_paint_t*);
+/**
+ * Set the paint's typeface
+ */
+SK_API void sk_paint_set_typeface(sk_paint_t*, sk_typeface_t*);
+/**
+ * Get the paint's text sixe
+ */
+SK_API float sk_paint_get_textsize(sk_paint_t*);
+/**
+ * Set the paint's text sixe
+ */
+SK_API void sk_paint_set_textsize(sk_paint_t*, float);
+/**
+ * Get the paint's text alignment
+ */
+SK_API sk_text_align_t sk_paint_get_text_align(const sk_paint_t*);
+/**
+ * Set the paint's text alignment
+ */
+SK_API void sk_paint_set_text_align(sk_paint_t*, sk_text_align_t);
+/**
+ * Get the paint's text encoding
+ */
+SK_API sk_text_encoding_t sk_paint_get_text_encoding(const sk_paint_t*);
+/**
+ * Set the paint's text encoding
+ */
+SK_API void sk_paint_set_text_encoding(sk_paint_t*, sk_text_encoding_t);
+/**
+ * Set the paint's horizontal scale factor for text
+ */
+SK_API float sk_paint_get_text_scale_x(const sk_paint_t* cpaint);
+/**
+ * Set the paint's horizontal scale factor for text
+ */
+SK_API void sk_paint_set_text_scale_x(sk_paint_t* cpaint, float scale);
+/**
+ * Set the paint's horizontal skew factor for text
+ */
+SK_API float sk_paint_get_text_skew_x(const sk_paint_t* cpaint);
+/**
+ * Set the paint's horizontal skew factor for text
+ */
+SK_API void sk_paint_set_text_skew_x(sk_paint_t* cpaint, float skew);
+/**
+ * Return the number of bytes of text that were measured
+ */
+SK_API size_t sk_paint_break_text(const sk_paint_t* cpaint, const void* text, size_t length, float maxWidth, float* measuredWidth);
+/**
+ * Return the width of the text
+ */
+SK_API float sk_paint_measure_text(const sk_paint_t* cpaint, const void* text, size_t length, sk_rect_t* cbounds);
+/**
+ * Get the path outline of text.
+ */
+SK_API sk_path_t* sk_paint_get_text_path(sk_paint_t* cpaint, const void* text, size_t length, float x, float y);
+/**
+ * Get the path outline of text with each glyph positioned.
+ */
+SK_API sk_path_t* sk_paint_get_pos_text_path(sk_paint_t* cpaint, const void* text, size_t length, const sk_point_t pos[]);
+/**
+ * Return the recommend spacing between lines (which will be fDescent - fAscent + fLeading).
+ * Also get the font metrics for the current typeface and type size if cfontmetrics is not null.
+ */
+SK_API float sk_paint_get_fontmetrics(sk_paint_t* cpaint, sk_fontmetrics_t* cfontmetrics, float scale);
+/**
+ * Return the paint's patheffect object
+ */
+SK_API sk_path_effect_t* sk_paint_get_path_effect(sk_paint_t* cpaint);
+/**
+ * Sets the paint's patheffect object
+ */
+SK_API void sk_paint_set_path_effect(sk_paint_t* cpaint, sk_path_effect_t* effect);
+
SK_C_PLUS_PLUS_END_GUARD
#endif
SK_C_PLUS_PLUS_BEGIN_GUARD
-typedef enum {
- CW_SK_PATH_DIRECTION,
- CCW_SK_PATH_DIRECTION,
-} sk_path_direction_t;
-
/** Create a new, empty path. */
SK_API sk_path_t* sk_path_new();
/** Release the memory used by a sk_path_t. */
*/
SK_API bool sk_path_get_bounds(const sk_path_t*, sk_rect_t*);
+/** Set the beginning of the next contour relative to the last point on the
+ previous contour. If there is no previous contour, this is treated the
+ same as sk_path_move_to.
+*/
+SK_API void sk_path_rmove_to(sk_path_t*, float dx, float dy);
+/**
+ Same as sk_path_line_to, but the coordinates are considered relative to the last
+ point on this contour. If there is no previous point, then a sk_path_move_to(0,0)
+ is inserted automatically.
+*/
+SK_API void sk_path_rline_to(sk_path_t*, float dx, float yd);
+/**
+ Same as sk_path_quad_to, but the coordinates are considered relative to the last
+ point on this contour. If there is no previous point, then a sk_path_move_to(0,0)
+ is inserted automatically.
+*/
+SK_API void sk_path_rquad_to(sk_path_t*, float dx0, float dy0, float dx1, float dy1);
+/**
+ Same as sk_path_conic_to, but the coordinates are considered relative to the last
+ point on this contour. If there is no previous point, then a sk_path_move_to(0,0)
+ is inserted automatically.
+*/
+SK_API void sk_path_rconic_to(sk_path_t*, float dx0, float dy0, float dx1, float dy1, float w);
+/**
+ Same as sk_path_cubic_to, but the coordinates are considered relative to the last
+ point on this contour. If there is no previous point, then a sk_path_move_to(0,0)
+ is inserted automatically.
+*/
+SK_API void sk_path_rcubic_to(sk_path_t*,
+ float dx0, float dy0,
+ float dx1, float dy1,
+ float dx2, float dy2);
+/**
+ Add a closed rectangle contour to the path with an initial point of the contour
+ (startIndex) expressed as a corner index (0-3)
+ */
+SK_API void sk_path_add_rect_start(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir, uint32_t startIndex);
+/**
+ Add the specified arc to the path as a new contour.
+ */
+SK_API void sk_path_add_arc(sk_path_t* cpath, const sk_rect_t* crect, float startAngle, float sweepAngle);
+/**
+ Get the fill type of the path.
+*/
+SK_API sk_path_filltype_t sk_path_get_filltype(sk_path_t*);
+/**
+ Set the fill type of the path.
+*/
+SK_API void sk_path_set_filltype(sk_path_t*, sk_path_filltype_t);
+/**
+ Transform the points in this path by matrix, and write the answer back into the path
+*/
+SK_API void sk_path_transform(sk_path_t* cpath, const sk_matrix_t* cmatrix);
+/**
+ Creates a copy of the path
+*/
+SK_API sk_path_t* sk_path_clone(const sk_path_t* cpath);
+
+/* Iterators */
+SK_API sk_path_iterator_t* sk_path_create_iter (sk_path_t *cpath, int forceClose);
+
+SK_API sk_path_verb_t sk_path_iter_next (sk_path_iterator_t *iterator, sk_point_t points [4], int doConsumeDegenerates, int exact);
+
+SK_API float sk_path_iter_conic_weight (sk_path_iterator_t *iterator);
+
+SK_API int sk_path_iter_is_close_line (sk_path_iterator_t *iterator);
+
+SK_API int sk_path_iter_is_closed_contour (sk_path_iterator_t *iterator);
+
+SK_API void sk_path_iter_destroy (sk_path_iterator_t *iterator);
+
+/* Raw iterators */
+SK_API sk_path_rawiterator_t* sk_path_create_rawiter (sk_path_t *cpath);
+
+SK_API sk_path_verb_t sk_path_rawiter_peek (sk_path_rawiterator_t *iterator);
+
+SK_API sk_path_verb_t sk_path_rawiter_next (sk_path_rawiterator_t *iterator);
+
+SK_API float sk_path_rawiter_conic_weight (sk_path_rawiterator_t *iterator);
+
+SK_API void sk_path_rawiter_destroy (sk_path_rawiterator_t *iterator);
+
+/* Paths */
+
+/**
+ Adds the @other path to the @cpath by appending a @dx, @dy offset to each node, using the specified adding mode in @add_mode
+ */
+SK_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);
+/**
+ Adds the @other path to the @cpath by applying the @matrix transformation on the @other, using the specified adding mode in @add_mode
+ */
+SK_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);
+/**
+ Adds the @other path to the @cpath using the specified adding mode in @add_mode
+ */
+SK_API void sk_path_add_path (sk_path_t* cpath, sk_path_t* other, sk_path_add_mode_t add_mode);
+SK_API void sk_path_add_path_reverse (sk_path_t* cpath, sk_path_t* other);
+
+/**
+ Clear any lines and curves from the path, making it empty. This frees up
+ internal storage associated with those segments.
+ On Android, does not change fSourcePath.
+ */
+SK_API void sk_path_reset (sk_path_t* cpath);
+
+/**
+ Similar to sk_path_reset (), in that all lines and curves are removed from the
+ path. However, any internal storage for those lines/curves is retained,
+ making reuse of the path potentially faster.
+ On Android, does not change fSourcePath.
+ */
+SK_API void sk_path_rewind (sk_path_t* cpath);
+
SK_C_PLUS_PLUS_END_GUARD
#endif
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_patheffect_DEFINED
+#define sk_patheffect_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+SK_API void sk_path_effect_unref(sk_path_effect_t* t);
+SK_API sk_path_effect_t* sk_path_effect_create_compose(sk_path_effect_t* outer, sk_path_effect_t* inner);
+SK_API sk_path_effect_t* sk_path_effect_create_sum(sk_path_effect_t* first, sk_path_effect_t* second);
+SK_API sk_path_effect_t* sk_path_effect_create_discrete(float segLength, float deviation, uint32_t seedAssist /*0*/);
+SK_API sk_path_effect_t* sk_path_effect_create_corner(float radius);
+SK_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_API sk_path_effect_t* sk_path_effect_create_2d_line(float width, const sk_matrix_t* matrix);
+SK_API sk_path_effect_t* sk_path_effect_create_2d_path(const sk_matrix_t* matrix, const sk_path_t* path);
+SK_API sk_path_effect_t* sk_path_effect_create_dash(const float intervals[], int count, float phase);
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
SK_API void sk_shader_ref(sk_shader_t*);
SK_API void sk_shader_unref(sk_shader_t*);
-typedef enum {
- CLAMP_SK_SHADER_TILEMODE,
- REPEAT_SK_SHADER_TILEMODE,
- MIRROR_SK_SHADER_TILEMODE,
-} sk_shader_tilemode_t;
-
/**
Returns a shader that generates a linear gradient between the two
specified points.
sk_shader_tilemode_t tileMode,
const sk_matrix_t* localMatrix);
+/**
+ Call this to create a new "empty" shader, that will not draw anything.
+*/
+SK_API sk_shader_t* sk_shader_new_empty();
+/**
+ Call this to create a new shader that just draws the specified color. This should always
+ draw the same as a paint with this color (and no shader).
+*/
+SK_API sk_shader_t* sk_shader_new_color(sk_color_t color);
+/**
+ Call this to create a new shader that will draw with the specified bitmap.
+
+ If the bitmap cannot be used (e.g. has no pixels, or its dimensions
+ exceed implementation limits (currently at 64K - 1)) then SkEmptyShader
+ may be returned.
+
+ @param src The bitmap to use inside the shader
+ @param tmx The tiling mode to use when sampling the bitmap in the x-direction.
+ @param tmy The tiling mode to use when sampling the bitmap in the y-direction.
+*/
+SK_API sk_shader_t* sk_shader_new_bitmap(const sk_bitmap_t* src,
+ sk_shader_tilemode_t tmx,
+ sk_shader_tilemode_t tmy,
+ const sk_matrix_t* localMatrix);
+SK_API sk_shader_t* sk_shader_new_picture(sk_picture_t* src,
+ sk_shader_tilemode_t tmx,
+ sk_shader_tilemode_t tmy,
+ const sk_matrix_t* localMatrix,
+ const sk_rect_t* tile);
+/**
+ Return a shader that will apply the specified localMatrix to the proxy shader.
+ The specified matrix will be applied before any matrix associated with the proxy.
+
+ Note: ownership of the proxy is not transferred (though a ref is taken).
+*/
+SK_API sk_shader_t* sk_shader_new_local_matrix(sk_shader_t* proxy,
+ const sk_matrix_t* localMatrix);
+SK_API sk_shader_t* sk_shader_new_color_filter(sk_shader_t* proxy,
+ sk_colorfilter_t* filter);
+SK_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_API sk_shader_t* sk_shader_new_perlin_noise_turbulence(
+ float baseFrequencyX,
+ float baseFrequencyY,
+ int numOctaves,
+ float seed,
+ const sk_isize_t* tileSize);
+SK_API sk_shader_t* sk_shader_new_compose(
+ sk_shader_t* shaderA,
+ sk_shader_t* shaderB);
+SK_API sk_shader_t* sk_shader_new_compose_with_mode(
+ sk_shader_t* shaderA,
+ sk_shader_t* shaderB,
+ sk_xfermode_mode_t mode);
+
SK_C_PLUS_PLUS_END_GUARD
#endif
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_stream_DEFINED
+#define sk_stream_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+SK_API void sk_stream_asset_destroy(sk_stream_asset_t* cstream);
+
+////////////////////////////////////////////////////////////////////////////////
+
+SK_API sk_stream_filestream_t* sk_filestream_new(const char* path);
+SK_API void sk_filestream_destroy(sk_stream_filestream_t* cstream);
+
+////////////////////////////////////////////////////////////////////////////////
+
+SK_API sk_stream_memorystream_t* sk_memorystream_new();
+SK_API sk_stream_memorystream_t* sk_memorystream_new_with_length(size_t length);
+SK_API sk_stream_memorystream_t* sk_memorystream_new_with_data(const void* data, size_t length, bool copyData);
+SK_API sk_stream_memorystream_t* sk_memorystream_new_with_skdata(sk_data_t* data);
+SK_API void sk_memorystream_set_memory(sk_stream_memorystream_t* cmemorystream, const void* data, size_t length, bool copyData);
+SK_API void sk_memorystream_destroy(sk_stream_memorystream_t* cstream);
+
+////////////////////////////////////////////////////////////////////////////////
+
+SK_API size_t sk_stream_read(sk_stream_t* cstream, void* buffer, size_t size);
+SK_API size_t sk_stream_skip(sk_stream_t* cstream, size_t size);
+SK_API bool sk_stream_is_at_end(sk_stream_t* cstream);
+SK_API int8_t sk_stream_read_s8(sk_stream_t* cstream);
+SK_API int16_t sk_stream_read_s16(sk_stream_t* cstream);
+SK_API int32_t sk_stream_read_s32(sk_stream_t* cstream);
+SK_API uint8_t sk_stream_read_u8(sk_stream_t* cstream);
+SK_API uint16_t sk_stream_read_u16(sk_stream_t* cstream);
+SK_API uint32_t sk_stream_read_u32(sk_stream_t* cstream);
+SK_API bool sk_stream_read_bool(sk_stream_t* cstream);
+SK_API bool sk_stream_rewind(sk_stream_t* cstream);
+SK_API bool sk_stream_has_position(sk_stream_t* cstream);
+SK_API size_t sk_stream_get_position(sk_stream_t* cstream);
+SK_API bool sk_stream_seek(sk_stream_t* cstream, size_t position);
+SK_API bool sk_stream_move(sk_stream_t* cstream, long offset);
+SK_API bool sk_stream_has_length(sk_stream_t* cstream);
+SK_API size_t sk_stream_get_length(sk_stream_t* cstream);
+
+////////////////////////////////////////////////////////////////////////////////
+
+SK_API sk_wstream_filestream_t* sk_filewstream_new(const char* path);
+SK_API void sk_filewstream_destroy(sk_wstream_filestream_t* cstream);
+
+SK_API sk_wstream_dynamicmemorystream_t* sk_dynamicmemorywstream_new();
+SK_API sk_data_t* sk_dynamicmemorywstream_copy_to_data(sk_wstream_dynamicmemorystream_t* cstream);
+SK_API sk_stream_asset_t* sk_dynamicmemorywstream_detach_as_stream(sk_wstream_dynamicmemorystream_t* cstream);
+SK_API void sk_dynamicmemorywstream_destroy(sk_wstream_dynamicmemorystream_t* cstream);
+
+////////////////////////////////////////////////////////////////////////////////
+
+SK_API bool sk_wstream_write(sk_wstream_t* cstream, const void* buffer, size_t size);
+SK_API void sk_wstream_newline(sk_wstream_t* cstream);
+SK_API void sk_wstream_flush(sk_wstream_t* cstream);
+SK_API size_t sk_wstream_bytes_written(sk_wstream_t* cstream);
+SK_API bool sk_wstream_write_8(sk_wstream_t* cstream, uint8_t value);
+SK_API bool sk_wstream_write_16(sk_wstream_t* cstream, uint16_t value);
+SK_API bool sk_wstream_write_32(sk_wstream_t* cstream, uint32_t value);
+SK_API bool sk_wstream_write_text(sk_wstream_t* cstream, const char* value);
+SK_API bool sk_wstream_write_dec_as_text(sk_wstream_t* cstream, int32_t value);
+SK_API bool sk_wstream_write_bigdec_as_text(sk_wstream_t* cstream, int64_t value, int minDigits);
+SK_API bool sk_wstream_write_hex_as_text(sk_wstream_t* cstream, uint32_t value, int minDigits);
+SK_API bool sk_wstream_write_scalar_as_text(sk_wstream_t* cstream, float value);
+SK_API bool sk_wstream_write_bool(sk_wstream_t* cstream, bool value);
+SK_API bool sk_wstream_write_scalar(sk_wstream_t* cstream, float value);
+SK_API bool sk_wstream_write_packed_uint(sk_wstream_t* cstream, size_t value);
+SK_API bool sk_wstream_write_stream(sk_wstream_t* cstream, sk_stream_t* input, size_t length);
+SK_API int sk_wstream_get_size_of_packed_uint(size_t value);
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_string_DEFINED
+#define sk_string_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+/**
+ Returns a new empty sk_string_t. This call must be balanced with a call to
+ sk_string_destructor().
+*/
+SK_API sk_string_t* sk_string_new_empty();
+/**
+ Returns a new sk_string_t by copying the specified source string, encoded in UTF-8.
+ This call must be balanced with a call to sk_string_destructor().
+*/
+SK_API sk_string_t* sk_string_new_with_copy(const char* src, size_t length);
+
+/**
+ Deletes the string.
+*/
+SK_API void sk_string_destructor(const sk_string_t*);
+
+/**
+ Returns the number of bytes stored in the UTF 8 string. Note that this is the number of bytes, not characters.
+*/
+SK_API size_t sk_string_get_size(const sk_string_t*);
+/**
+ Returns the pointer to the string.
+ */
+SK_API const char* sk_string_get_c_str(const sk_string_t*);
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
SK_C_PLUS_PLUS_BEGIN_GUARD
+/**
+ Return the default sk_colortype_t; this is operating-system dependent.
+*/
+SK_API sk_colortype_t sk_colortype_get_default_8888();
+
/**
Return a new surface, with the memory for the pixels automatically
allocated. If the requested surface cannot be created, or the
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_typeface_DEFINED
+#define sk_typeface_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+SK_API sk_typeface_t* sk_typeface_create_from_name(const char *familyName, sk_typeface_style_t style);
+SK_API sk_typeface_t* sk_typeface_create_from_name_with_font_style(const char *familyName, int weight, int width, sk_font_style_slant_t slant);
+SK_API void sk_typeface_unref(sk_typeface_t*);
+SK_API sk_typeface_t* sk_typeface_create_from_typeface(sk_typeface_t* typeface, sk_typeface_style_t sstyle);
+SK_API sk_typeface_t* sk_typeface_create_from_file(const char* path, int index);
+SK_API sk_typeface_t* sk_typeface_create_from_stream(sk_stream_asset_t* stream, int index);
+SK_API int sk_typeface_chars_to_glyphs(sk_typeface_t* typeface, const char *chars, sk_encoding_t encoding, uint16_t glyphs[], int glyphCount);
+
+SK_API sk_string_t* sk_typeface_get_family_name(sk_typeface_t* typeface);
+
+SK_API int sk_typeface_count_tables(sk_typeface_t* typeface);
+SK_API int sk_typeface_get_table_tags(sk_typeface_t* typeface, sk_font_table_tag_t tags[]);
+SK_API size_t sk_typeface_get_table_size(sk_typeface_t* typeface, sk_font_table_tag_t tag);
+SK_API size_t sk_typeface_get_table_data(sk_typeface_t* typeface, sk_font_table_tag_t tag, size_t offset, size_t length, void* data);
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
BGR_V_SK_PIXELGEOMETRY,
} sk_pixelgeometry_t;
-/**
- Return the default sk_colortype_t; this is operating-system dependent.
-*/
-SK_API sk_colortype_t sk_colortype_get_default_8888();
-
typedef struct sk_colorspace_t sk_colorspace_t;
typedef struct {
//////////////////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ float x;
+ float y;
+ float z;
+} sk_point3_t;
+
+typedef struct {
+ float x;
+ float y;
+} sk_ipoint_t;
+
+typedef struct {
+ float w;
+ float h;
+} sk_size_t;
+
+typedef struct {
+ float w;
+ float h;
+} sk_isize_t;
+
+typedef struct {
+ uint32_t fFlags; // Bit field to identify which values are unknown
+ float fTop; // The greatest distance above the baseline for any glyph (will be <= 0)
+ float fAscent; // The recommended distance above the baseline (will be <= 0)
+ float fDescent; // The recommended distance below the baseline (will be >= 0)
+ float fBottom; // The greatest distance below the baseline for any glyph (will be >= 0)
+ float fLeading; // The recommended distance to add between lines of text (will be >= 0)
+ float fAvgCharWidth; // the average character width (>= 0)
+ float fMaxCharWidth; // the max character width (>= 0)
+ float fXMin; // The minimum bounding box x value for all glyphs
+ float fXMax; // The maximum bounding box x value for all glyphs
+ float fXHeight; // The height of an 'x' in px, or 0 if no 'x' in face
+ float fCapHeight; // The cap height (> 0), or 0 if cannot be determined.
+ float fUnderlineThickness; // underline thickness, or 0 if cannot be determined
+ float fUnderlinePosition; // underline position, or 0 if cannot be determined
+} sk_fontmetrics_t;
+
+// Flags for fFlags member of sk_fontmetrics_t
+#define FONTMETRICS_FLAGS_UNDERLINE_THICKNESS_IS_VALID (1U << 0)
+#define FONTMETRICS_FLAGS_UNDERLINE_POSITION_IS_VALID (1U << 1)
+
+/**
+ A lightweight managed string.
+*/
+typedef struct sk_string_t sk_string_t;
+/**
+
+ A sk_bitmap_t is an abstraction that specifies a raster bitmap.
+*/
+typedef struct sk_bitmap_t sk_bitmap_t;
+typedef struct sk_colorfilter_t sk_colorfilter_t;
+typedef struct sk_imagefilter_t sk_imagefilter_t;
+typedef struct sk_imagefilter_croprect_t sk_imagefilter_croprect_t;
+/**
+ A sk_typeface_t pecifies the typeface and intrinsic style of a font.
+ This is used in the paint, along with optionally algorithmic settings like
+ textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specify
+ how text appears when drawn (and measured).
+
+ Typeface objects are immutable, and so they can be shared between threads.
+*/
+typedef struct sk_typeface_t sk_typeface_t;
+typedef uint32_t sk_font_table_tag_t;
+/**
+ * Abstraction layer directly on top of an image codec.
+ */
+typedef struct sk_codec_t sk_codec_t;
+typedef struct sk_colorspace_t sk_colorspace_t;
+/**
+ Various stream types
+*/
+typedef struct sk_stream_t sk_stream_t;
+typedef struct sk_stream_filestream_t sk_stream_filestream_t;
+typedef struct sk_stream_asset_t sk_stream_asset_t;
+typedef struct sk_stream_memorystream_t sk_stream_memorystream_t;
+typedef struct sk_stream_streamrewindable_t sk_stream_streamrewindable_t;
+typedef struct sk_wstream_t sk_wstream_t;
+typedef struct sk_wstream_filestream_t sk_wstream_filestream_t;
+typedef struct sk_wstream_dynamicmemorystream_t sk_wstream_dynamicmemorystream_t;
+/**
+ High-level API for creating a document-based canvas.
+*/
+typedef struct sk_document_t sk_document_t;
+
+typedef enum {
+ UTF8_ENCODING,
+ UTF16_ENCODING,
+ UTF32_ENCODING
+} sk_encoding_t;
+
+typedef enum {
+ POINTS_SK_POINT_MODE,
+ LINES_SK_POINT_MODE,
+ POLYGON_SK_POINT_MODE
+} sk_point_mode_t;
+
+typedef enum {
+ LEFT_SK_TEXT_ALIGN,
+ CENTER_SK_TEXT_ALIGN,
+ RIGHT_SK_TEXT_ALIGN
+} sk_text_align_t;
+
+typedef enum {
+ UTF8_SK_TEXT_ENCODING,
+ UTF16_SK_TEXT_ENCODING,
+ UTF32_SK_TEXT_ENCODING,
+ GLYPH_ID_SK_TEXT_ENCODING
+} sk_text_encoding_t;
+
+typedef enum {
+ WINDING_SK_PATH_FILLTYPE,
+ EVENODD_SK_PATH_FILLTYPE,
+ INVERSE_WINDING_SK_PATH_FILLTYPE,
+ INVERSE_EVENODD_SK_PATH_FILLTYPE,
+} sk_path_filltype_t;
+
+typedef enum {
+ NORMAL_TYPEFACE_STYLE = 0,
+ BOLD_TYPEFACE_STYLE = 0x01,
+ ITALIC_TYPEFACE_STYLE = 0x02,
+ BOLD_ITALIC_TYPEFACE_STYLE = 0x03
+} sk_typeface_style_t;
+
+typedef enum {
+ UPRIGHT_SK_FONT_STYLE_SLANT = 0,
+ ITALIC_SK_FONT_STYLE_SLANT = 1,
+ OBLIQUE_SK_FONT_STYLE_SLANT = 2,
+} sk_font_style_slant_t;
+
+typedef enum {
+ NONE_SK_FILTER_QUALITY,
+ LOW_SK_FILTER_QUALITY,
+ MEDIUM_SK_FILTER_QUALITY,
+ HIGH_SK_FILTER_QUALITY
+} sk_filter_quality_t;
+
+typedef enum {
+ HAS_LEFT_SK_CROP_RECT_FLAG = 0x01,
+ HAS_TOP_SK_CROP_RECT_FLAG = 0x02,
+ HAS_WIDTH_SK_CROP_RECT_FLAG = 0x04,
+ HAS_HEIGHT_SK_CROP_RECT_FLAG = 0x08,
+ HAS_ALL_SK_CROP_RECT_FLAG = 0x0F,
+} sk_crop_rect_flags_t;
+
+typedef enum {
+ DRAW_SHADOW_AND_FOREGROUND_SK_DROP_SHADOW_IMAGE_FILTER_SHADOW_MODE,
+ DRAW_SHADOW_ONLY_SK_DROP_SHADOW_IMAGE_FILTER_SHADOW_MODE,
+} sk_drop_shadow_image_filter_shadow_mode_t;
+
+typedef enum {
+ UNKNOWN_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE,
+ R_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE,
+ G_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE,
+ B_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE,
+ A_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE,
+} sk_displacement_map_effect_channel_selector_type_t;
+
+typedef enum {
+ UNKNOWN_SK_IMAGE_ENCODER_TYPE,
+ BMP_SK_IMAGE_ENCODER_TYPE,
+ GIF_SK_IMAGE_ENCODER_TYPE,
+ ICO_SK_IMAGE_ENCODER_TYPE,
+ JPEG_SK_IMAGE_ENCODER_TYPE,
+ PNG_SK_IMAGE_ENCODER_TYPE,
+ WBMP_SK_IMAGE_ENCODER_TYPE,
+ WEBP_SK_IMAGE_ENCODER_TYPE,
+ KTX_SK_IMAGE_ENCODER_TYPE,
+} sk_image_encoder_t;
+
+typedef enum {
+ CLAMP_SK_MATRIX_CONVOLUTION_TILEMODE,
+ REPEAT_SK_MATRIX_CONVOLUTION_TILEMODE,
+ CLAMP_TO_BLACK_SK_MATRIX_CONVOLUTION_TILEMODE,
+} sk_matrix_convolution_tilemode_t;
+
+/**
+ The logical operations that can be performed when combining two regions.
+*/
+typedef enum {
+ DIFFERENCE_SK_REGION_OP, //!< subtract the op region from the first region
+ INTERSECT_SK_REGION_OP, //!< intersect the two regions
+ UNION_SK_REGION_OP, //!< union (inclusive-or) the two regions
+ XOR_SK_REGION_OP, //!< exclusive-or the two regions
+ REVERSE_DIFFERENCE_SK_REGION_OP, //!< subtract the first region from the op region
+ REPLACE_SK_REGION_OP, //!< replace the dst region with the op region
+} sk_region_op_t;
+
+/**
+ * Enum describing format of encoded data.
+ */
+typedef enum {
+ UNKNOWN_SK_ENCODED_FORMAT,
+ BMP_SK_ENCODED_FORMAT,
+ GIF_SK_ENCODED_FORMAT,
+ ICO_SK_ENCODED_FORMAT,
+ JPEG_SK_ENCODED_FORMAT,
+ PNG_SK_ENCODED_FORMAT,
+ WBMP_SK_ENCODED_FORMAT,
+ WEBP_SK_ENCODED_FORMAT,
+ PKM_SK_ENCODED_FORMAT,
+ KTX_SK_ENCODED_FORMAT,
+ ASTC_SK_ENCODED_FORMAT,
+ DNG_SK_ENCODED_FORMAT
+} sk_encoded_format_t;
+
+typedef enum {
+ TOP_LEFT_SK_CODEC_ORIGIN = 1, // Default
+ TOP_RIGHT_SK_CODEC_ORIGIN = 2, // Reflected across y-axis
+ BOTTOM_RIGHT_SK_CODEC_ORIGIN = 3, // Rotated 180
+ BOTTOM_LEFT_SK_CODEC_ORIGIN = 4, // Reflected across x-axis
+ LEFT_TOP_SK_CODEC_ORIGIN = 5, // Reflected across x-axis, Rotated 90 CCW
+ RIGHT_TOP_SK_CODEC_ORIGIN = 6, // Rotated 90 CW
+ RIGHT_BOTTOM_SK_CODEC_ORIGIN = 7, // Reflected across x-axis, Rotated 90 CW
+ LEFT_BOTTOM_SK_CODEC_ORIGIN = 8, // Rotated 90 CCW
+} sk_codec_origin_t;
+
+typedef enum {
+ SUCCESS_SK_CODEC_RESULT,
+ INCOMPLETE_INPUT_SK_CODEC_RESULT,
+ INVALID_CONVERSION_SK_CODEC_RESULT,
+ INVALID_SCALE_SK_CODEC_RESULT,
+ INVALID_PARAMETERS_SK_CODEC_RESULT,
+ INVALID_INPUT_SK_CODEC_RESULT,
+ COULD_NOT_REWIND_SK_CODEC_RESULT,
+ UNIMPLEMENTED_SK_CODEC_RESULT,
+} sk_codec_result_t;
+
+typedef enum {
+ YES_SK_CODEC_ZERO_INITIALIZED,
+ NO_SK_CODEC_ZERO_INITIALIZED,
+} sk_codec_zero_initialized_t;
+
+typedef struct {
+ sk_codec_zero_initialized_t fZeroInitialized;
+ sk_irect_t fSubset;
+ bool fHasSubset;
+} sk_codec_options_t;
+
+// The verbs that can be foudn on a path
+typedef enum {
+ MOVE_SK_PATH_VERB,
+ LINE_SK_PATH_VERB,
+ QUAD_SK_PATH_VERB,
+ CONIC_SK_PATH_VERB,
+ CUBIC_SK_PATH_VERB,
+ CLOSE_SK_PATH_VERB,
+ DONE_SK_PATH_VERB
+} sk_path_verb_t;
+
+typedef struct sk_path_iterator_t sk_path_iterator_t;
+typedef struct sk_path_rawiterator_t sk_path_rawiterator_t;
+
+typedef enum {
+ APPEND_SK_PATH_ADD_MODE,
+ EXTEND_SK_PATH_ADD_MODE,
+} sk_path_add_mode_t;
+
+typedef enum {
+ TRANSLATE_SK_PATH_EFFECT_1D_STYLE,
+ ROTATE_SK_PATH_EFFECT_1D_STYLE,
+ MORPH_SK_PATH_EFFECT_1D_STYLE,
+} sk_path_effect_1d_style_t;
+
+typedef struct sk_path_effect_t sk_path_effect_t;
+
+typedef enum {
+ BUTT_SK_STROKE_CAP,
+ ROUND_SK_STROKE_CAP,
+ SQUARE_SK_STROKE_CAP
+} sk_stroke_cap_t;
+
+typedef enum {
+ MITER_SK_STROKE_JOIN,
+ ROUND_SK_STROKE_JOIN,
+ BEVEL_SK_STROKE_JOIN
+} sk_stroke_join_t;
+
+typedef enum {
+ CLAMP_SK_SHADER_TILEMODE,
+ REPEAT_SK_SHADER_TILEMODE,
+ MIRROR_SK_SHADER_TILEMODE,
+} sk_shader_tilemode_t;
+
+typedef enum {
+ NORMAL_SK_BLUR_STYLE, //!< fuzzy inside and outside
+ SOLID_SK_BLUR_STYLE, //!< solid inside, fuzzy outside
+ OUTER_SK_BLUR_STYLE, //!< nothing inside, fuzzy outside
+ INNER_SK_BLUR_STYLE, //!< fuzzy inside, nothing outside
+} sk_blurstyle_t;
+
+typedef enum {
+ CW_SK_PATH_DIRECTION,
+ CCW_SK_PATH_DIRECTION,
+} sk_path_direction_t;
+
SK_C_PLUS_PLUS_END_GUARD
#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_bitmap_DEFINED
-#define sk_x_bitmap_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API void sk_bitmap_destructor(sk_bitmap_t* cbitmap);
-SK_API sk_bitmap_t* sk_bitmap_new();
-SK_API void sk_bitmap_get_info(sk_bitmap_t* cbitmap, sk_imageinfo_t* info);
-SK_API void* sk_bitmap_get_pixels(sk_bitmap_t* cbitmap, size_t* length);
-SK_API size_t sk_bitmap_get_row_bytes(sk_bitmap_t* cbitmap);
-SK_API size_t sk_bitmap_get_byte_count(sk_bitmap_t* cbitmap);
-SK_API void sk_bitmap_reset(sk_bitmap_t* cbitmap);
-SK_API bool sk_bitmap_is_null(sk_bitmap_t* cbitmap);
-SK_API bool sk_bitmap_is_immutable(sk_bitmap_t* cbitmap);
-SK_API void sk_bitmap_set_immutable(sk_bitmap_t* cbitmap);
-SK_API bool sk_bitmap_is_volatile(sk_bitmap_t* cbitmap);
-SK_API void sk_bitmap_set_volatile(sk_bitmap_t* cbitmap, bool value);
-SK_API void sk_bitmap_erase(sk_bitmap_t* cbitmap, sk_color_t color);
-SK_API void sk_bitmap_erase_rect(sk_bitmap_t* cbitmap, sk_color_t color, sk_irect_t* rect);
-SK_API sk_color_t sk_bitmap_get_pixel_color(sk_bitmap_t* cbitmap, int x, int y);
-SK_API void sk_bitmap_set_pixel_color(sk_bitmap_t* cbitmap, int x, int y, sk_color_t color);
-SK_API bool sk_bitmap_copy(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, sk_colortype_t ct);
-SK_API bool sk_bitmap_can_copy_to(sk_bitmap_t* cbitmap, sk_colortype_t ct);
-SK_API void sk_bitmap_lock_pixels(sk_bitmap_t* cbitmap);
-SK_API void sk_bitmap_unlock_pixels(sk_bitmap_t* cbitmap);
-SK_API void sk_bitmap_get_pixel_colors(sk_bitmap_t* cbitmap, sk_color_t* colors);
-SK_API void sk_bitmap_set_pixel_colors(sk_bitmap_t* cbitmap, const sk_color_t* colors);
-SK_API bool sk_bitmap_try_alloc_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, size_t rowBytes);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_canvas_DEFINED
-#define sk_x_canvas_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API void sk_canvas_clear(sk_canvas_t*, sk_color_t);
-/**
- This makes the contents of the canvas undefined. Subsequent calls that
- require reading the canvas contents will produce undefined results. Examples
- include blending and readPixels. The actual implementation is backend-
- dependent and one legal implementation is to do nothing. Like clear(), this
- ignores the clip.
-
- This function should only be called if the caller intends to subsequently
- draw to the canvas. The canvas may do real work at discard() time in order
- to optimize performance on subsequent draws. Thus, if you call this and then
- never draw to the canvas subsequently you may pay a perfomance penalty.
-*/
-SK_API void sk_canvas_discard(sk_canvas_t*);
-/**
- Returns the number of matrix/clip states on the SkCanvas' private stack.
- This will equal # save() calls - # restore() calls + 1. The save count on
- a new canvas is 1.
-*/
-SK_API int sk_canvas_get_save_count(sk_canvas_t*);
-/**
- Efficient way to pop any calls to sk_canvas_save() that happened after the save
- count reached saveCount. It is an error for saveCount to be greater than
- getSaveCount(). To pop all the way back to the initial matrix/clip context
- pass saveCount == 1.
-*/
-SK_API void sk_canvas_restore_to_count(sk_canvas_t*, int saveCount);
-/**
- Draws with the specified color and mode.
-**/
-SK_API void sk_canvas_draw_color(sk_canvas_t* ccanvas, sk_color_t color, sk_xfermode_mode_t mode);
-/**
- Draw a series of points, interpreted based on the sk_point_mode_t mode. For
- all modes, the count parameter is interpreted as the total number of
- points. For LINES_SK_POINT_MODE mode, count/2 line segments are drawn.
- For POINTS_SK_POINT_MODE mode, each point is drawn centered at its coordinate, and its
- size is specified by the paint's stroke-width. It draws as a square,
- unless the paint's cap-type is round, in which the points are drawn as
- circles.
- For LINES_SK_POINT_MODE mode, each pair of points is drawn as a line segment,
- respecting the paint's settings for cap/join/width.
- For POLYGON_SK_POINT_MODE mode, the entire array is drawn as a series of connected
- line segments.
- Note that, while similar, LINES_SK_POINT_MODE and POLYGON_SK_POINT_MODE modes draw slightly
- differently than the equivalent path built with a series of moveto,
- lineto calls, in that the path will draw all of its contours at once,
- with no interactions if contours intersect each other (think XOR
- xfermode). sk_canvas_draw_paint always draws each element one at a time.
-*/
-SK_API void sk_canvas_draw_points(sk_canvas_t*, sk_point_mode_t, size_t, const sk_point_t[], const sk_paint_t*);
-/**
- Draws a single point with the specified paint
-*/
-SK_API void sk_canvas_draw_point(sk_canvas_t*, float, float, const sk_paint_t*);
-/**
- Draws a single point with the specified paint
-*/
-SK_API void sk_canvas_draw_point_color(sk_canvas_t*, float, float, sk_color_t);
-/**
- Draws a line from x0,y0 to x1,y1
-*/
-SK_API void sk_canvas_draw_line(sk_canvas_t* ccanvas, float x0, float y0, float x1, float y1, sk_paint_t* cpaint);
-/**
- Draw the text, with origin at (x,y), using the specified paint.
- The origin is interpreted based on the Align setting in the paint.
-
- @param text The text to be drawn
- @param byteLength The number of bytes to read from the text parameter
- @param x The x-coordinate of the origin of the text being drawn
- @param y The y-coordinate of the origin of the text being drawn
- @param paint The paint used for the text (e.g. color, size, style)
-*/
-SK_API void sk_canvas_draw_text (sk_canvas_t*, const char *text, size_t byteLength, float x, float y, const sk_paint_t* paint);
-/**
- Draw the text, with each character/glyph origin specified by the pos[]
- array. The origin is interpreted by the Align setting in the paint.
- @param text The text to be drawn
- @param byteLength The number of bytes to read from the text parameter
- @param pos Array of positions, used to position each character
- @param paint The paint used for the text (e.g. color, size, style)
-*/
-SK_API void sk_canvas_draw_pos_text (sk_canvas_t*, const char *text, size_t byteLength, const sk_point_t[], const sk_paint_t* paint);
-SK_API void sk_canvas_draw_text_on_path (sk_canvas_t*, const char *text, size_t byteLength, const sk_path_t*path, float hOffset, float vOffset, const sk_paint_t* paint);
-SK_API void sk_canvas_draw_bitmap(sk_canvas_t* ccanvas, const sk_bitmap_t* cbitmap, float x, float y, const sk_paint_t* cpaint);
-SK_API void sk_canvas_draw_bitmap_rect(sk_canvas_t* ccanvas, const sk_bitmap_t* cbitmap, const sk_rect_t* csrcR, const sk_rect_t* cdstR, const sk_paint_t* cpaint);
-SK_API void sk_canvas_reset_matrix(sk_canvas_t* ccanvas);
-SK_API void sk_canvas_set_matrix(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix);
-SK_API void sk_canvas_get_total_matrix(sk_canvas_t* ccanvas, sk_matrix_t* cmatrix);
-/**
- Draw the specified rounded rectangle using the specified paint. The
- rectangle will be filled or stroked based on the style in the
- paint.
-*/
-SK_API void sk_canvas_draw_round_rect(sk_canvas_t*, const sk_rect_t*, float rx, float ry, const sk_paint_t*);
-/**
- Modify the current clip with the specified rectangle.
-*/
-SK_API void sk_canvas_clip_rect_with_operation(sk_canvas_t* t, const sk_rect_t* crect, sk_region_op_t op, bool doAA);
-/**
- Modify the current clip with the specified path.
-*/
-SK_API void sk_canvas_clip_path_with_operation(sk_canvas_t* t, const sk_path_t* crect, sk_region_op_t op, bool doAA);
-
-/** Return the bounds of the current clip (in local coordinates) in the
- bounds parameter, and return true if it is non-empty. This can be useful
- in a way similar to quickReject, in that it tells you that drawing
- outside of these bounds will be clipped out.
-*/
-SK_API bool sk_canvas_get_clip_bounds(sk_canvas_t* t, sk_rect_t* cbounds);
-/** Return the bounds of the current clip, in device coordinates; returns
- true if non-empty. Maybe faster than getting the clip explicitly and
- then taking its bounds.
-*/
-SK_API bool sk_canvas_get_clip_device_bounds(sk_canvas_t* t, sk_irect_t* cbounds);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_codec_DEFINED
-#define sk_x_codec_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API size_t sk_codec_min_buffered_bytes_needed();
-
-// TODO: png chunk reader
-SK_API sk_codec_t* sk_codec_new_from_stream(sk_stream_t* stream);
-SK_API sk_codec_t* sk_codec_new_from_data(sk_data_t* data);
-
-SK_API void sk_codec_destroy(sk_codec_t* codec);
-SK_API void sk_codec_get_info(sk_codec_t* codec, sk_imageinfo_t* info);
-SK_API sk_colorspace_t* sk_codec_get_color_space(sk_codec_t* codec);
-SK_API sk_codec_origin_t sk_codec_get_origin(sk_codec_t* codec);
-SK_API void sk_codec_get_scaled_dimensions(sk_codec_t* codec, float desiredScale, sk_isize_t* dimensions);
-SK_API void sk_codec_get_valid_subset(sk_codec_t* codec, sk_irect_t* desiredSubset);
-SK_API sk_encoded_format_t sk_codec_get_encoded_format(sk_codec_t* codec);
-SK_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_color_t ctable[], int* ctableCount);
-SK_API sk_codec_result_t sk_codec_get_pixels_using_defaults(sk_codec_t* codec, const sk_imageinfo_t* info, void* pixels, size_t rowBytes);
-
-// TODO color space
-// TODO: SK_API sk_encodedinfo_t sk_codec_get_encoded_info(sk_codec_t* codec);
-// TODO: more...
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_colorfilter_DEFINED
-#define sk_x_colorfilter_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API void sk_colorfilter_unref(sk_colorfilter_t* filter);
-SK_API sk_colorfilter_t* sk_colorfilter_new_mode(sk_color_t c, sk_xfermode_mode_t mode);
-SK_API sk_colorfilter_t* sk_colorfilter_new_lighting(sk_color_t mul, sk_color_t add);
-SK_API sk_colorfilter_t* sk_colorfilter_new_compose(sk_colorfilter_t* outer, sk_colorfilter_t* inner);
-SK_API sk_colorfilter_t* sk_colorfilter_new_color_cube(sk_data_t* cubeData, int cubeDimension);
-SK_API sk_colorfilter_t* sk_colorfilter_new_color_matrix(const float array[20]);
-SK_API sk_colorfilter_t* sk_colorfilter_new_luma_color();
-SK_API sk_colorfilter_t* sk_colorfilter_new_table(const uint8_t table[256]);
-SK_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
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_data_DEFINED
-#define sk_x_data_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API sk_data_t* sk_data_new_from_file(const char* path);
-SK_API sk_data_t* sk_data_new_from_stream(sk_stream_t* stream, size_t length);
-SK_API const uint8_t* sk_data_get_bytes(const sk_data_t*);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_document_DEFINED
-#define sk_x_document_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API void sk_document_unref(sk_document_t* document);
-
-SK_API sk_document_t* sk_document_create_pdf_from_stream(sk_wstream_t* stream, float dpi);
-SK_API sk_document_t* sk_document_create_pdf_from_filename(const char* path, float dpi);
-
-//SK_API sk_document_t* sk_document_create_xps_from_stream(sk_wstream_t* stream, float dpi);
-//SK_API sk_document_t* sk_document_create_xps_from_filename(const char* path, float dpi);
-
-SK_API sk_canvas_t* sk_document_begin_page(sk_document_t* document, float width, float height, const sk_rect_t* content);
-SK_API void sk_document_end_page(sk_document_t* document);
-SK_API bool sk_document_close(sk_document_t* document);
-SK_API void sk_document_abort(sk_document_t* document);
-
-// TODO: setMetadata
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_image_DEFINED
-#define sk_x_image_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- * Encode the image's pixels using the specified format and quality
- * and return the result as a new image in a
- * sk_data_t, which the caller must manage: call sk_data_unref() when
- * they are done.
- *
- * If the image type cannot be encoded, this will return NULL.
- */
-SK_API sk_data_t* sk_image_encode_specific(const sk_image_t* cimage, sk_image_encoder_t encoder, int quality);
-
-SK_API sk_image_t* sk_image_new_from_bitmap (const sk_bitmap_t *cbitmap);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_imagefilter_DEFINED
-#define sk_x_imagefilter_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API sk_imagefilter_croprect_t* sk_imagefilter_croprect_new();
-SK_API sk_imagefilter_croprect_t* sk_imagefilter_croprect_new_with_rect(const sk_rect_t* rect, uint32_t flags);
-SK_API void sk_imagefilter_croprect_destructor(sk_imagefilter_croprect_t* cropRect);
-SK_API void sk_imagefilter_croprect_get_rect(sk_imagefilter_croprect_t* cropRect, sk_rect_t* rect);
-SK_API uint32_t sk_imagefilter_croprect_get_flags(sk_imagefilter_croprect_t* cropRect);
-SK_API void sk_imagefilter_unref(sk_imagefilter_t*);
-SK_API sk_imagefilter_t* sk_imagefilter_new_matrix(
- const sk_matrix_t* matrix,
- sk_filter_quality_t quality,
- sk_imagefilter_t* input /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_alpha_threshold(
- const sk_irect_t* region,
- float innerThreshold,
- float outerThreshold,
- sk_imagefilter_t* input /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_blur(
- float sigmaX,
- float sigmaY,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_color_filter(
- sk_colorfilter_t* cf,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_compose(
- sk_imagefilter_t* outer,
- sk_imagefilter_t* inner);
-SK_API sk_imagefilter_t* sk_imagefilter_new_displacement_map_effect(
- sk_displacement_map_effect_channel_selector_type_t xChannelSelector,
- sk_displacement_map_effect_channel_selector_type_t yChannelSelector,
- float scale,
- sk_imagefilter_t* displacement,
- sk_imagefilter_t* color /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_drop_shadow(
- float dx,
- float dy,
- float sigmaX,
- float sigmaY,
- sk_color_t color,
- sk_drop_shadow_image_filter_shadow_mode_t shadowMode,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_distant_lit_diffuse(
- const sk_point3_t* direction,
- sk_color_t lightColor,
- float surfaceScale,
- float kd,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_point_lit_diffuse(
- const sk_point3_t* location,
- sk_color_t lightColor,
- float surfaceScale,
- float kd,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_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,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_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,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_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,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_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,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_magnifier(
- const sk_rect_t* src,
- float inset,
- sk_imagefilter_t* input /*NULL*/);
-SK_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_matrix_convolution_tilemode_t tileMode,
- bool convolveAlpha,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_merge(
- sk_imagefilter_t* filters[],
- int count,
- const sk_xfermode_mode_t modes[] /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_dilate(
- int radiusX,
- int radiusY,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_erode(
- int radiusX,
- int radiusY,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_offset(
- float dx,
- float dy,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_picture(
- sk_picture_t* picture);
-SK_API sk_imagefilter_t* sk_imagefilter_new_picture_with_croprect(
- sk_picture_t* picture,
- const sk_rect_t* cropRect);
-SK_API sk_imagefilter_t* sk_imagefilter_new_picture_for_localspace(
- sk_picture_t* picture,
- const sk_rect_t* cropRect,
- sk_filter_quality_t filterQuality);
-SK_API sk_imagefilter_t* sk_imagefilter_new_rect_shader(
- sk_shader_t* shader,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-SK_API sk_imagefilter_t* sk_imagefilter_new_tile(
- const sk_rect_t* src,
- const sk_rect_t* dst,
- sk_imagefilter_t* input);
-SK_API sk_imagefilter_t* sk_imagefilter_new_xfermode(
- sk_xfermode_mode_t mode,
- sk_imagefilter_t* background,
- sk_imagefilter_t* foreground /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_maskfilter_DEFINED
-#define sk_x_maskfilter_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API sk_maskfilter_t* sk_maskfilter_new_emboss(
- float blurSigma,
- const float direction[3],
- float ambient,
- float specular);
-SK_API sk_maskfilter_t* sk_maskfilter_new_table(
- const uint8_t table[256]);
-SK_API sk_maskfilter_t* sk_maskfilter_new_gamma(
- float gamma);
-SK_API sk_maskfilter_t* sk_maskfilter_new_clip(
- uint8_t min,
- uint8_t max);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_paint_DEFINED
-#define sk_x_paint_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- Return true iff the paint has dithering enabled.
- */
-SK_API bool sk_paint_is_dither(const sk_paint_t*);
-/**
- Set to true to enable dithering, false to disable it on this
- sk_paint_t.
- */
-SK_API void sk_paint_set_dither(sk_paint_t*, bool);
-/**
- Return true iff the paint has verticaltext enabled.
- */
-SK_API bool sk_paint_is_verticaltext(const sk_paint_t*);
-/**
- Set to true to enable verticaltext, false to disable it on this
- sk_paint_t.
- */
-SK_API void sk_paint_set_verticaltext(sk_paint_t*, bool);
-SK_API sk_shader_t* sk_paint_get_shader(sk_paint_t*);
-SK_API sk_maskfilter_t* sk_paint_get_maskfilter(sk_paint_t*);
-SK_API void sk_paint_set_colorfilter(sk_paint_t*, sk_colorfilter_t*);
-SK_API sk_colorfilter_t* sk_paint_get_colorfilter(sk_paint_t*);
-SK_API void sk_paint_set_imagefilter(sk_paint_t*, sk_imagefilter_t*);
-SK_API sk_imagefilter_t* sk_paint_get_imagefilter(sk_paint_t*);
-SK_API sk_xfermode_mode_t sk_paint_get_xfermode_mode(sk_paint_t*);
-/**
- * Get or set the paint's filter quality.
-*/
-SK_API void sk_paint_set_filter_quality(sk_paint_t*, sk_filter_quality_t);
-SK_API sk_filter_quality_t sk_paint_get_filter_quality(sk_paint_t *);
-/**
- * Get the paint's typeface
- */
-SK_API sk_typeface_t* sk_paint_get_typeface(sk_paint_t*);
-/**
- * Set the paint's typeface
- */
-SK_API void sk_paint_set_typeface(sk_paint_t*, sk_typeface_t*);
-/**
- * Get the paint's text sixe
- */
-SK_API float sk_paint_get_textsize(sk_paint_t*);
-/**
- * Set the paint's text sixe
- */
-SK_API void sk_paint_set_textsize(sk_paint_t*, float);
-/**
- * Get the paint's text alignment
- */
-SK_API sk_text_align_t sk_paint_get_text_align(const sk_paint_t*);
-/**
- * Set the paint's text alignment
- */
-SK_API void sk_paint_set_text_align(sk_paint_t*, sk_text_align_t);
-/**
- * Get the paint's text encoding
- */
-SK_API sk_text_encoding_t sk_paint_get_text_encoding(const sk_paint_t*);
-/**
- * Set the paint's text encoding
- */
-SK_API void sk_paint_set_text_encoding(sk_paint_t*, sk_text_encoding_t);
-/**
- * Set the paint's horizontal scale factor for text
- */
-SK_API float sk_paint_get_text_scale_x(const sk_paint_t* cpaint);
-/**
- * Set the paint's horizontal scale factor for text
- */
-SK_API void sk_paint_set_text_scale_x(sk_paint_t* cpaint, float scale);
-/**
- * Set the paint's horizontal skew factor for text
- */
-SK_API float sk_paint_get_text_skew_x(const sk_paint_t* cpaint);
-/**
- * Set the paint's horizontal skew factor for text
- */
-SK_API void sk_paint_set_text_skew_x(sk_paint_t* cpaint, float skew);
-/**
- * Return the number of bytes of text that were measured
- */
-SK_API size_t sk_paint_break_text(const sk_paint_t* cpaint, const void* text, size_t length, float maxWidth, float* measuredWidth);
-/**
- * Return the width of the text
- */
-SK_API float sk_paint_measure_text(const sk_paint_t* cpaint, const void* text, size_t length, sk_rect_t* cbounds);
-/**
- * Get the path outline of text.
- */
-SK_API sk_path_t* sk_paint_get_text_path(sk_paint_t* cpaint, const void* text, size_t length, float x, float y);
-/**
- * Get the path outline of text with each glyph positioned.
- */
-SK_API sk_path_t* sk_paint_get_pos_text_path(sk_paint_t* cpaint, const void* text, size_t length, const sk_point_t pos[]);
-/**
- * Return the recommend spacing between lines (which will be fDescent - fAscent + fLeading).
- * Also get the font metrics for the current typeface and type size if cfontmetrics is not null.
- */
-SK_API float sk_paint_get_fontmetrics(sk_paint_t* cpaint, sk_fontmetrics_t* cfontmetrics, float scale);
-/**
- * Return the paint's patheffect object
- */
-SK_API sk_path_effect_t* sk_paint_get_path_effect(sk_paint_t* cpaint);
-/**
- * Sets the paint's patheffect object
- */
-SK_API void sk_paint_set_path_effect(sk_paint_t* cpaint, sk_path_effect_t* effect);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_path_DEFINED
-#define sk_x_path_DEFINED
-
-#include "sk_path.h"
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/** Set the beginning of the next contour relative to the last point on the
- previous contour. If there is no previous contour, this is treated the
- same as sk_path_move_to.
-*/
-SK_API void sk_path_rmove_to(sk_path_t*, float dx, float dy);
-/**
- Same as sk_path_line_to, but the coordinates are considered relative to the last
- point on this contour. If there is no previous point, then a sk_path_move_to(0,0)
- is inserted automatically.
-*/
-SK_API void sk_path_rline_to(sk_path_t*, float dx, float yd);
-/**
- Same as sk_path_quad_to, but the coordinates are considered relative to the last
- point on this contour. If there is no previous point, then a sk_path_move_to(0,0)
- is inserted automatically.
-*/
-SK_API void sk_path_rquad_to(sk_path_t*, float dx0, float dy0, float dx1, float dy1);
-/**
- Same as sk_path_conic_to, but the coordinates are considered relative to the last
- point on this contour. If there is no previous point, then a sk_path_move_to(0,0)
- is inserted automatically.
-*/
-SK_API void sk_path_rconic_to(sk_path_t*, float dx0, float dy0, float dx1, float dy1, float w);
-/**
- Same as sk_path_cubic_to, but the coordinates are considered relative to the last
- point on this contour. If there is no previous point, then a sk_path_move_to(0,0)
- is inserted automatically.
-*/
-SK_API void sk_path_rcubic_to(sk_path_t*,
- float dx0, float dy0,
- float dx1, float dy1,
- float dx2, float dy2);
-/**
- Add a closed rectangle contour to the path with an initial point of the contour
- (startIndex) expressed as a corner index (0-3)
- */
-SK_API void sk_path_add_rect_start(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir, uint32_t startIndex);
-/**
- Add the specified arc to the path as a new contour.
- */
-SK_API void sk_path_add_arc(sk_path_t* cpath, const sk_rect_t* crect, float startAngle, float sweepAngle);
-/**
- Get the fill type of the path.
-*/
-SK_API sk_path_filltype_t sk_path_get_filltype(sk_path_t*);
-/**
- Set the fill type of the path.
-*/
-SK_API void sk_path_set_filltype(sk_path_t*, sk_path_filltype_t);
-/**
- Transform the points in this path by matrix, and write the answer back into the path
-*/
-SK_API void sk_path_transform(sk_path_t* cpath, const sk_matrix_t* cmatrix);
-/**
- Creates a copy of the path
-*/
-SK_API sk_path_t* sk_path_clone(const sk_path_t* cpath);
-
-/* Iterators */
-SK_API sk_path_iterator_t* sk_path_create_iter (sk_path_t *cpath, int forceClose);
-
-SK_API sk_path_verb_t sk_path_iter_next (sk_path_iterator_t *iterator, sk_point_t points [4], int doConsumeDegenerates, int exact);
-
-SK_API float sk_path_iter_conic_weight (sk_path_iterator_t *iterator);
-
-SK_API int sk_path_iter_is_close_line (sk_path_iterator_t *iterator);
-
-SK_API int sk_path_iter_is_closed_contour (sk_path_iterator_t *iterator);
-
-SK_API void sk_path_iter_destroy (sk_path_iterator_t *iterator);
-
-/* Raw iterators */
-SK_API sk_path_rawiterator_t* sk_path_create_rawiter (sk_path_t *cpath);
-
-SK_API sk_path_verb_t sk_path_rawiter_peek (sk_path_rawiterator_t *iterator);
-
-SK_API sk_path_verb_t sk_path_rawiter_next (sk_path_rawiterator_t *iterator);
-
-SK_API float sk_path_rawiter_conic_weight (sk_path_rawiterator_t *iterator);
-
-SK_API void sk_path_rawiter_destroy (sk_path_rawiterator_t *iterator);
-
-/* Paths */
-
-/**
- Adds the @other path to the @cpath by appending a @dx, @dy offset to each node, using the specified adding mode in @add_mode
- */
-SK_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);
-/**
- Adds the @other path to the @cpath by applying the @matrix transformation on the @other, using the specified adding mode in @add_mode
- */
-SK_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);
-/**
- Adds the @other path to the @cpath using the specified adding mode in @add_mode
- */
-SK_API void sk_path_add_path (sk_path_t* cpath, sk_path_t* other, sk_path_add_mode_t add_mode);
-SK_API void sk_path_add_path_reverse (sk_path_t* cpath, sk_path_t* other);
-
-/**
- Clear any lines and curves from the path, making it empty. This frees up
- internal storage associated with those segments.
- On Android, does not change fSourcePath.
- */
-SK_API void sk_path_reset (sk_path_t* cpath);
-
-/**
- Similar to sk_path_reset (), in that all lines and curves are removed from the
- path. However, any internal storage for those lines/curves is retained,
- making reuse of the path potentially faster.
- On Android, does not change fSourcePath.
- */
-SK_API void sk_path_rewind (sk_path_t* cpath);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_patheffect_DEFINED
-#define sk_x_patheffect_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API void sk_path_effect_unref(sk_path_effect_t* t);
-SK_API sk_path_effect_t* sk_path_effect_create_compose(sk_path_effect_t* outer, sk_path_effect_t* inner);
-SK_API sk_path_effect_t* sk_path_effect_create_sum(sk_path_effect_t* first, sk_path_effect_t* second);
-SK_API sk_path_effect_t* sk_path_effect_create_discrete(float segLength, float deviation, uint32_t seedAssist /*0*/);
-SK_API sk_path_effect_t* sk_path_effect_create_corner(float radius);
-SK_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_API sk_path_effect_t* sk_path_effect_create_2d_line(float width, const sk_matrix_t* matrix);
-SK_API sk_path_effect_t* sk_path_effect_create_2d_path(const sk_matrix_t* matrix, const sk_path_t* path);
-SK_API sk_path_effect_t* sk_path_effect_create_dash(const float intervals[], int count, float phase);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_shader_DEFINED
-#define sk_x_shader_DEFINED
-
-#include "sk_shader.h"
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- Call this to create a new "empty" shader, that will not draw anything.
-*/
-SK_API sk_shader_t* sk_shader_new_empty();
-/**
- Call this to create a new shader that just draws the specified color. This should always
- draw the same as a paint with this color (and no shader).
-*/
-SK_API sk_shader_t* sk_shader_new_color(sk_color_t color);
-/**
- Call this to create a new shader that will draw with the specified bitmap.
-
- If the bitmap cannot be used (e.g. has no pixels, or its dimensions
- exceed implementation limits (currently at 64K - 1)) then SkEmptyShader
- may be returned.
-
- @param src The bitmap to use inside the shader
- @param tmx The tiling mode to use when sampling the bitmap in the x-direction.
- @param tmy The tiling mode to use when sampling the bitmap in the y-direction.
-*/
-SK_API sk_shader_t* sk_shader_new_bitmap(const sk_bitmap_t* src,
- sk_shader_tilemode_t tmx,
- sk_shader_tilemode_t tmy,
- const sk_matrix_t* localMatrix);
-SK_API sk_shader_t* sk_shader_new_picture(sk_picture_t* src,
- sk_shader_tilemode_t tmx,
- sk_shader_tilemode_t tmy,
- const sk_matrix_t* localMatrix,
- const sk_rect_t* tile);
-/**
- Return a shader that will apply the specified localMatrix to the proxy shader.
- The specified matrix will be applied before any matrix associated with the proxy.
-
- Note: ownership of the proxy is not transferred (though a ref is taken).
-*/
-SK_API sk_shader_t* sk_shader_new_local_matrix(sk_shader_t* proxy,
- const sk_matrix_t* localMatrix);
-SK_API sk_shader_t* sk_shader_new_color_filter(sk_shader_t* proxy,
- sk_colorfilter_t* filter);
-SK_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_API sk_shader_t* sk_shader_new_perlin_noise_turbulence(
- float baseFrequencyX,
- float baseFrequencyY,
- int numOctaves,
- float seed,
- const sk_isize_t* tileSize);
-SK_API sk_shader_t* sk_shader_new_compose(
- sk_shader_t* shaderA,
- sk_shader_t* shaderB);
-SK_API sk_shader_t* sk_shader_new_compose_with_mode(
- sk_shader_t* shaderA,
- sk_shader_t* shaderB,
- sk_xfermode_mode_t mode);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_stream_DEFINED
-#define sk_x_stream_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API void sk_stream_asset_destroy(sk_stream_asset_t* cstream);
-
-////////////////////////////////////////////////////////////////////////////////
-
-SK_API sk_stream_filestream_t* sk_filestream_new(const char* path);
-SK_API void sk_filestream_destroy(sk_stream_filestream_t* cstream);
-
-////////////////////////////////////////////////////////////////////////////////
-
-SK_API sk_stream_memorystream_t* sk_memorystream_new();
-SK_API sk_stream_memorystream_t* sk_memorystream_new_with_length(size_t length);
-SK_API sk_stream_memorystream_t* sk_memorystream_new_with_data(const void* data, size_t length, bool copyData);
-SK_API sk_stream_memorystream_t* sk_memorystream_new_with_skdata(sk_data_t* data);
-SK_API void sk_memorystream_set_memory(sk_stream_memorystream_t* cmemorystream, const void* data, size_t length, bool copyData);
-SK_API void sk_memorystream_destroy(sk_stream_memorystream_t* cstream);
-
-////////////////////////////////////////////////////////////////////////////////
-
-SK_API size_t sk_stream_read(sk_stream_t* cstream, void* buffer, size_t size);
-SK_API size_t sk_stream_skip(sk_stream_t* cstream, size_t size);
-SK_API bool sk_stream_is_at_end(sk_stream_t* cstream);
-SK_API int8_t sk_stream_read_s8(sk_stream_t* cstream);
-SK_API int16_t sk_stream_read_s16(sk_stream_t* cstream);
-SK_API int32_t sk_stream_read_s32(sk_stream_t* cstream);
-SK_API uint8_t sk_stream_read_u8(sk_stream_t* cstream);
-SK_API uint16_t sk_stream_read_u16(sk_stream_t* cstream);
-SK_API uint32_t sk_stream_read_u32(sk_stream_t* cstream);
-SK_API bool sk_stream_read_bool(sk_stream_t* cstream);
-SK_API bool sk_stream_rewind(sk_stream_t* cstream);
-SK_API bool sk_stream_has_position(sk_stream_t* cstream);
-SK_API size_t sk_stream_get_position(sk_stream_t* cstream);
-SK_API bool sk_stream_seek(sk_stream_t* cstream, size_t position);
-SK_API bool sk_stream_move(sk_stream_t* cstream, long offset);
-SK_API bool sk_stream_has_length(sk_stream_t* cstream);
-SK_API size_t sk_stream_get_length(sk_stream_t* cstream);
-
-////////////////////////////////////////////////////////////////////////////////
-
-SK_API sk_wstream_filestream_t* sk_filewstream_new(const char* path);
-SK_API void sk_filewstream_destroy(sk_wstream_filestream_t* cstream);
-
-SK_API sk_wstream_dynamicmemorystream_t* sk_dynamicmemorywstream_new();
-SK_API sk_data_t* sk_dynamicmemorywstream_copy_to_data(sk_wstream_dynamicmemorystream_t* cstream);
-SK_API sk_stream_asset_t* sk_dynamicmemorywstream_detach_as_stream(sk_wstream_dynamicmemorystream_t* cstream);
-SK_API void sk_dynamicmemorywstream_destroy(sk_wstream_dynamicmemorystream_t* cstream);
-
-////////////////////////////////////////////////////////////////////////////////
-
-SK_API bool sk_wstream_write(sk_wstream_t* cstream, const void* buffer, size_t size);
-SK_API void sk_wstream_newline(sk_wstream_t* cstream);
-SK_API void sk_wstream_flush(sk_wstream_t* cstream);
-SK_API size_t sk_wstream_bytes_written(sk_wstream_t* cstream);
-SK_API bool sk_wstream_write_8(sk_wstream_t* cstream, uint8_t value);
-SK_API bool sk_wstream_write_16(sk_wstream_t* cstream, uint16_t value);
-SK_API bool sk_wstream_write_32(sk_wstream_t* cstream, uint32_t value);
-SK_API bool sk_wstream_write_text(sk_wstream_t* cstream, const char* value);
-SK_API bool sk_wstream_write_dec_as_text(sk_wstream_t* cstream, int32_t value);
-SK_API bool sk_wstream_write_bigdec_as_text(sk_wstream_t* cstream, int64_t value, int minDigits);
-SK_API bool sk_wstream_write_hex_as_text(sk_wstream_t* cstream, uint32_t value, int minDigits);
-SK_API bool sk_wstream_write_scalar_as_text(sk_wstream_t* cstream, float value);
-SK_API bool sk_wstream_write_bool(sk_wstream_t* cstream, bool value);
-SK_API bool sk_wstream_write_scalar(sk_wstream_t* cstream, float value);
-SK_API bool sk_wstream_write_packed_uint(sk_wstream_t* cstream, size_t value);
-SK_API bool sk_wstream_write_stream(sk_wstream_t* cstream, sk_stream_t* input, size_t length);
-SK_API int sk_wstream_get_size_of_packed_uint(size_t value);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_string_DEFINED
-#define sk_x_string_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-/**
- Returns a new empty sk_string_t. This call must be balanced with a call to
- sk_string_destructor().
-*/
-SK_API sk_string_t* sk_string_new_empty();
-/**
- Returns a new sk_string_t by copying the specified source string, encoded in UTF-8.
- This call must be balanced with a call to sk_string_destructor().
-*/
-SK_API sk_string_t* sk_string_new_with_copy(const char* src, size_t length);
-
-/**
- Deletes the string.
-*/
-SK_API void sk_string_destructor(const sk_string_t*);
-
-/**
- Returns the number of bytes stored in the UTF 8 string. Note that this is the number of bytes, not characters.
-*/
-SK_API size_t sk_string_get_size(const sk_string_t*);
-/**
- Returns the pointer to the string.
- */
-SK_API const char* sk_string_get_c_str(const sk_string_t*);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_typeface_DEFINED
-#define sk_x_typeface_DEFINED
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-SK_API sk_typeface_t* sk_typeface_create_from_name(const char *familyName, sk_typeface_style_t style);
-SK_API sk_typeface_t* sk_typeface_create_from_name_with_font_style(const char *familyName, int weight, int width, sk_font_style_slant_t slant);
-SK_API void sk_typeface_unref(sk_typeface_t*);
-SK_API sk_typeface_t* sk_typeface_create_from_typeface(sk_typeface_t* typeface, sk_typeface_style_t sstyle);
-SK_API sk_typeface_t* sk_typeface_create_from_file(const char* path, int index);
-SK_API sk_typeface_t* sk_typeface_create_from_stream(sk_stream_asset_t* stream, int index);
-SK_API int sk_typeface_chars_to_glyphs(sk_typeface_t* typeface, const char *chars, sk_encoding_t encoding, uint16_t glyphs[], int glyphCount);
-
-SK_API sk_string_t* sk_typeface_get_family_name(sk_typeface_t* typeface);
-
-SK_API int sk_typeface_count_tables(sk_typeface_t* typeface);
-SK_API int sk_typeface_get_table_tags(sk_typeface_t* typeface, sk_font_table_tag_t tags[]);
-SK_API size_t sk_typeface_get_table_size(sk_typeface_t* typeface, sk_font_table_tag_t tag);
-SK_API size_t sk_typeface_get_table_data(sk_typeface_t* typeface, sk_font_table_tag_t tag, size_t offset, size_t length, void* data);
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_types_DEFINED
-#define sk_x_types_DEFINED
-
-#include "sk_types.h"
-
-SK_C_PLUS_PLUS_BEGIN_GUARD
-
-typedef struct {
- float x;
- float y;
- float z;
-} sk_point3_t;
-
-typedef struct {
- float x;
- float y;
-} sk_ipoint_t;
-
-typedef struct {
- float w;
- float h;
-} sk_size_t;
-
-typedef struct {
- float w;
- float h;
-} sk_isize_t;
-
-typedef struct {
- uint32_t fFlags; // Bit field to identify which values are unknown
- float fTop; // The greatest distance above the baseline for any glyph (will be <= 0)
- float fAscent; // The recommended distance above the baseline (will be <= 0)
- float fDescent; // The recommended distance below the baseline (will be >= 0)
- float fBottom; // The greatest distance below the baseline for any glyph (will be >= 0)
- float fLeading; // The recommended distance to add between lines of text (will be >= 0)
- float fAvgCharWidth; // the average character width (>= 0)
- float fMaxCharWidth; // the max character width (>= 0)
- float fXMin; // The minimum bounding box x value for all glyphs
- float fXMax; // The maximum bounding box x value for all glyphs
- float fXHeight; // The height of an 'x' in px, or 0 if no 'x' in face
- float fCapHeight; // The cap height (> 0), or 0 if cannot be determined.
- float fUnderlineThickness; // underline thickness, or 0 if cannot be determined
- float fUnderlinePosition; // underline position, or 0 if cannot be determined
-} sk_fontmetrics_t;
-
-// Flags for fFlags member of sk_fontmetrics_t
-#define FONTMETRICS_FLAGS_UNDERLINE_THICKNESS_IS_VALID (1U << 0)
-#define FONTMETRICS_FLAGS_UNDERLINE_POSITION_IS_VALID (1U << 1)
-
-/**
- A lightweight managed string.
-*/
-typedef struct sk_string_t sk_string_t;
-/**
-
- A sk_bitmap_t is an abstraction that specifies a raster bitmap.
-*/
-typedef struct sk_bitmap_t sk_bitmap_t;
-typedef struct sk_colorfilter_t sk_colorfilter_t;
-typedef struct sk_imagefilter_t sk_imagefilter_t;
-typedef struct sk_imagefilter_croprect_t sk_imagefilter_croprect_t;
-/**
- A sk_typeface_t pecifies the typeface and intrinsic style of a font.
- This is used in the paint, along with optionally algorithmic settings like
- textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specify
- how text appears when drawn (and measured).
-
- Typeface objects are immutable, and so they can be shared between threads.
-*/
-typedef struct sk_typeface_t sk_typeface_t;
-typedef uint32_t sk_font_table_tag_t;
-/**
- * Abstraction layer directly on top of an image codec.
- */
-typedef struct sk_codec_t sk_codec_t;
-typedef struct sk_colorspace_t sk_colorspace_t;
-/**
- Various stream types
-*/
-typedef struct sk_stream_t sk_stream_t;
-typedef struct sk_stream_filestream_t sk_stream_filestream_t;
-typedef struct sk_stream_asset_t sk_stream_asset_t;
-typedef struct sk_stream_memorystream_t sk_stream_memorystream_t;
-typedef struct sk_stream_streamrewindable_t sk_stream_streamrewindable_t;
-typedef struct sk_wstream_t sk_wstream_t;
-typedef struct sk_wstream_filestream_t sk_wstream_filestream_t;
-typedef struct sk_wstream_dynamicmemorystream_t sk_wstream_dynamicmemorystream_t;
-/**
- High-level API for creating a document-based canvas.
-*/
-typedef struct sk_document_t sk_document_t;
-
-typedef enum {
- UTF8_ENCODING,
- UTF16_ENCODING,
- UTF32_ENCODING
-} sk_encoding_t;
-
-typedef enum {
- POINTS_SK_POINT_MODE,
- LINES_SK_POINT_MODE,
- POLYGON_SK_POINT_MODE
-} sk_point_mode_t;
-
-typedef enum {
- LEFT_SK_TEXT_ALIGN,
- CENTER_SK_TEXT_ALIGN,
- RIGHT_SK_TEXT_ALIGN
-} sk_text_align_t;
-
-typedef enum {
- UTF8_SK_TEXT_ENCODING,
- UTF16_SK_TEXT_ENCODING,
- UTF32_SK_TEXT_ENCODING,
- GLYPH_ID_SK_TEXT_ENCODING
-} sk_text_encoding_t;
-
-typedef enum {
- WINDING_SK_PATH_FILLTYPE,
- EVENODD_SK_PATH_FILLTYPE,
- INVERSE_WINDING_SK_PATH_FILLTYPE,
- INVERSE_EVENODD_SK_PATH_FILLTYPE,
-} sk_path_filltype_t;
-
-typedef enum {
- NORMAL_TYPEFACE_STYLE = 0,
- BOLD_TYPEFACE_STYLE = 0x01,
- ITALIC_TYPEFACE_STYLE = 0x02,
- BOLD_ITALIC_TYPEFACE_STYLE = 0x03
-} sk_typeface_style_t;
-
-typedef enum {
- UPRIGHT_SK_FONT_STYLE_SLANT = 0,
- ITALIC_SK_FONT_STYLE_SLANT = 1,
- OBLIQUE_SK_FONT_STYLE_SLANT = 2,
-} sk_font_style_slant_t;
-
-typedef enum {
- NONE_SK_FILTER_QUALITY,
- LOW_SK_FILTER_QUALITY,
- MEDIUM_SK_FILTER_QUALITY,
- HIGH_SK_FILTER_QUALITY
-} sk_filter_quality_t;
-
-typedef enum {
- HAS_LEFT_SK_CROP_RECT_FLAG = 0x01,
- HAS_TOP_SK_CROP_RECT_FLAG = 0x02,
- HAS_WIDTH_SK_CROP_RECT_FLAG = 0x04,
- HAS_HEIGHT_SK_CROP_RECT_FLAG = 0x08,
- HAS_ALL_SK_CROP_RECT_FLAG = 0x0F,
-} sk_crop_rect_flags_t;
-
-typedef enum {
- DRAW_SHADOW_AND_FOREGROUND_SK_DROP_SHADOW_IMAGE_FILTER_SHADOW_MODE,
- DRAW_SHADOW_ONLY_SK_DROP_SHADOW_IMAGE_FILTER_SHADOW_MODE,
-} sk_drop_shadow_image_filter_shadow_mode_t;
-
-typedef enum {
- UNKNOWN_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE,
- R_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE,
- G_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE,
- B_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE,
- A_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE,
-} sk_displacement_map_effect_channel_selector_type_t;
-
-typedef enum {
- UNKNOWN_SK_IMAGE_ENCODER_TYPE,
- BMP_SK_IMAGE_ENCODER_TYPE,
- GIF_SK_IMAGE_ENCODER_TYPE,
- ICO_SK_IMAGE_ENCODER_TYPE,
- JPEG_SK_IMAGE_ENCODER_TYPE,
- PNG_SK_IMAGE_ENCODER_TYPE,
- WBMP_SK_IMAGE_ENCODER_TYPE,
- WEBP_SK_IMAGE_ENCODER_TYPE,
- KTX_SK_IMAGE_ENCODER_TYPE,
-} sk_image_encoder_t;
-
-typedef enum {
- CLAMP_SK_MATRIX_CONVOLUTION_TILEMODE,
- REPEAT_SK_MATRIX_CONVOLUTION_TILEMODE,
- CLAMP_TO_BLACK_SK_MATRIX_CONVOLUTION_TILEMODE,
-} sk_matrix_convolution_tilemode_t;
-
-/**
- The logical operations that can be performed when combining two regions.
-*/
-typedef enum {
- DIFFERENCE_SK_REGION_OP, //!< subtract the op region from the first region
- INTERSECT_SK_REGION_OP, //!< intersect the two regions
- UNION_SK_REGION_OP, //!< union (inclusive-or) the two regions
- XOR_SK_REGION_OP, //!< exclusive-or the two regions
- REVERSE_DIFFERENCE_SK_REGION_OP, //!< subtract the first region from the op region
- REPLACE_SK_REGION_OP, //!< replace the dst region with the op region
-} sk_region_op_t;
-
-/**
- * Enum describing format of encoded data.
- */
-typedef enum {
- UNKNOWN_SK_ENCODED_FORMAT,
- BMP_SK_ENCODED_FORMAT,
- GIF_SK_ENCODED_FORMAT,
- ICO_SK_ENCODED_FORMAT,
- JPEG_SK_ENCODED_FORMAT,
- PNG_SK_ENCODED_FORMAT,
- WBMP_SK_ENCODED_FORMAT,
- WEBP_SK_ENCODED_FORMAT,
- PKM_SK_ENCODED_FORMAT,
- KTX_SK_ENCODED_FORMAT,
- ASTC_SK_ENCODED_FORMAT,
- DNG_SK_ENCODED_FORMAT
-} sk_encoded_format_t;
-
-typedef enum {
- TOP_LEFT_SK_CODEC_ORIGIN = 1, // Default
- TOP_RIGHT_SK_CODEC_ORIGIN = 2, // Reflected across y-axis
- BOTTOM_RIGHT_SK_CODEC_ORIGIN = 3, // Rotated 180
- BOTTOM_LEFT_SK_CODEC_ORIGIN = 4, // Reflected across x-axis
- LEFT_TOP_SK_CODEC_ORIGIN = 5, // Reflected across x-axis, Rotated 90 CCW
- RIGHT_TOP_SK_CODEC_ORIGIN = 6, // Rotated 90 CW
- RIGHT_BOTTOM_SK_CODEC_ORIGIN = 7, // Reflected across x-axis, Rotated 90 CW
- LEFT_BOTTOM_SK_CODEC_ORIGIN = 8, // Rotated 90 CCW
-} sk_codec_origin_t;
-
-typedef enum {
- SUCCESS_SK_CODEC_RESULT,
- INCOMPLETE_INPUT_SK_CODEC_RESULT,
- INVALID_CONVERSION_SK_CODEC_RESULT,
- INVALID_SCALE_SK_CODEC_RESULT,
- INVALID_PARAMETERS_SK_CODEC_RESULT,
- INVALID_INPUT_SK_CODEC_RESULT,
- COULD_NOT_REWIND_SK_CODEC_RESULT,
- UNIMPLEMENTED_SK_CODEC_RESULT,
-} sk_codec_result_t;
-
-typedef enum {
- YES_SK_CODEC_ZERO_INITIALIZED,
- NO_SK_CODEC_ZERO_INITIALIZED,
-} sk_codec_zero_initialized_t;
-
-typedef struct {
- sk_codec_zero_initialized_t fZeroInitialized;
- sk_irect_t fSubset;
- bool fHasSubset;
-} sk_codec_options_t;
-
-// The verbs that can be foudn on a path
-typedef enum {
- MOVE_PATH_VERB,
- LINE_PATH_VERB,
- QUAD_PATH_VERB,
- CONIC_PATH_VERB,
- CUBIC_PATH_VERB,
- CLOSE_PATH_VERB,
- DONE_PATH_VERB
-} sk_path_verb_t;
-
-typedef struct sk_path_iterator_t sk_path_iterator_t;
-typedef struct sk_path_rawiterator_t sk_path_rawiterator_t;
-
-typedef enum {
- APPEND_ADD_MODE,
- EXTEND_ADD_MODE,
-} sk_path_add_mode_t;
-
-typedef enum {
- TRANSLATE_SK_PATH_EFFECT_1D_STYLE,
- ROTATE_SK_PATH_EFFECT_1D_STYLE,
- MORPH_SK_PATH_EFFECT_1D_STYLE,
-} sk_path_effect_1d_style_t;
-
-typedef struct sk_path_effect_t sk_path_effect_t;
-
-SK_C_PLUS_PLUS_END_GUARD
-
-#endif
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkBitmap.h"
+#include "SkColor.h"
+#include "SkColorPriv.h"
+#include "SkDither.h"
+#include "SkImageInfo.h"
+#include "SkUnPreMultiply.h"
+
+#include "sk_bitmap.h"
+
+#include "sk_types_priv.h"
+
+static inline void copyAlpha8ToColor(size_t size, const uint8_t* pixels, sk_color_t* colors)
+{
+ while (size-- != 0) {
+ const uint8_t* addr = pixels++;
+ *colors++ = SkColorSetA(0, *addr);
+ }
+}
+static inline void copyRgb565ToColor(size_t size, const uint16_t* pixels, sk_color_t* colors)
+{
+ while (size-- != 0) {
+ const uint16_t* addr = pixels++;
+ *colors++ = SkPixel16ToColor(*addr);
+ }
+}
+static inline void copy8888ToColor(size_t size, const uint32_t* pixels, sk_color_t* colors)
+{
+ while (size-- != 0) {
+ const uint32_t* addr = pixels++;
+ *colors++ = SkUnPreMultiply::PMColorToColor(*addr);
+ }
+}
+
+static inline void copyAlpha8FromColor(size_t size, const sk_color_t* colors, uint8_t* pixels)
+{
+ while (size-- != 0) {
+ *pixels++ = SkColorGetA(*colors++);
+ }
+}
+static inline void copyRgb565FromColor(size_t width, size_t height, const sk_color_t* colors, uint16_t* pixels)
+{
+ for (size_t y = 0; y < height; y++) {
+ DITHER_565_SCAN(y);
+ for (size_t x = 0; x < width; x++) {
+ SkColor c = *colors++;
+ *pixels++ = SkDitherRGBTo565(SkColorGetR(c), SkColorGetG(c), SkColorGetB(c), DITHER_VALUE(x));
+ }
+ }
+}
+static inline void copy8888FromColor(size_t size, const sk_color_t* colors, uint32_t* pixels)
+{
+ while (size-- != 0) {
+ *pixels++ = SkPreMultiplyColor(*colors++);
+ }
+}
+
+
+void sk_bitmap_destructor(sk_bitmap_t* cbitmap)
+{
+ delete AsBitmap(cbitmap);
+}
+
+sk_bitmap_t* sk_bitmap_new()
+{
+ return (sk_bitmap_t*) new SkBitmap();
+}
+
+void sk_bitmap_get_info(sk_bitmap_t* cbitmap, sk_imageinfo_t* info)
+{
+ *info = ToImageInfo(AsBitmap(cbitmap)->info());
+}
+
+void* sk_bitmap_get_pixels(sk_bitmap_t* cbitmap, size_t* length)
+{
+ SkBitmap* bmp = AsBitmap(cbitmap);
+ *length = bmp->getSize();
+ return bmp->getPixels();
+}
+
+size_t sk_bitmap_get_row_bytes(sk_bitmap_t* cbitmap)
+{
+ return AsBitmap(cbitmap)->rowBytes();
+}
+
+size_t sk_bitmap_get_byte_count(sk_bitmap_t* cbitmap)
+{
+ return AsBitmap(cbitmap)->getSize();
+}
+
+void sk_bitmap_reset(sk_bitmap_t* cbitmap)
+{
+ AsBitmap(cbitmap)->reset();
+}
+
+bool sk_bitmap_is_null(sk_bitmap_t* cbitmap)
+{
+ return AsBitmap(cbitmap)->isNull();
+}
+
+bool sk_bitmap_is_immutable(sk_bitmap_t* cbitmap)
+{
+ return AsBitmap(cbitmap)->isImmutable();
+}
+
+void sk_bitmap_set_immutable(sk_bitmap_t* cbitmap)
+{
+ AsBitmap(cbitmap)->setImmutable();
+}
+
+bool sk_bitmap_is_volatile(sk_bitmap_t* cbitmap)
+{
+ return AsBitmap(cbitmap)->isVolatile();
+}
+
+void sk_bitmap_set_volatile(sk_bitmap_t* cbitmap, bool value)
+{
+ AsBitmap(cbitmap)->setIsVolatile(value);
+}
+
+void sk_bitmap_erase(sk_bitmap_t* cbitmap, sk_color_t color)
+{
+ AsBitmap(cbitmap)->eraseColor(color);
+}
+
+void sk_bitmap_erase_rect(sk_bitmap_t* cbitmap, sk_color_t color, sk_irect_t* rect)
+{
+ AsBitmap(cbitmap)->erase(color, AsIRect(*rect));
+}
+
+sk_color_t sk_bitmap_get_pixel_color(sk_bitmap_t* cbitmap, int x, int y)
+{
+ return AsBitmap(cbitmap)->getColor(x, y);
+}
+
+void sk_bitmap_set_pixel_color(sk_bitmap_t* cbitmap, int x, int y, sk_color_t color)
+{
+ SkBitmap* bmp = AsBitmap(cbitmap);
+
+ SkAutoLockPixels alp(*bmp);
+
+ switch (bmp->colorType()) {
+ case kAlpha_8_SkColorType:
+ copyAlpha8FromColor(1, &color, (uint8_t*)bmp->getAddr8(x, y));
+ break;
+ case kRGB_565_SkColorType:
+ copyRgb565FromColor(1, 1, &color, (uint16_t*)bmp->getAddr16(x, y));
+ break;
+ case kBGRA_8888_SkColorType:
+ case kRGBA_8888_SkColorType:
+ copy8888FromColor(1, &color, (uint32_t*)bmp->getAddr32(x, y));
+ break;
+ default:
+ break;
+ }
+}
+
+bool sk_bitmap_copy(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, sk_colortype_t ct)
+{
+ return AsBitmap(cbitmap)->copyTo(AsBitmap(dst), (SkColorType)ct);
+}
+
+bool sk_bitmap_can_copy_to(sk_bitmap_t* cbitmap, sk_colortype_t ct)
+{
+ return AsBitmap(cbitmap)->canCopyTo((SkColorType)ct);
+}
+
+void sk_bitmap_unlock_pixels(sk_bitmap_t* cbitmap)
+{
+ AsBitmap(cbitmap)->unlockPixels();
+}
+
+void sk_bitmap_lock_pixels(sk_bitmap_t* cbitmap)
+{
+ AsBitmap(cbitmap)->lockPixels();
+}
+
+void sk_bitmap_get_pixel_colors(sk_bitmap_t* cbitmap, sk_color_t* colors)
+{
+ SkBitmap* bmp = AsBitmap(cbitmap);
+
+ SkAutoLockPixels alp(*bmp);
+
+ size_t size = bmp->height() * bmp->width();
+ const void* pixels = bmp->getPixels();
+
+ switch (bmp->colorType()) {
+ case kAlpha_8_SkColorType:
+ copyAlpha8ToColor(size, (const uint8_t*)pixels, colors);
+ break;
+ case kRGB_565_SkColorType:
+ copyRgb565ToColor(size, (const uint16_t*)pixels, colors);
+ break;
+ case kBGRA_8888_SkColorType:
+ case kRGBA_8888_SkColorType:
+ copy8888ToColor(size, (const uint32_t*)pixels, colors);
+ break;
+ default:
+ break;
+ }
+}
+
+void sk_bitmap_set_pixel_colors(sk_bitmap_t* cbitmap, const sk_color_t* colors)
+{
+ SkBitmap* bmp = AsBitmap(cbitmap);
+
+ SkAutoLockPixels alp(*bmp);
+
+ size_t width = bmp->width();
+ size_t height = bmp->height();
+ size_t size = height * width;
+ void* pixels = bmp->getPixels();
+
+ switch (bmp->colorType()) {
+ case kAlpha_8_SkColorType:
+ copyAlpha8FromColor(size, colors, (uint8_t*)pixels);
+ break;
+ case kRGB_565_SkColorType:
+ copyRgb565FromColor(width, height, colors, (uint16_t*)pixels);
+ break;
+ case kBGRA_8888_SkColorType:
+ case kRGBA_8888_SkColorType:
+ copy8888FromColor(size, colors, (uint32_t*)pixels);
+ break;
+ default:
+ break;
+ }
+}
+
+bool sk_bitmap_try_alloc_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, size_t rowBytes)
+{
+ SkBitmap* bmp = AsBitmap(cbitmap);
+
+ const SkImageInfo* info = AsImageInfo(requestedInfo);
+
+ return bmp->tryAllocPixels(*info, rowBytes);
+}
+++ /dev/null
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-static bool find_sk(CType from, SKType* to) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(CTypeSkTypeMap); ++i) {
- if (CTypeSkTypeMap[i].fC == from) {
- if (to) {
- *to = CTypeSkTypeMap[i].fSK;
- }
- return true;
- }
- }
- return false;
-}
-
-static bool find_c(SKType from, CType* to) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(CTypeSkTypeMap); ++i) {
- if (CTypeSkTypeMap[i].fSK == from) {
- if (to) {
- *to = CTypeSkTypeMap[i].fC;
- }
- return true;
- }
- }
- return false;
-}
-
-#undef CType
-#undef SKType
-#undef CTypeSkTypeMap
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkCanvas.h"
+
+#include "sk_canvas.h"
+
+#include "sk_types_priv.h"
+
+void sk_canvas_clear(sk_canvas_t* ccanvas, sk_color_t color) {
+ AsCanvas(ccanvas)->clear(color);
+}
+
+void sk_canvas_discard(sk_canvas_t* ccanvas) {
+ AsCanvas(ccanvas)->discard();
+}
+
+int sk_canvas_get_save_count(sk_canvas_t* ccanvas) {
+ return AsCanvas(ccanvas)->getSaveCount();
+}
+
+void sk_canvas_restore_to_count(sk_canvas_t* ccanvas, int saveCount) {
+ AsCanvas(ccanvas)->restoreToCount(saveCount);
+}
+
+void sk_canvas_draw_color(sk_canvas_t* ccanvas, sk_color_t color, sk_xfermode_mode_t cmode) {
+ AsCanvas(ccanvas)->drawColor(color, (SkXfermode::Mode)cmode);
+}
+
+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)
+{
+ AsCanvas(ccanvas)->drawPoints ((SkCanvas::PointMode)pointMode, count, AsPoint(points), *AsPaint(cpaint));
+}
+
+void sk_canvas_draw_point(sk_canvas_t* ccanvas, float x, float y, const sk_paint_t* cpaint)
+{
+ AsCanvas(ccanvas)->drawPoint (x, y, *AsPaint(cpaint));
+}
+
+void sk_canvas_draw_point_color(sk_canvas_t* ccanvas, float x, float y, sk_color_t color)
+{
+ AsCanvas(ccanvas)->drawPoint (x, y, color);
+}
+
+void sk_canvas_draw_line(sk_canvas_t* ccanvas, float x0, float y0, float x1, float y1, sk_paint_t* cpaint)
+{
+ AsCanvas(ccanvas)->drawLine(x0, y0, x1, y1, *AsPaint(cpaint));
+}
+
+void sk_canvas_draw_text (sk_canvas_t* ccanvas, const char *text, size_t byteLength, float x, float y, const sk_paint_t* cpaint)
+{
+ AsCanvas(ccanvas)->drawText(text, byteLength, x, y, *AsPaint(cpaint));
+}
+
+void sk_canvas_draw_pos_text (sk_canvas_t* ccanvas, const char *text, size_t byteLength, const sk_point_t pos[], const sk_paint_t* cpaint)
+{
+ AsCanvas(ccanvas)->drawPosText(text, byteLength, AsPoint(pos), *AsPaint(cpaint));
+}
+
+void sk_canvas_draw_text_on_path (sk_canvas_t* ccanvas, const char *text, size_t byteLength, const sk_path_t* path,
+ float hOffset, float vOffset, const sk_paint_t* cpaint)
+{
+ AsCanvas(ccanvas)->drawTextOnPathHV(text, byteLength, AsPath(*path), hOffset, vOffset, *AsPaint(cpaint));
+}
+
+void sk_canvas_draw_bitmap(sk_canvas_t* ccanvas, const sk_bitmap_t* cbitmap, float x, float y, const sk_paint_t* cpaint)
+{
+ AsCanvas(ccanvas)->drawBitmap(*AsBitmap(cbitmap), x, y, AsPaint(cpaint));
+}
+
+void sk_canvas_draw_bitmap_rect(sk_canvas_t* ccanvas, const sk_bitmap_t* cbitmap, const sk_rect_t* csrcR, const sk_rect_t* cdstR, const sk_paint_t* cpaint)
+{
+ SkCanvas* canvas = AsCanvas(ccanvas);
+ const SkBitmap& bitmap = *AsBitmap(cbitmap);
+ const SkRect& dst = AsRect(*cdstR);
+ const SkPaint* paint = AsPaint(cpaint);
+
+ if (csrcR) {
+ canvas->drawBitmapRect(bitmap, AsRect(*csrcR), dst, paint);
+ }
+ else {
+ canvas->drawBitmapRect(bitmap, dst, paint);
+ }
+}
+
+void sk_canvas_reset_matrix(sk_canvas_t* ccanvas)
+{
+ AsCanvas(ccanvas)->resetMatrix();
+}
+
+void sk_canvas_set_matrix(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix)
+{
+ SkMatrix matrix;
+ if (cmatrix) {
+ from_c(cmatrix, &matrix);
+ }
+ AsCanvas(ccanvas)->setMatrix(matrix);
+}
+
+void sk_canvas_get_total_matrix(sk_canvas_t* ccanvas, sk_matrix_t* cmatrix)
+{
+ SkMatrix matrix = AsCanvas(ccanvas)->getTotalMatrix();
+ from_sk(&matrix, cmatrix);
+}
+
+void sk_canvas_draw_round_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect, float rx, float ry, const sk_paint_t* cpaint) {
+ AsCanvas(ccanvas)->drawRoundRect(AsRect(*crect), rx, ry, AsPaint(*cpaint));
+}
+
+void sk_canvas_clip_rect_with_operation(sk_canvas_t* ccanvas, const sk_rect_t* crect, sk_region_op_t op, bool doAA) {
+ AsCanvas(ccanvas)->clipRect(AsRect(*crect), (SkRegion::Op)op, doAA);
+}
+
+void sk_canvas_clip_path_with_operation(sk_canvas_t* ccanvas, const sk_path_t* cpath, sk_region_op_t op, bool doAA) {
+ AsCanvas(ccanvas)->clipPath(AsPath(*cpath), (SkRegion::Op)op, doAA);
+}
+
+bool sk_canvas_get_clip_bounds(sk_canvas_t* ccanvas, sk_rect_t* cbounds) {
+ return AsCanvas(ccanvas)->getClipBounds(AsRect(cbounds));
+}
+
+bool sk_canvas_get_clip_device_bounds(sk_canvas_t* ccanvas, sk_irect_t* cbounds) {
+ return AsCanvas(ccanvas)->getClipDeviceBounds(AsIRect(cbounds));
+}
+
+int sk_canvas_save(sk_canvas_t* ccanvas) {
+ return AsCanvas(ccanvas)->save();
+}
+
+int sk_canvas_save_layer(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint) {
+ return AsCanvas(ccanvas)->saveLayer(AsRect(crect), AsPaint(cpaint));
+}
+
+void sk_canvas_restore(sk_canvas_t* ccanvas) {
+ AsCanvas(ccanvas)->restore();
+}
+
+void sk_canvas_translate(sk_canvas_t* ccanvas, float dx, float dy) {
+ AsCanvas(ccanvas)->translate(dx, dy);
+}
+
+void sk_canvas_scale(sk_canvas_t* ccanvas, float sx, float sy) {
+ AsCanvas(ccanvas)->scale(sx, sy);
+}
+
+void sk_canvas_rotate_degrees(sk_canvas_t* ccanvas, float degrees) {
+ AsCanvas(ccanvas)->rotate(degrees);
+}
+
+void sk_canvas_rotate_radians(sk_canvas_t* ccanvas, float radians) {
+ AsCanvas(ccanvas)->rotate(SkRadiansToDegrees(radians));
+}
+
+void sk_canvas_skew(sk_canvas_t* ccanvas, float sx, float sy) {
+ AsCanvas(ccanvas)->skew(sx, sy);
+}
+
+void sk_canvas_concat(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix) {
+ SkASSERT(cmatrix);
+ SkMatrix matrix;
+ from_c(cmatrix, &matrix);
+ AsCanvas(ccanvas)->concat(matrix);
+}
+
+void sk_canvas_clip_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect) {
+ AsCanvas(ccanvas)->clipRect(AsRect(*crect));
+}
+
+void sk_canvas_clip_path(sk_canvas_t* ccanvas, const sk_path_t* cpath) {
+ AsCanvas(ccanvas)->clipPath(AsPath(*cpath));
+}
+
+void sk_canvas_draw_paint(sk_canvas_t* ccanvas, const sk_paint_t* cpaint) {
+ AsCanvas(ccanvas)->drawPaint(AsPaint(*cpaint));
+}
+
+void sk_canvas_draw_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint) {
+ AsCanvas(ccanvas)->drawRect(AsRect(*crect), AsPaint(*cpaint));
+}
+
+void sk_canvas_draw_circle(sk_canvas_t* ccanvas, float cx, float cy, float rad,
+ const sk_paint_t* cpaint) {
+ AsCanvas(ccanvas)->drawCircle(cx, cy, rad, AsPaint(*cpaint));
+}
+
+void sk_canvas_draw_oval(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint) {
+ AsCanvas(ccanvas)->drawOval(AsRect(*crect), AsPaint(*cpaint));
+}
+
+void sk_canvas_draw_path(sk_canvas_t* ccanvas, const sk_path_t* cpath, const sk_paint_t* cpaint) {
+ AsCanvas(ccanvas)->drawPath(AsPath(*cpath), AsPaint(*cpaint));
+}
+
+void sk_canvas_draw_image(sk_canvas_t* ccanvas, const sk_image_t* cimage, float x, float y,
+ const sk_paint_t* cpaint) {
+ AsCanvas(ccanvas)->drawImage(AsImage(cimage), x, y, AsPaint(cpaint));
+}
+
+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) {
+ SkCanvas* canvas = AsCanvas(ccanvas);
+ const SkImage* image = AsImage(cimage);
+ const SkRect& dst = AsRect(*cdstR);
+ const SkPaint* paint = AsPaint(cpaint);
+
+ if (csrcR) {
+ canvas->drawImageRect(image, AsRect(*csrcR), dst, paint);
+ } else {
+ canvas->drawImageRect(image, dst, paint);
+ }
+}
+
+void sk_canvas_draw_picture(sk_canvas_t* ccanvas, const sk_picture_t* cpicture,
+ const sk_matrix_t* cmatrix, const sk_paint_t* cpaint) {
+ const SkMatrix* matrixPtr = NULL;
+ SkMatrix matrix;
+ if (cmatrix) {
+ from_c(cmatrix, &matrix);
+ matrixPtr = &matrix;
+ }
+ AsCanvas(ccanvas)->drawPicture(AsPicture(cpicture), matrixPtr, AsPaint(cpaint));
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkCodec.h"
+
+#include "sk_codec.h"
+
+#include "sk_types_priv.h"
+
+size_t sk_codec_min_buffered_bytes_needed()
+{
+ return SkCodec::MinBufferedBytesNeeded();
+}
+
+sk_codec_t* sk_codec_new_from_stream(sk_stream_t* stream)
+{
+ return ToCodec(SkCodec::NewFromStream(AsStream(stream)));
+}
+
+sk_codec_t* sk_codec_new_from_data(sk_data_t* data)
+{
+ return ToCodec(SkCodec::NewFromData(AsData(data)));
+}
+
+void sk_codec_destroy(sk_codec_t* codec)
+{
+ delete AsCodec(codec);
+}
+
+void sk_codec_get_info(sk_codec_t* codec, sk_imageinfo_t* info)
+{
+ *info = ToImageInfo(AsCodec(codec)->getInfo());
+}
+
+sk_colorspace_t* sk_codec_get_color_space(sk_codec_t* codec)
+{
+ return ToColorSpace(AsCodec(codec)->getColorSpace());
+}
+
+sk_codec_origin_t sk_codec_get_origin(sk_codec_t* codec)
+{
+ return (sk_codec_origin_t)AsCodec(codec)->getOrigin();
+}
+
+void sk_codec_get_scaled_dimensions(sk_codec_t* codec, float desiredScale, sk_isize_t* dimensions)
+{
+ *dimensions = ToISize(AsCodec(codec)->getScaledDimensions(desiredScale));
+}
+
+void sk_codec_get_valid_subset(sk_codec_t* codec, sk_irect_t* desiredSubset)
+{
+ AsCodec(codec)->getValidSubset(AsIRect(desiredSubset));
+}
+
+sk_encoded_format_t sk_codec_get_encoded_format(sk_codec_t* codec)
+{
+ return (sk_encoded_format_t)AsCodec(codec)->getEncodedFormat();
+}
+
+sk_codec_result_t sk_codec_get_pixels(sk_codec_t* codec, const sk_imageinfo_t* cinfo, void* pixels, size_t rowBytes, const sk_codec_options_t* coptions, sk_color_t ctable[], int* ctableCount)
+{
+ const SkImageInfo* info = AsImageInfo(cinfo);
+ SkCodec::Options options;
+ if (!find_sk(*coptions, &options)) {
+ return INVALID_PARAMETERS_SK_CODEC_RESULT;
+ }
+ return (sk_codec_result_t)AsCodec(codec)->getPixels(*info, pixels, rowBytes, &options, ctable, ctableCount);
+}
+
+sk_codec_result_t sk_codec_get_pixels_using_defaults(sk_codec_t* codec, const sk_imageinfo_t* cinfo, void* pixels, size_t rowBytes)
+{
+ const SkImageInfo* info = AsImageInfo(cinfo);
+ return (sk_codec_result_t)AsCodec(codec)->getPixels(*info, pixels, rowBytes);
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkColorCubeFilter.h"
+#include "SkColorMatrixFilter.h"
+#include "SkLumaColorFilter.h"
+#include "SkTableColorFilter.h"
+
+#include "sk_colorfilter.h"
+
+#include "sk_types_priv.h"
+
+void sk_colorfilter_unref(sk_colorfilter_t* filter) {
+ SkSafeUnref(AsColorFilter(filter));
+}
+
+sk_colorfilter_t* sk_colorfilter_new_mode(sk_color_t c, sk_xfermode_mode_t cmode) {
+
+ sk_sp<SkColorFilter> filter = SkColorFilter::MakeModeFilter(
+ c,
+ (SkXfermode::Mode)cmode);
+ return ToColorFilter(filter.release());
+}
+
+sk_colorfilter_t* sk_colorfilter_new_lighting(sk_color_t mul, sk_color_t add) {
+
+ sk_sp<SkColorFilter> filter = SkColorMatrixFilter::MakeLightingFilter(
+ mul,
+ add);
+ return ToColorFilter(filter.release());
+}
+
+sk_colorfilter_t* sk_colorfilter_new_compose(sk_colorfilter_t* outer, sk_colorfilter_t* inner) {
+
+ sk_sp<SkColorFilter> filter = SkColorFilter::MakeComposeFilter(
+ sk_ref_sp(AsColorFilter(outer)),
+ sk_ref_sp(AsColorFilter(inner)));
+ return ToColorFilter(filter.release());
+}
+
+sk_colorfilter_t* sk_colorfilter_new_color_cube(sk_data_t* cubeData, int cubeDimension) {
+
+ sk_sp<SkColorFilter> filter = SkColorCubeFilter::Make(
+ sk_ref_sp(AsData(cubeData)),
+ cubeDimension);
+ return ToColorFilter(filter.release());
+}
+
+sk_colorfilter_t* sk_colorfilter_new_color_matrix(const float array[20]) {
+
+ sk_sp<SkColorFilter> filter = SkColorFilter::MakeMatrixFilterRowMajor255(
+ array);
+ return ToColorFilter(filter.release());
+}
+
+sk_colorfilter_t* sk_colorfilter_new_luma_color() {
+
+ sk_sp<SkColorFilter> filter = SkLumaColorFilter::Make();
+ return ToColorFilter(filter.release());
+}
+
+sk_colorfilter_t* sk_colorfilter_new_table(const uint8_t table[256]) {
+
+ sk_sp<SkColorFilter> filter = SkTableColorFilter::Make(table);
+ return ToColorFilter(filter.release());
+}
+
+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_sp<SkColorFilter> filter = SkTableColorFilter::MakeARGB(tableA, tableR, tableG, tableB);
+ return ToColorFilter(filter.release());
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkData.h"
+
+#include "sk_data.h"
+
+#include "sk_types_priv.h"
+
+sk_data_t* sk_data_new_from_file(const char* path) {
+ return ToData(SkData::NewFromFileName(path));
+}
+
+sk_data_t* sk_data_new_from_stream(sk_stream_t* stream, size_t length) {
+ return ToData(SkData::NewFromStream(AsStream(stream), length));
+}
+
+const uint8_t* sk_data_get_bytes(const sk_data_t* cdata) {
+ return AsData(cdata)->bytes();
+}
+
+sk_data_t* sk_data_new_empty() {
+ return ToData(SkData::NewEmpty());
+}
+
+sk_data_t* sk_data_new_with_copy(const void* src, size_t length) {
+ return ToData(SkData::MakeWithCopy(src, length).release());
+}
+
+sk_data_t* sk_data_new_from_malloc(const void* memory, size_t length) {
+ return ToData(SkData::MakeFromMalloc(memory, length).release());
+}
+
+sk_data_t* sk_data_new_subset(const sk_data_t* csrc, size_t offset, size_t length) {
+ return ToData(SkData::MakeSubset(AsData(csrc), offset, length).release());
+}
+
+void sk_data_ref(const sk_data_t* cdata) {
+ SkSafeRef(AsData(cdata));
+}
+
+void sk_data_unref(const sk_data_t* cdata) {
+ SkSafeUnref(AsData(cdata));
+}
+
+size_t sk_data_get_size(const sk_data_t* cdata) {
+ return AsData(cdata)->size();
+}
+
+const void* sk_data_get_data(const sk_data_t* cdata) {
+ return AsData(cdata)->data();
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkDocument.h"
+
+#include "sk_document.h"
+
+#include "sk_types_priv.h"
+
+void sk_document_unref(sk_document_t* document) {
+ AsDocument(document)->unref();
+}
+
+sk_document_t* sk_document_create_pdf_from_stream(sk_wstream_t* stream, float dpi) {
+ return ToDocument(SkDocument::CreatePDF(AsWStream(stream), dpi));
+}
+
+sk_document_t* sk_document_create_pdf_from_filename(const char* path, float dpi) {
+ return ToDocument(SkDocument::CreatePDF(path, dpi));
+}
+
+//sk_document_t* sk_document_create_xps_from_stream(sk_wstream_t* stream, float dpi) {
+// return ToDocument(SkDocument::CreateXPS(AsWStream(stream), dpi));
+//}
+//
+//sk_document_t* sk_document_create_xps_from_filename(const char* path, float dpi) {
+// return ToDocument(SkDocument::CreateXPS(path, dpi));
+//}
+
+sk_canvas_t* sk_document_begin_page(sk_document_t* document, float width, float height, const sk_rect_t* content) {
+ return ToCanvas(AsDocument(document)->beginPage(width, height, AsRect(content)));
+}
+
+void sk_document_end_page(sk_document_t* document) {
+ AsDocument(document)->endPage();
+}
+
+bool sk_document_close(sk_document_t* document) {
+ return AsDocument(document)->close();
+}
+
+void sk_document_abort(sk_document_t* document) {
+ AsDocument(document)->abort();
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkTypeface.h"
+#include "SkFontStyle.h"
+
+#include "sk_types_priv.h"
+
+#if __cplusplus >= 199711L
+
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+#define ASSERT_MSG(SK, C) "ABI changed, you must write a enumeration mapper for " TOSTRING(#SK) " to " TOSTRING(#C) "."
+
+// sk_typeface_style_t
+static_assert ((int)SkTypeface::Style::kNormal == (int)NORMAL_TYPEFACE_STYLE, ASSERT_MSG(SkTypeface::Style, sk_typeface_style_t));
+static_assert ((int)SkTypeface::Style::kBold == (int)BOLD_TYPEFACE_STYLE, ASSERT_MSG(SkTypeface::Style, sk_typeface_style_t));
+static_assert ((int)SkTypeface::Style::kItalic == (int)ITALIC_TYPEFACE_STYLE, ASSERT_MSG(SkTypeface::Style, sk_typeface_style_t));
+static_assert ((int)SkTypeface::Style::kBoldItalic == (int)BOLD_ITALIC_TYPEFACE_STYLE, ASSERT_MSG(SkTypeface::Style, sk_typeface_style_t));
+
+// sk_encoding_t
+static_assert ((int)SkTypeface::Encoding::kUTF8_Encoding == (int)UTF8_ENCODING, ASSERT_MSG(SkTypeface::Encoding, sk_encoding_t));
+static_assert ((int)SkTypeface::Encoding::kUTF16_Encoding == (int)UTF16_ENCODING, ASSERT_MSG(SkTypeface::Encoding, sk_encoding_t));
+static_assert ((int)SkTypeface::Encoding::kUTF32_Encoding == (int)UTF32_ENCODING, ASSERT_MSG(SkTypeface::Encoding, sk_encoding_t));
+
+// sk_font_style_slant_t
+static_assert ((int)SkFontStyle::Slant::kUpright_Slant == (int)UPRIGHT_SK_FONT_STYLE_SLANT, ASSERT_MSG(SkFontStyle::Slant, sk_font_style_slant_t));
+static_assert ((int)SkFontStyle::Slant::kItalic_Slant == (int)ITALIC_SK_FONT_STYLE_SLANT, ASSERT_MSG(SkFontStyle::Slant, sk_font_style_slant_t));
+static_assert ((int)SkFontStyle::Slant::kOblique_Slant == (int)OBLIQUE_SK_FONT_STYLE_SLANT, ASSERT_MSG(SkFontStyle::Slant, sk_font_style_slant_t));
+
+// sk_path_verb_t
+static_assert ((int)SkPath::Verb::kMove_Verb == (int)MOVE_SK_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
+static_assert ((int)SkPath::Verb::kLine_Verb == (int)LINE_SK_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
+static_assert ((int)SkPath::Verb::kQuad_Verb == (int)QUAD_SK_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
+static_assert ((int)SkPath::Verb::kConic_Verb == (int)CONIC_SK_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
+static_assert ((int)SkPath::Verb::kCubic_Verb == (int)CUBIC_SK_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
+static_assert ((int)SkPath::Verb::kClose_Verb == (int)CLOSE_SK_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
+static_assert ((int)SkPath::Verb::kDone_Verb == (int)DONE_SK_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
+
+// sk_path_add_mode_t
+static_assert ((int)SkPath::AddPathMode::kAppend_AddPathMode == (int)APPEND_SK_PATH_ADD_MODE, ASSERT_MSG(SkPath::AddPathMode, sk_path_add_mode_t));
+static_assert ((int)SkPath::AddPathMode::kExtend_AddPathMode == (int)EXTEND_SK_PATH_ADD_MODE, ASSERT_MSG(SkPath::AddPathMode, sk_path_add_mode_t));
+
+// sk_path_direction_t
+static_assert ((int)SkPath::Direction::kCCW_Direction == (int)CCW_SK_PATH_DIRECTION, ASSERT_MSG(SkPath::Direction, sk_path_direction_t));
+static_assert ((int)SkPath::Direction::kCW_Direction == (int)CW_SK_PATH_DIRECTION, ASSERT_MSG(SkPath::Direction, sk_path_direction_t));
+
+// sk_path_filltype_t
+static_assert ((int)SkPath::FillType::kWinding_FillType == (int)WINDING_SK_PATH_FILLTYPE, ASSERT_MSG(SkPath::FillType, sk_path_filltype_t));
+static_assert ((int)SkPath::FillType::kEvenOdd_FillType == (int)EVENODD_SK_PATH_FILLTYPE, ASSERT_MSG(SkPath::FillType, sk_path_filltype_t));
+static_assert ((int)SkPath::FillType::kInverseWinding_FillType == (int)INVERSE_WINDING_SK_PATH_FILLTYPE, ASSERT_MSG(SkPath::FillType, sk_path_filltype_t));
+static_assert ((int)SkPath::FillType::kInverseEvenOdd_FillType == (int)INVERSE_EVENODD_SK_PATH_FILLTYPE, ASSERT_MSG(SkPath::FillType, sk_path_filltype_t));
+
+// sk_text_align_t
+static_assert ((int)SkPaint::Align::kLeft_Align == (int)LEFT_SK_TEXT_ALIGN, ASSERT_MSG(SkPaint::Align, sk_text_align_t));
+static_assert ((int)SkPaint::Align::kCenter_Align == (int)CENTER_SK_TEXT_ALIGN, ASSERT_MSG(SkPaint::Align, sk_text_align_t));
+static_assert ((int)SkPaint::Align::kRight_Align == (int)RIGHT_SK_TEXT_ALIGN, ASSERT_MSG(SkPaint::Align, sk_text_align_t));
+
+// sk_text_encoding_t
+static_assert ((int)SkPaint::TextEncoding::kUTF8_TextEncoding == (int)UTF8_SK_TEXT_ENCODING, ASSERT_MSG(SkPaint::TextEncoding, sk_text_encoding_t));
+static_assert ((int)SkPaint::TextEncoding::kUTF16_TextEncoding == (int)UTF16_SK_TEXT_ENCODING, ASSERT_MSG(SkPaint::TextEncoding, sk_text_encoding_t));
+static_assert ((int)SkPaint::TextEncoding::kUTF32_TextEncoding == (int)UTF32_SK_TEXT_ENCODING, ASSERT_MSG(SkPaint::TextEncoding, sk_text_encoding_t));
+static_assert ((int)SkPaint::TextEncoding::kGlyphID_TextEncoding == (int)GLYPH_ID_SK_TEXT_ENCODING, ASSERT_MSG(SkPaint::TextEncoding, sk_text_encoding_t));
+
+// sk_filter_quality_t
+static_assert ((int)SkFilterQuality::kNone_SkFilterQuality == (int)NONE_SK_FILTER_QUALITY, ASSERT_MSG(SkFilterQuality, sk_filter_quality_t));
+static_assert ((int)SkFilterQuality::kLow_SkFilterQuality == (int)LOW_SK_FILTER_QUALITY, ASSERT_MSG(SkFilterQuality, sk_filter_quality_t));
+static_assert ((int)SkFilterQuality::kMedium_SkFilterQuality == (int)MEDIUM_SK_FILTER_QUALITY, ASSERT_MSG(SkFilterQuality, sk_filter_quality_t));
+static_assert ((int)SkFilterQuality::kHigh_SkFilterQuality == (int)HIGH_SK_FILTER_QUALITY, ASSERT_MSG(SkFilterQuality, sk_filter_quality_t));
+
+// sk_crop_rect_flags_t
+static_assert ((int)SkImageFilter::CropRect::CropEdge::kHasLeft_CropEdge == (int)HAS_LEFT_SK_CROP_RECT_FLAG, ASSERT_MSG(SkImageFilter::CropRect::CropEdge, sk_crop_rect_flags_t));
+static_assert ((int)SkImageFilter::CropRect::CropEdge::kHasTop_CropEdge == (int)HAS_TOP_SK_CROP_RECT_FLAG, ASSERT_MSG(SkImageFilter::CropRect::CropEdge, sk_crop_rect_flags_t));
+static_assert ((int)SkImageFilter::CropRect::CropEdge::kHasWidth_CropEdge == (int)HAS_WIDTH_SK_CROP_RECT_FLAG, ASSERT_MSG(SkImageFilter::CropRect::CropEdge, sk_crop_rect_flags_t));
+static_assert ((int)SkImageFilter::CropRect::CropEdge::kHasHeight_CropEdge == (int)HAS_HEIGHT_SK_CROP_RECT_FLAG, ASSERT_MSG(SkImageFilter::CropRect::CropEdge, sk_crop_rect_flags_t));
+static_assert ((int)SkImageFilter::CropRect::CropEdge::kHasAll_CropEdge == (int)HAS_ALL_SK_CROP_RECT_FLAG, ASSERT_MSG(SkImageFilter::CropRect::CropEdge, sk_crop_rect_flags_t));
+
+// sk_drop_shadow_image_filter_shadow_mode_t
+static_assert ((int)SkDropShadowImageFilter::ShadowMode::kDrawShadowAndForeground_ShadowMode == (int)DRAW_SHADOW_AND_FOREGROUND_SK_DROP_SHADOW_IMAGE_FILTER_SHADOW_MODE, ASSERT_MSG(SkDropShadowImageFilter::ShadowMode, sk_drop_shadow_image_filter_shadow_mode_t));
+static_assert ((int)SkDropShadowImageFilter::ShadowMode::kDrawShadowOnly_ShadowMode == (int)DRAW_SHADOW_ONLY_SK_DROP_SHADOW_IMAGE_FILTER_SHADOW_MODE, ASSERT_MSG(SkDropShadowImageFilter::ShadowMode, sk_drop_shadow_image_filter_shadow_mode_t));
+
+// sk_displacement_map_effect_channel_selector_type_t
+static_assert ((int)SkDisplacementMapEffect::ChannelSelectorType::kUnknown_ChannelSelectorType == (int)UNKNOWN_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE, ASSERT_MSG(SkDisplacementMapEffect::ChannelSelectorType, sk_displacement_map_effect_channel_selector_type_t));
+static_assert ((int)SkDisplacementMapEffect::ChannelSelectorType::kR_ChannelSelectorType == (int)R_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE, ASSERT_MSG(SkDisplacementMapEffect::ChannelSelectorType, sk_displacement_map_effect_channel_selector_type_t));
+static_assert ((int)SkDisplacementMapEffect::ChannelSelectorType::kG_ChannelSelectorType == (int)G_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE, ASSERT_MSG(SkDisplacementMapEffect::ChannelSelectorType, sk_displacement_map_effect_channel_selector_type_t));
+static_assert ((int)SkDisplacementMapEffect::ChannelSelectorType::kB_ChannelSelectorType == (int)B_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE, ASSERT_MSG(SkDisplacementMapEffect::ChannelSelectorType, sk_displacement_map_effect_channel_selector_type_t));
+static_assert ((int)SkDisplacementMapEffect::ChannelSelectorType::kA_ChannelSelectorType == (int)A_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE, ASSERT_MSG(SkDisplacementMapEffect::ChannelSelectorType, sk_displacement_map_effect_channel_selector_type_t));
+
+// sk_matrix_convolution_tilemode_t
+static_assert ((int)SkMatrixConvolutionImageFilter::TileMode::kClamp_TileMode == (int)CLAMP_SK_MATRIX_CONVOLUTION_TILEMODE, ASSERT_MSG(SkMatrixConvolutionImageFilter::TileMode, sk_matrix_convolution_tilemode_t));
+static_assert ((int)SkMatrixConvolutionImageFilter::TileMode::kRepeat_TileMode == (int)REPEAT_SK_MATRIX_CONVOLUTION_TILEMODE, ASSERT_MSG(SkMatrixConvolutionImageFilter::TileMode, sk_matrix_convolution_tilemode_t));
+static_assert ((int)SkMatrixConvolutionImageFilter::TileMode::kClampToBlack_TileMode == (int)CLAMP_TO_BLACK_SK_MATRIX_CONVOLUTION_TILEMODE, ASSERT_MSG(SkMatrixConvolutionImageFilter::TileMode, sk_matrix_convolution_tilemode_t));
+
+// sk_image_encoder_t
+static_assert ((int)SkImageEncoder::Type::kUnknown_Type == (int)UNKNOWN_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
+static_assert ((int)SkImageEncoder::Type::kBMP_Type == (int)BMP_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
+static_assert ((int)SkImageEncoder::Type::kGIF_Type == (int)GIF_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
+static_assert ((int)SkImageEncoder::Type::kICO_Type == (int)ICO_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
+static_assert ((int)SkImageEncoder::Type::kJPEG_Type == (int)JPEG_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
+static_assert ((int)SkImageEncoder::Type::kPNG_Type == (int)PNG_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
+static_assert ((int)SkImageEncoder::Type::kWBMP_Type == (int)WBMP_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
+static_assert ((int)SkImageEncoder::Type::kWEBP_Type == (int)WEBP_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
+static_assert ((int)SkImageEncoder::Type::kKTX_Type == (int)KTX_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
+
+// sk_xfermode_mode_t
+static_assert ((int)SkXfermode::Mode::kClear_Mode == (int)CLEAR_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kSrc_Mode == (int)SRC_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kDst_Mode == (int)DST_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kSrcOver_Mode == (int)SRCOVER_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kDstOver_Mode == (int)DSTOVER_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kSrcIn_Mode == (int)SRCIN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kDstIn_Mode == (int)DSTIN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kSrcOut_Mode == (int)SRCOUT_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kDstOut_Mode == (int)DSTOUT_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kSrcATop_Mode == (int)SRCATOP_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kDstATop_Mode == (int)DSTATOP_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kXor_Mode == (int)XOR_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kPlus_Mode == (int)PLUS_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kModulate_Mode == (int)MODULATE_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kScreen_Mode == (int)SCREEN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kOverlay_Mode == (int)OVERLAY_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kDarken_Mode == (int)DARKEN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kLighten_Mode == (int)LIGHTEN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kColorDodge_Mode == (int)COLORDODGE_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kColorBurn_Mode == (int)COLORBURN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kHardLight_Mode == (int)HARDLIGHT_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kSoftLight_Mode == (int)SOFTLIGHT_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kDifference_Mode == (int)DIFFERENCE_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kExclusion_Mode == (int)EXCLUSION_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kMultiply_Mode == (int)MULTIPLY_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kHue_Mode == (int)HUE_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kSaturation_Mode == (int)SATURATION_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kColor_Mode == (int)COLOR_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+static_assert ((int)SkXfermode::Mode::kLuminosity_Mode == (int)LUMINOSITY_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
+
+// sk_colortype_t
+static_assert ((int)SkColorType::kUnknown_SkColorType == (int)UNKNOWN_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
+static_assert ((int)SkColorType::kAlpha_8_SkColorType == (int)ALPHA_8_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
+static_assert ((int)SkColorType::kRGB_565_SkColorType == (int)RGB_565_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
+static_assert ((int)SkColorType::kARGB_4444_SkColorType == (int)ARGB_4444_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
+static_assert ((int)SkColorType::kRGBA_8888_SkColorType == (int)RGBA_8888_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
+static_assert ((int)SkColorType::kBGRA_8888_SkColorType == (int)BGRA_8888_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
+static_assert ((int)SkColorType::kIndex_8_SkColorType == (int)Index_8_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
+static_assert ((int)SkColorType::kGray_8_SkColorType == (int)Gray_8_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
+static_assert ((int)SkColorType::kRGBA_F16_SkColorType == (int)RGBA_F16_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
+
+// sk_alphatype_t
+static_assert ((int)SkAlphaType::kUnknown_SkAlphaType == (int)UNKNOWN_SK_ALPHATYPE, ASSERT_MSG(SkAlphaType, sk_alphatype_t));
+static_assert ((int)SkAlphaType::kOpaque_SkAlphaType == (int)OPAQUE_SK_ALPHATYPE, ASSERT_MSG(SkAlphaType, sk_alphatype_t));
+static_assert ((int)SkAlphaType::kPremul_SkAlphaType == (int)PREMUL_SK_ALPHATYPE, ASSERT_MSG(SkAlphaType, sk_alphatype_t));
+static_assert ((int)SkAlphaType::kUnpremul_SkAlphaType == (int)UNPREMUL_SK_ALPHATYPE, ASSERT_MSG(SkAlphaType, sk_alphatype_t));
+
+// sk_pixelgeometry_t
+static_assert ((int)SkPixelGeometry::kUnknown_SkPixelGeometry == (int)UNKNOWN_SK_PIXELGEOMETRY, ASSERT_MSG(SkPixelGeometry, sk_pixelgeometry_t));
+static_assert ((int)SkPixelGeometry::kRGB_H_SkPixelGeometry == (int)RGB_H_SK_PIXELGEOMETRY, ASSERT_MSG(SkPixelGeometry, sk_pixelgeometry_t));
+static_assert ((int)SkPixelGeometry::kBGR_H_SkPixelGeometry == (int)BGR_H_SK_PIXELGEOMETRY, ASSERT_MSG(SkPixelGeometry, sk_pixelgeometry_t));
+static_assert ((int)SkPixelGeometry::kRGB_V_SkPixelGeometry == (int)RGB_V_SK_PIXELGEOMETRY, ASSERT_MSG(SkPixelGeometry, sk_pixelgeometry_t));
+static_assert ((int)SkPixelGeometry::kBGR_V_SkPixelGeometry == (int)BGR_V_SK_PIXELGEOMETRY, ASSERT_MSG(SkPixelGeometry, sk_pixelgeometry_t));
+
+// sk_shader_tilemode_t
+static_assert ((int)SkShader::TileMode::kClamp_TileMode == (int)CLAMP_SK_SHADER_TILEMODE, ASSERT_MSG(SkShader::TileMode, sk_shader_tilemode_t));
+static_assert ((int)SkShader::TileMode::kRepeat_TileMode == (int)REPEAT_SK_SHADER_TILEMODE, ASSERT_MSG(SkShader::TileMode, sk_shader_tilemode_t));
+static_assert ((int)SkShader::TileMode::kMirror_TileMode == (int)MIRROR_SK_SHADER_TILEMODE, ASSERT_MSG(SkShader::TileMode, sk_shader_tilemode_t));
+
+// sk_blurstyle_t
+static_assert ((int)SkBlurStyle::kNormal_SkBlurStyle == (int)NORMAL_SK_BLUR_STYLE, ASSERT_MSG(SkBlurStyle, sk_blurstyle_t));
+static_assert ((int)SkBlurStyle::kSolid_SkBlurStyle == (int)SOLID_SK_BLUR_STYLE, ASSERT_MSG(SkBlurStyle, sk_blurstyle_t));
+static_assert ((int)SkBlurStyle::kOuter_SkBlurStyle == (int)OUTER_SK_BLUR_STYLE, ASSERT_MSG(SkBlurStyle, sk_blurstyle_t));
+static_assert ((int)SkBlurStyle::kInner_SkBlurStyle == (int)INNER_SK_BLUR_STYLE, ASSERT_MSG(SkBlurStyle, sk_blurstyle_t));
+
+// sk_stroke_cap_t
+static_assert ((int)SkPaint::Cap::kButt_Cap == (int)BUTT_SK_STROKE_CAP, ASSERT_MSG(SkPaint::Cap, sk_stroke_cap_t));
+static_assert ((int)SkPaint::Cap::kRound_Cap == (int)ROUND_SK_STROKE_CAP, ASSERT_MSG(SkPaint::Cap, sk_stroke_cap_t));
+static_assert ((int)SkPaint::Cap::kSquare_Cap == (int)SQUARE_SK_STROKE_CAP, ASSERT_MSG(SkPaint::Cap, sk_stroke_cap_t));
+
+// sk_stroke_join_t
+static_assert ((int)SkPaint::Join::kMiter_Join == (int)MITER_SK_STROKE_JOIN, ASSERT_MSG(SkPaint::Join, sk_stroke_join_t));
+static_assert ((int)SkPaint::Join::kRound_Join == (int)ROUND_SK_STROKE_JOIN, ASSERT_MSG(SkPaint::Join, sk_stroke_join_t));
+static_assert ((int)SkPaint::Join::kBevel_Join == (int)BEVEL_SK_STROKE_JOIN, ASSERT_MSG(SkPaint::Join, sk_stroke_join_t));
+
+// sk_region_op_t
+static_assert ((int)SkRegion::Op::kDifference_Op == (int)DIFFERENCE_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
+static_assert ((int)SkRegion::Op::kIntersect_Op == (int)INTERSECT_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
+static_assert ((int)SkRegion::Op::kUnion_Op == (int)UNION_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
+static_assert ((int)SkRegion::Op::kXOR_Op == (int)XOR_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
+static_assert ((int)SkRegion::Op::kReverseDifference_Op == (int)REVERSE_DIFFERENCE_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
+static_assert ((int)SkRegion::Op::kReplace_Op == (int)REPLACE_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
+
+// sk_encoded_format_t
+static_assert ((int)SkEncodedFormat::kUnknown_SkEncodedFormat == (int)UNKNOWN_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kBMP_SkEncodedFormat == (int)BMP_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kGIF_SkEncodedFormat == (int)GIF_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kICO_SkEncodedFormat == (int)ICO_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kJPEG_SkEncodedFormat == (int)JPEG_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kPNG_SkEncodedFormat == (int)PNG_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kWBMP_SkEncodedFormat == (int)WBMP_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kWEBP_SkEncodedFormat == (int)WEBP_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kPKM_SkEncodedFormat == (int)PKM_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kKTX_SkEncodedFormat == (int)KTX_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kASTC_SkEncodedFormat == (int)ASTC_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+static_assert ((int)SkEncodedFormat::kDNG_SkEncodedFormat == (int)DNG_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
+
+// sk_codec_origin_t
+static_assert ((int)SkCodec::Origin::kTopLeft_Origin == (int)TOP_LEFT_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
+static_assert ((int)SkCodec::Origin::kTopRight_Origin == (int)TOP_RIGHT_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
+static_assert ((int)SkCodec::Origin::kBottomRight_Origin == (int)BOTTOM_RIGHT_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
+static_assert ((int)SkCodec::Origin::kBottomLeft_Origin == (int)BOTTOM_LEFT_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
+static_assert ((int)SkCodec::Origin::kLeftTop_Origin == (int)LEFT_TOP_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
+static_assert ((int)SkCodec::Origin::kRightTop_Origin == (int)RIGHT_TOP_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
+static_assert ((int)SkCodec::Origin::kRightBottom_Origin == (int)RIGHT_BOTTOM_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
+static_assert ((int)SkCodec::Origin::kLeftBottom_Origin == (int)LEFT_BOTTOM_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
+
+// sk_codec_result_t
+static_assert ((int)SkCodec::Result::kSuccess == (int)SUCCESS_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
+static_assert ((int)SkCodec::Result::kIncompleteInput == (int)INCOMPLETE_INPUT_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
+static_assert ((int)SkCodec::Result::kInvalidConversion == (int)INVALID_CONVERSION_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
+static_assert ((int)SkCodec::Result::kInvalidScale == (int)INVALID_SCALE_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
+static_assert ((int)SkCodec::Result::kInvalidParameters == (int)INVALID_PARAMETERS_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
+static_assert ((int)SkCodec::Result::kInvalidInput == (int)INVALID_INPUT_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
+static_assert ((int)SkCodec::Result::kCouldNotRewind == (int)COULD_NOT_REWIND_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
+static_assert ((int)SkCodec::Result::kUnimplemented == (int)UNIMPLEMENTED_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
+
+// sk_codec_zero_initialized_t
+static_assert ((int)SkCodec::ZeroInitialized::kYes_ZeroInitialized == (int)YES_SK_CODEC_ZERO_INITIALIZED, ASSERT_MSG(SkCodec::ZeroInitialized, sk_codec_zero_initialized_t));
+static_assert ((int)SkCodec::ZeroInitialized::kNo_ZeroInitialized == (int)NO_SK_CODEC_ZERO_INITIALIZED, ASSERT_MSG(SkCodec::ZeroInitialized, sk_codec_zero_initialized_t));
+
+// sk_path_effect_1d_style_t
+static_assert ((int)SkPath1DPathEffect::Style::kTranslate_Style == (int)TRANSLATE_SK_PATH_EFFECT_1D_STYLE, ASSERT_MSG(SkPath1DPathEffect::Style, sk_path_effect_1d_style_t));
+static_assert ((int)SkPath1DPathEffect::Style::kRotate_Style == (int)ROTATE_SK_PATH_EFFECT_1D_STYLE, ASSERT_MSG(SkPath1DPathEffect::Style, sk_path_effect_1d_style_t));
+static_assert ((int)SkPath1DPathEffect::Style::kMorph_Style == (int)MORPH_SK_PATH_EFFECT_1D_STYLE, ASSERT_MSG(SkPath1DPathEffect::Style, sk_path_effect_1d_style_t));
+
+// sk_point_mode_t
+static_assert ((int)SkCanvas::PointMode::kPoints_PointMode == (int)POINTS_SK_POINT_MODE, ASSERT_MSG(SkCanvas::PointMode, sk_point_mode_t));
+static_assert ((int)SkCanvas::PointMode::kLines_PointMode == (int)LINES_SK_POINT_MODE, ASSERT_MSG(SkCanvas::PointMode, sk_point_mode_t));
+static_assert ((int)SkCanvas::PointMode::kPolygon_PointMode == (int)POLYGON_SK_POINT_MODE, ASSERT_MSG(SkCanvas::PointMode, sk_point_mode_t));
+
+#endif
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkImageEncoder.h"
+
+#include "sk_image.h"
+
+#include "sk_types_priv.h"
+
+sk_data_t* sk_image_encode_specific(const sk_image_t* cimage, sk_image_encoder_t encoder, int quality) {
+ return ToData(AsImage(cimage)->encode((SkImageEncoder::Type)encoder, quality));
+}
+
+sk_image_t* sk_image_new_from_bitmap (const sk_bitmap_t* cbitmap)
+{
+ return ToImage(SkImage::MakeFromBitmap(*AsBitmap(cbitmap)).release());
+}
+
+sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t* cinfo, const void* pixels,
+ size_t rowBytes) {
+ const SkImageInfo* info = AsImageInfo(cinfo);
+ return (sk_image_t*)SkImage::MakeRasterCopy(SkPixmap(*info, pixels, rowBytes)).release();
+}
+
+sk_image_t* sk_image_new_from_encoded(const sk_data_t* cdata, const sk_irect_t* subset) {
+ return ToImage(SkImage::MakeFromEncoded(sk_ref_sp(AsData(cdata)),
+ reinterpret_cast<const SkIRect*>(subset)).release());
+}
+
+sk_data_t* sk_image_encode(const sk_image_t* cimage) {
+ return ToData(AsImage(cimage)->encode());
+}
+
+void sk_image_ref(const sk_image_t* cimage) {
+ AsImage(cimage)->ref();
+}
+
+void sk_image_unref(const sk_image_t* cimage) {
+ AsImage(cimage)->unref();
+}
+
+int sk_image_get_width(const sk_image_t* cimage) {
+ return AsImage(cimage)->width();
+}
+
+int sk_image_get_height(const sk_image_t* cimage) {
+ return AsImage(cimage)->height();
+}
+
+uint32_t sk_image_get_unique_id(const sk_image_t* cimage) {
+ return AsImage(cimage)->uniqueID();
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkImageFilter.h"
+#include "SkColorFilter.h"
+#include "SkAlphaThresholdFilter.h"
+#include "SkBlurImageFilter.h"
+#include "SkColorFilterImageFilter.h"
+#include "SkComposeImageFilter.h"
+#include "SkDisplacementMapEffect.h"
+#include "SkDropShadowImageFilter.h"
+#include "SkLightingImageFilter.h"
+#include "SkMagnifierImageFilter.h"
+#include "SkMatrixConvolutionImageFilter.h"
+#include "SkMergeImageFilter.h"
+#include "SkMorphologyImageFilter.h"
+#include "SkOffsetImageFilter.h"
+#include "SkPictureImageFilter.h"
+#include "SkTileImageFilter.h"
+#include "SkXfermodeImageFilter.h"
+
+#include "sk_imagefilter.h"
+
+#include "sk_types_priv.h"
+
+sk_imagefilter_croprect_t* sk_imagefilter_croprect_new() {
+ return (sk_imagefilter_croprect_t*) new SkImageFilter::CropRect();
+}
+
+sk_imagefilter_croprect_t* sk_imagefilter_croprect_new_with_rect(const sk_rect_t* rect, uint32_t flags) {
+ return (sk_imagefilter_croprect_t*) new SkImageFilter::CropRect(*AsRect(rect), flags);
+}
+
+void sk_imagefilter_croprect_destructor(sk_imagefilter_croprect_t* cropRect) {
+ delete AsImageFilterCropRect(cropRect);
+}
+
+void sk_imagefilter_croprect_get_rect(sk_imagefilter_croprect_t* cropRect, sk_rect_t* rect) {
+ if (rect) {
+ *rect = ToRect(AsImageFilterCropRect(cropRect)->rect());
+ }
+}
+
+uint32_t sk_imagefilter_croprect_get_flags(sk_imagefilter_croprect_t* cropRect) {
+ return AsImageFilterCropRect(cropRect)->flags();
+}
+
+void sk_imagefilter_unref(sk_imagefilter_t* cfilter) {
+ SkSafeUnref(AsImageFilter(cfilter));
+}
+
+sk_imagefilter_t* sk_imagefilter_new_matrix(
+ const sk_matrix_t* cmatrix,
+ sk_filter_quality_t cquality,
+ sk_imagefilter_t* input /*NULL*/) {
+
+ SkMatrix matrix;
+ from_c(cmatrix, &matrix);
+
+ sk_sp<SkImageFilter> filter = SkImageFilter::MakeMatrixFilter(matrix, (SkFilterQuality)cquality, sk_ref_sp(AsImageFilter(input)));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_alpha_threshold(
+ const sk_irect_t* region,
+ float innerThreshold,
+ float outerThreshold,
+ sk_imagefilter_t* input /*NULL*/) {
+
+ SkRegion r = SkRegion(AsIRect(*region));
+
+ sk_sp<SkImageFilter> filter = SkAlphaThresholdFilter::Make(r, innerThreshold, outerThreshold, sk_ref_sp(AsImageFilter(input)));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_blur(
+ float sigmaX,
+ float sigmaY,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkBlurImageFilter::Make(sigmaX, sigmaY, sk_ref_sp(AsImageFilter(input)), AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_color_filter(
+ sk_colorfilter_t* cf,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkColorFilterImageFilter::Make(sk_ref_sp(AsColorFilter(cf)), sk_ref_sp(AsImageFilter(input)), AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_compose(
+ sk_imagefilter_t* outer,
+ sk_imagefilter_t* inner) {
+
+ sk_sp<SkImageFilter> filter = SkComposeImageFilter::Make(sk_ref_sp(AsImageFilter(outer)), sk_ref_sp(AsImageFilter(inner)));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_displacement_map_effect(
+ sk_displacement_map_effect_channel_selector_type_t xChannelSelector,
+ sk_displacement_map_effect_channel_selector_type_t yChannelSelector,
+ float scale,
+ sk_imagefilter_t* displacement,
+ sk_imagefilter_t* color /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkDisplacementMapEffect::Make(
+ (SkDisplacementMapEffect::ChannelSelectorType)xChannelSelector,
+ (SkDisplacementMapEffect::ChannelSelectorType)yChannelSelector,
+ scale,
+ sk_ref_sp(AsImageFilter(displacement)),
+ sk_ref_sp(AsImageFilter(color)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_drop_shadow(
+ float dx,
+ float dy,
+ float sigmaX,
+ float sigmaY,
+ sk_color_t color,
+ sk_drop_shadow_image_filter_shadow_mode_t cShadowMode,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkDropShadowImageFilter::Make(
+ dx,
+ dy,
+ sigmaX,
+ sigmaY,
+ color,
+ (SkDropShadowImageFilter::ShadowMode)cShadowMode,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_distant_lit_diffuse(
+ const sk_point3_t* direction,
+ sk_color_t lightColor,
+ float surfaceScale,
+ float kd,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakeDistantLitDiffuse(
+ *AsPoint3(direction),
+ lightColor,
+ surfaceScale,
+ kd,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_point_lit_diffuse(
+ const sk_point3_t* location,
+ sk_color_t lightColor,
+ float surfaceScale,
+ float kd,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakePointLitDiffuse(
+ *AsPoint3(location),
+ lightColor,
+ surfaceScale,
+ kd,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+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,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakeSpotLitDiffuse(
+ *AsPoint3(location),
+ *AsPoint3(target),
+ specularExponent,
+ cutoffAngle,
+ lightColor,
+ surfaceScale,
+ kd,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_distant_lit_specular(
+ const sk_point3_t* direction,
+ sk_color_t lightColor,
+ float surfaceScale,
+ float ks,
+ float shininess,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakeDistantLitSpecular(
+ *AsPoint3(direction),
+ lightColor,
+ surfaceScale,
+ ks,
+ shininess,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_point_lit_specular(
+ const sk_point3_t* location,
+ sk_color_t lightColor,
+ float surfaceScale,
+ float ks,
+ float shininess,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakePointLitSpecular(
+ *AsPoint3(location),
+ lightColor,
+ surfaceScale,
+ ks,
+ shininess,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+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,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakeSpotLitSpecular(
+ *AsPoint3(location),
+ *AsPoint3(target),
+ specularExponent,
+ cutoffAngle,
+ lightColor,
+ surfaceScale,
+ ks,
+ shininess,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_magnifier(
+ const sk_rect_t* src,
+ float inset,
+ sk_imagefilter_t* input /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkMagnifierImageFilter::Make(
+ *AsRect(src),
+ inset,
+ sk_ref_sp(AsImageFilter(input)));
+ return ToImageFilter(filter.release());
+}
+
+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_matrix_convolution_tilemode_t ctileMode,
+ bool convolveAlpha,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkMatrixConvolutionImageFilter::Make(
+ *AsISize(kernelSize),
+ kernel,
+ gain,
+ bias,
+ *AsIPoint(kernelOffset),
+ (SkMatrixConvolutionImageFilter::TileMode)ctileMode,
+ convolveAlpha,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_merge(
+ sk_imagefilter_t* cfilters[],
+ int count,
+ const sk_xfermode_mode_t cmodes[] /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter>* filters = new sk_sp<SkImageFilter>[count];
+ for (int i = 0; i < count; i++) {
+ filters[i] = sk_ref_sp(AsImageFilter(cfilters[i]));
+ }
+
+ sk_sp<SkImageFilter> filter = SkMergeImageFilter::Make(
+ filters,
+ count,
+ (SkXfermode::Mode*)cmodes,
+ AsImageFilterCropRect(cropRect));
+
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_dilate(
+ int radiusX,
+ int radiusY,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkDilateImageFilter::Make(
+ radiusX,
+ radiusY,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_erode(
+ int radiusX,
+ int radiusY,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkErodeImageFilter::Make(
+ radiusX,
+ radiusY,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_offset(
+ float dx,
+ float dy,
+ sk_imagefilter_t* input /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkOffsetImageFilter::Make(
+ dx,
+ dy,
+ sk_ref_sp(AsImageFilter(input)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_picture(
+ sk_picture_t* picture) {
+
+ sk_sp<SkImageFilter> filter = SkPictureImageFilter::Make(
+ sk_ref_sp(AsPicture(picture)));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_picture_with_croprect(
+ sk_picture_t* picture,
+ const sk_rect_t* cropRect) {
+
+ sk_sp<SkImageFilter> filter = SkPictureImageFilter::Make(
+ sk_ref_sp(AsPicture(picture)),
+ *AsRect(cropRect));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_picture_for_localspace(
+ sk_picture_t* picture,
+ const sk_rect_t* cropRect,
+ sk_filter_quality_t filterQuality) {
+
+ sk_sp<SkImageFilter> filter = SkPictureImageFilter::MakeForLocalSpace(
+ sk_ref_sp(AsPicture(picture)),
+ *AsRect(cropRect),
+ (SkFilterQuality)filterQuality);
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_tile(
+ const sk_rect_t* src,
+ const sk_rect_t* dst,
+ sk_imagefilter_t* input) {
+
+ sk_sp<SkImageFilter> filter = SkTileImageFilter::Make(
+ *AsRect(src),
+ *AsRect(dst),
+ sk_ref_sp(AsImageFilter(input)));
+ return ToImageFilter(filter.release());
+}
+
+sk_imagefilter_t* sk_imagefilter_new_xfermode(
+ sk_xfermode_mode_t cmode,
+ sk_imagefilter_t* background,
+ sk_imagefilter_t* foreground /*NULL*/,
+ const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
+
+ sk_sp<SkImageFilter> filter = SkXfermodeImageFilter::Make(
+ SkXfermode::Make((SkXfermode::Mode)cmode),
+ sk_ref_sp(AsImageFilter(background)),
+ sk_ref_sp(AsImageFilter(foreground)),
+ AsImageFilterCropRect(cropRect));
+ return ToImageFilter(filter.release());
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkBlurMaskFilter.h"
+#include "SkTableMaskFilter.h"
+
+#include "sk_maskfilter.h"
+
+#include "sk_types_priv.h"
+
+sk_maskfilter_t* sk_maskfilter_new_emboss(
+ float blurSigma,
+ const float direction[3],
+ float ambient,
+ float specular) {
+ return ToMaskFilter(SkBlurMaskFilter::MakeEmboss(blurSigma, direction, ambient, specular).release());
+}
+
+sk_maskfilter_t* sk_maskfilter_new_table(const uint8_t table[256]) {
+ return ToMaskFilter(SkTableMaskFilter::Create(table));
+}
+
+sk_maskfilter_t* sk_maskfilter_new_gamma(float gamma) {
+ return ToMaskFilter(SkTableMaskFilter::CreateGamma(gamma));
+}
+
+sk_maskfilter_t* sk_maskfilter_new_clip(uint8_t min, uint8_t max) {
+ return ToMaskFilter(SkTableMaskFilter::CreateClip(min, max));
+}
+
+void sk_maskfilter_ref(sk_maskfilter_t* cfilter) {
+ SkSafeRef(AsMaskFilter(cfilter));
+}
+
+void sk_maskfilter_unref(sk_maskfilter_t* cfilter) {
+ SkSafeUnref(AsMaskFilter(cfilter));
+}
+
+sk_maskfilter_t* sk_maskfilter_new_blur(sk_blurstyle_t cstyle, float sigma) {
+ return ToMaskFilter(SkBlurMaskFilter::Make((SkBlurStyle)cstyle, sigma).release());
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkStream.h"
+
+#include "sk_matrix.h"
+
+#include "sk_types_priv.h"
+
+int sk_matrix_try_invert (sk_matrix_t *matrix, sk_matrix_t *result)
+{
+ SkMatrix copy, inverse;
+ from_c (matrix, ©);
+ if (copy.invert (&inverse)){
+ from_sk (&inverse, result);
+ return 1;
+ }
+ return 0;
+}
+
+void sk_matrix_concat (sk_matrix_t *matrix, sk_matrix_t *first, sk_matrix_t *second)
+{
+ SkMatrix target, skfirst, sksecond;
+
+ from_c (matrix, &target);
+ from_c (first, &skfirst);
+ from_c (second, &sksecond);
+ target.setConcat (skfirst, sksecond);
+ from_sk (&target, matrix);
+}
+
+void sk_matrix_pre_concat (sk_matrix_t *target, sk_matrix_t *matrix)
+{
+ SkMatrix sktarget, skmatrix;
+ from_c (target, &sktarget);
+ from_c (matrix, &skmatrix);
+ sktarget.preConcat (skmatrix);
+ from_sk (&sktarget, target);
+}
+
+void sk_matrix_post_concat (sk_matrix_t *target, sk_matrix_t *matrix)
+{
+ SkMatrix sktarget, skmatrix;
+ from_c (target, &sktarget);
+ from_c (matrix, &skmatrix);
+ sktarget.postConcat (skmatrix);
+ from_sk (&sktarget, target);
+}
+
+void sk_matrix_map_rect (sk_matrix_t *matrix, sk_rect_t *dest, sk_rect_t *source)
+{
+ SkMatrix skmatrix;
+ from_c (matrix, &skmatrix);
+ skmatrix.mapRect (AsRect (dest), *AsRect(source));
+}
+
+void sk_matrix_map_points (sk_matrix_t *matrix, sk_point_t *dst, sk_point_t *src, int count)
+{
+ SkMatrix skmatrix;
+ from_c (matrix, &skmatrix);
+ skmatrix.mapPoints (AsPoint (dst), AsPoint (src), count);
+}
+
+void sk_matrix_map_vectors (sk_matrix_t *matrix, sk_point_t *dst, sk_point_t *src, int count)
+{
+ SkMatrix skmatrix;
+ from_c (matrix, &skmatrix);
+ skmatrix.mapVectors (AsPoint (dst), AsPoint (src), count);
+}
+
+sk_point_t sk_matrix_map_xy (sk_matrix_t *matrix, float x, float y)
+{
+ SkMatrix skmatrix;
+ SkPoint result;
+ from_c (matrix, &skmatrix);
+ skmatrix.mapXY (x, y, &result);
+ return *ToPoint(&result);
+}
+
+sk_point_t sk_matrix_map_vector (sk_matrix_t *matrix, float x, float y)
+{
+ SkMatrix skmatrix;
+ SkPoint result;
+ from_c (matrix, &skmatrix);
+ skmatrix.mapVector (x, y, &result);
+ return *ToPoint(&result);
+}
+
+float sk_matrix_map_radius (sk_matrix_t *matrix, float radius)
+{
+ SkMatrix skmatrix;
+ from_c (matrix, &skmatrix);
+ return skmatrix.mapRadius (radius);
+}
+
* found in the LICENSE file.
*/
+#include "SkColorFilter.h"
#include "SkMaskFilter.h"
#include "SkPaint.h"
#include "SkShader.h"
+#include "SkTypeface.h"
#include "sk_paint.h"
+
#include "sk_types_priv.h"
-#include "xamarin/sk_x_types_priv.h"
//////////////////////////////////////////////////////////////////////////////////////////////////
SkASSERT(paint);
AsPaint(paint)->setXfermodeMode((SkXfermode::Mode)mode);
}
+
+bool sk_paint_is_dither(const sk_paint_t* cpaint) {
+ return AsPaint(*cpaint).isDither();
+}
+
+void sk_paint_set_dither(sk_paint_t* cpaint, bool isdither) {
+ AsPaint(cpaint)->setDither(isdither);
+}
+
+bool sk_paint_is_verticaltext(const sk_paint_t* cpaint) {
+ return AsPaint(*cpaint).isVerticalText();
+}
+
+void sk_paint_set_verticaltext(sk_paint_t* cpaint, bool vt) {
+ AsPaint(cpaint)->setVerticalText(vt);
+}
+
+sk_shader_t* sk_paint_get_shader(sk_paint_t* cpaint) {
+ return ToShader(AsPaint(cpaint)->getShader());
+}
+
+sk_maskfilter_t* sk_paint_get_maskfilter(sk_paint_t* cpaint) {
+ return ToMaskFilter(AsPaint(cpaint)->getMaskFilter());
+}
+
+void sk_paint_set_colorfilter(sk_paint_t* cpaint, sk_colorfilter_t* cfilter) {
+ AsPaint(cpaint)->setColorFilter(sk_ref_sp(AsColorFilter(cfilter)));
+}
+
+sk_colorfilter_t* sk_paint_get_colorfilter(sk_paint_t* cpaint) {
+ return ToColorFilter(AsPaint(cpaint)->getColorFilter());
+}
+
+void sk_paint_set_imagefilter(sk_paint_t* cpaint, sk_imagefilter_t* cfilter) {
+ AsPaint(cpaint)->setImageFilter(AsImageFilter(cfilter));
+}
+
+sk_imagefilter_t* sk_paint_get_imagefilter(sk_paint_t* cpaint) {
+ return ToImageFilter(AsPaint(cpaint)->getImageFilter());
+}
+
+sk_xfermode_mode_t sk_paint_get_xfermode_mode(sk_paint_t* paint) {
+ SkASSERT(paint);
+ SkXfermode::Mode mode;
+ if (SkXfermode::AsMode(AsPaint(paint)->getXfermode(), &mode)) {
+ return (sk_xfermode_mode_t)mode;
+ }
+ return SRCOVER_SK_XFERMODE_MODE;
+}
+
+void sk_paint_set_filter_quality(sk_paint_t* cpaint, sk_filter_quality_t filterQuality)
+{
+ SkASSERT(cpaint);
+ AsPaint(cpaint)->setFilterQuality((SkFilterQuality)filterQuality);
+}
+
+sk_filter_quality_t sk_paint_get_filter_quality(sk_paint_t* cpaint)
+{
+ SkASSERT(cpaint);
+ return (sk_filter_quality_t)AsPaint(cpaint)->getFilterQuality();
+}
+
+sk_typeface_t* sk_paint_get_typeface(sk_paint_t* paint)
+{
+ return ToTypeface(AsPaint(paint)->getTypeface());
+}
+
+void sk_paint_set_typeface(sk_paint_t* paint, sk_typeface_t* typeface)
+{
+ AsPaint(paint)->setTypeface(sk_ref_sp(AsTypeface(typeface)));
+}
+
+float sk_paint_get_textsize(sk_paint_t* paint)
+{
+ return AsPaint(paint)->getTextSize();
+}
+
+void sk_paint_set_textsize(sk_paint_t* paint, float size)
+{
+ AsPaint(paint)->setTextSize(size);
+}
+
+sk_text_align_t sk_paint_get_text_align(const sk_paint_t* cpaint) {
+ return (sk_text_align_t)AsPaint(*cpaint).getTextAlign();
+}
+
+void sk_paint_set_text_align(sk_paint_t* cpaint, sk_text_align_t calign) {
+ AsPaint(cpaint)->setTextAlign((SkPaint::Align)calign);
+}
+
+sk_text_encoding_t sk_paint_get_text_encoding(const sk_paint_t* cpaint) {
+ return (sk_text_encoding_t)AsPaint(*cpaint).getTextEncoding();
+}
+
+void sk_paint_set_text_encoding(sk_paint_t* cpaint, sk_text_encoding_t cencoding) {
+ AsPaint(cpaint)->setTextEncoding((SkPaint::TextEncoding)cencoding);
+}
+
+float sk_paint_get_text_scale_x(const sk_paint_t* cpaint) {
+ return AsPaint(cpaint)->getTextScaleX();
+}
+
+void sk_paint_set_text_scale_x(sk_paint_t* cpaint, float scale) {
+ AsPaint(cpaint)->setTextScaleX(scale);
+}
+
+float sk_paint_get_text_skew_x(const sk_paint_t* cpaint) {
+ return AsPaint(cpaint)->getTextSkewX();
+}
+
+void sk_paint_set_text_skew_x(sk_paint_t* cpaint, float skew) {
+ AsPaint(cpaint)->setTextSkewX(skew);
+}
+
+size_t sk_paint_break_text(const sk_paint_t* cpaint, const void* text, size_t length, float maxWidth, float* measuredWidth) {
+ return AsPaint(cpaint)->breakText(text, length, maxWidth, measuredWidth);
+}
+
+float sk_paint_measure_text(const sk_paint_t* cpaint, const void* text, size_t length, sk_rect_t* bounds) {
+ return AsPaint(cpaint)->measureText(text, length, AsRect(bounds));
+}
+
+sk_path_t* sk_paint_get_text_path(sk_paint_t* cpaint, const void* text, size_t length, float x, float y) {
+ SkPath* path = new SkPath();
+ AsPaint(cpaint)->getTextPath(text, length, x, y, path);
+ return ToPath(path);
+}
+
+sk_path_t* sk_paint_get_pos_text_path(sk_paint_t* cpaint, const void* text, size_t length, const sk_point_t pos[]) {
+ SkPath* path = new SkPath();
+ AsPaint(cpaint)->getPosTextPath(text, length, reinterpret_cast<const SkPoint*>(pos), path);
+ return ToPath(path);
+}
+
+float sk_paint_get_fontmetrics(sk_paint_t* cpaint, sk_fontmetrics_t* cfontmetrics, float scale)
+{
+ SkPaint *paint = AsPaint(cpaint);
+ return paint->getFontMetrics(AsFontMetrics(cfontmetrics), scale);
+}
+
+sk_path_effect_t* sk_paint_get_path_effect(sk_paint_t* cpaint) {
+ return ToPathEffect(AsPaint(cpaint)->getPathEffect());
+}
+
+void sk_paint_set_path_effect(sk_paint_t* cpaint, sk_path_effect_t* effect) {
+ AsPaint(cpaint)->setPathEffect(sk_ref_sp(AsPathEffect(effect)));
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkPath.h"
+
+#include "sk_path.h"
+
+#include "sk_types_priv.h"
+
+void sk_path_rmove_to(sk_path_t* cpath, float dx, float dy) {
+ AsPath(cpath)->rMoveTo(dx, dy);
+}
+
+void sk_path_rline_to(sk_path_t* cpath, float dx, float dy) {
+ AsPath(cpath)->rLineTo(dx, dy);
+}
+
+void sk_path_rquad_to(sk_path_t* cpath, float dx0, float dy0, float dx1, float dy1) {
+ AsPath(cpath)->rQuadTo(dx0, dy0, dx1, dy1);
+}
+
+void sk_path_rconic_to(sk_path_t* cpath, float dx0, float dy0, float dx1, float dy1, float w) {
+ AsPath(cpath)->rConicTo(dx0, dy0, dx1, dy1, w);
+}
+
+void sk_path_rcubic_to(sk_path_t* cpath, float dx0, float dy0, float dx1, float dy1, float dx2, float dy2) {
+ AsPath(cpath)->rCubicTo(dx0, dy0, dx1, dy1, dx2, dy2);
+}
+
+void sk_path_add_rect_start(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir, uint32_t startIndex) {
+ AsPath(cpath)->addRect(AsRect(*crect), (SkPath::Direction)cdir, startIndex);
+}
+
+void sk_path_add_arc(sk_path_t* cpath, const sk_rect_t* crect, float startAngle, float sweepAngle) {
+ AsPath(cpath)->addArc(AsRect(*crect), startAngle, sweepAngle);
+}
+
+void sk_path_set_filltype(sk_path_t* cpath, sk_path_filltype_t cfilltype) {
+ AsPath(cpath)->setFillType((SkPath::FillType)cfilltype);
+}
+
+sk_path_filltype_t sk_path_get_filltype(sk_path_t *cpath) {
+ return (sk_path_filltype_t)AsPath(cpath)->getFillType();
+}
+
+void sk_path_transform(sk_path_t* cpath, const sk_matrix_t* cmatrix)
+{
+ SkMatrix matrix;
+ if (cmatrix) {
+ from_c(cmatrix, &matrix);
+ }
+ return AsPath(cpath)->transform(matrix);
+}
+
+sk_path_t* sk_path_clone(const sk_path_t* cpath)
+{
+ return (sk_path_t*)new SkPath(AsPath(*cpath));
+}
+
+void sk_path_rewind (sk_path_t* cpath)
+{
+ AsPath (cpath)->rewind ();
+}
+
+void sk_path_reset (sk_path_t* cpath)
+{
+ AsPath (cpath)->reset ();
+}
+
+sk_path_iterator_t* sk_path_create_iter (sk_path_t *cpath, int forceClose)
+{
+ SkPath::Iter* iter = new SkPath::Iter(AsPath(*cpath), forceClose);
+ return ToPathIter(iter);
+}
+
+sk_path_verb_t sk_path_iter_next (sk_path_iterator_t *iterator, sk_point_t points [4], int doConsumeDegenerates, int exact)
+{
+ SkPath::Iter *iter = AsPathIter(iterator);
+ SkPoint *pts = AsPoint(points);
+ SkPath::Verb verb = iter->next(pts, doConsumeDegenerates, exact);
+ return (sk_path_verb_t)verb;
+}
+
+float sk_path_iter_conic_weight (sk_path_iterator_t *iterator)
+{
+ return AsPathIter(iterator)->conicWeight ();
+}
+
+int sk_path_iter_is_close_line (sk_path_iterator_t *iterator)
+{
+ return AsPathIter(iterator)->isCloseLine ();
+}
+
+int sk_path_iter_is_closed_contour (sk_path_iterator_t *iterator)
+{
+ return AsPathIter(iterator)->isClosedContour ();
+}
+
+void sk_path_iter_destroy (sk_path_iterator_t *iterator)
+{
+ delete AsPathIter (iterator);
+}
+
+sk_path_rawiterator_t* sk_path_create_rawiter (sk_path_t *cpath)
+{
+ SkPath::RawIter* iter = new SkPath::RawIter(AsPath(*cpath));
+ return ToPathRawIter(iter);
+}
+
+sk_path_verb_t sk_path_rawiter_next (sk_path_rawiterator_t *iterator, sk_point_t points [4])
+{
+ SkPath::RawIter *iter = AsPathRawIter(iterator);
+ SkPoint *pts = AsPoint(points);
+ SkPath::Verb verb = iter->next(pts);
+ return (sk_path_verb_t)verb;
+}
+
+sk_path_verb_t sk_path_rawiter_peek (sk_path_rawiterator_t *iterator)
+{
+ return (sk_path_verb_t) AsPathRawIter(iterator)->peek ();
+}
+
+float sk_path_rawiter_conic_weight (sk_path_rawiterator_t *iterator)
+{
+ return AsPathRawIter(iterator)->conicWeight ();
+}
+
+void sk_path_rawiter_destroy (sk_path_rawiterator_t *iterator)
+{
+ delete AsPathRawIter (iterator);
+}
+
+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)
+{
+ AsPath (cpath)->addPath (AsPath (*other), dx, dy, (SkPath::AddPathMode) add_mode);
+}
+
+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)
+{
+ SkMatrix skmatrix;
+ from_c(matrix, &skmatrix);
+ AsPath (cpath)->addPath (AsPath (*other), skmatrix, (SkPath::AddPathMode) add_mode);
+}
+
+void sk_path_add_path (sk_path_t* cpath, sk_path_t* other, sk_path_add_mode_t add_mode)
+{
+ AsPath (cpath)->addPath (AsPath (*other), (SkPath::AddPathMode) add_mode);
+}
+
+void sk_path_add_path_reverse (sk_path_t* cpath, sk_path_t* other)
+{
+ AsPath (cpath)->reverseAddPath (AsPath (*other));
+}
+
+sk_path_t* sk_path_new() { return (sk_path_t*)new SkPath; }
+
+void sk_path_delete(sk_path_t* cpath) { delete AsPath(cpath); }
+
+void sk_path_move_to(sk_path_t* cpath, float x, float y) {
+ AsPath(cpath)->moveTo(x, y);
+}
+
+void sk_path_line_to(sk_path_t* cpath, float x, float y) {
+ AsPath(cpath)->lineTo(x, y);
+}
+
+void sk_path_quad_to(sk_path_t* cpath, float x0, float y0, float x1, float y1) {
+ AsPath(cpath)->quadTo(x0, y0, x1, y1);
+}
+
+void sk_path_conic_to(sk_path_t* cpath, float x0, float y0, float x1, float y1, float w) {
+ AsPath(cpath)->conicTo(x0, y0, x1, y1, w);
+}
+
+void sk_path_cubic_to(sk_path_t* cpath, float x0, float y0, float x1, float y1, float x2, float y2) {
+ AsPath(cpath)->cubicTo(x0, y0, x1, y1, x2, y2);
+}
+
+void sk_path_close(sk_path_t* cpath) {
+ AsPath(cpath)->close();
+}
+
+void sk_path_add_rect(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir) {
+ AsPath(cpath)->addRect(AsRect(*crect), (SkPath::Direction)cdir);
+}
+
+void sk_path_add_oval(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir) {
+ AsPath(cpath)->addOval(AsRect(*crect), (SkPath::Direction)cdir);
+}
+
+bool sk_path_get_bounds(const sk_path_t* cpath, sk_rect_t* crect) {
+ const SkPath& path = AsPath(*cpath);
+
+ if (path.isEmpty()) {
+ if (crect) {
+ *crect = ToRect(SkRect::MakeEmpty());
+ }
+ return false;
+ }
+
+ if (crect) {
+ *crect = ToRect(path.getBounds());
+ }
+ return true;
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkPathEffect.h"
+#include "SkDiscretePathEffect.h"
+#include "SkCornerPathEffect.h"
+#include "Sk1DPathEffect.h"
+#include "Sk2DPathEffect.h"
+#include "SkDashPathEffect.h"
+#include "SkPath.h"
+
+#include "sk_patheffect.h"
+
+#include "sk_types_priv.h"
+
+void sk_path_effect_unref(sk_path_effect_t* effect)
+{
+ SkSafeUnref(AsPathEffect(effect));
+}
+
+sk_path_effect_t* sk_path_effect_create_compose(sk_path_effect_t* outer, sk_path_effect_t* inner)
+{
+ return ToPathEffect(SkComposePathEffect::Make(sk_ref_sp(AsPathEffect(outer)), sk_ref_sp(AsPathEffect(inner))).release());
+}
+
+sk_path_effect_t* sk_path_effect_create_sum(sk_path_effect_t* first, sk_path_effect_t* second)
+{
+ return ToPathEffect(SkSumPathEffect::Make(sk_ref_sp(AsPathEffect(first)), sk_ref_sp(AsPathEffect(second))).release());
+}
+
+sk_path_effect_t* sk_path_effect_create_discrete(float segLength, float deviation, uint32_t seedAssist /*0*/)
+{
+ return ToPathEffect(SkDiscretePathEffect::Make(segLength, deviation, seedAssist).release());
+}
+
+sk_path_effect_t* sk_path_effect_create_corner(float radius)
+{
+ return ToPathEffect(SkCornerPathEffect::Make(radius).release());
+}
+
+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)
+{
+ return ToPathEffect(SkPath1DPathEffect::Make(AsPath(*path), advance, phase, (SkPath1DPathEffect::Style)style).release());
+}
+
+sk_path_effect_t* sk_path_effect_create_2d_line(float width, const sk_matrix_t* cmatrix)
+{
+ SkMatrix matrix;
+ if (cmatrix) {
+ from_c(cmatrix, &matrix);
+ }
+ return ToPathEffect(SkLine2DPathEffect::Make(width, matrix).release());
+}
+
+sk_path_effect_t* sk_path_effect_create_2d_path(const sk_matrix_t* cmatrix, const sk_path_t* path)
+{
+ SkMatrix matrix;
+ if (cmatrix) {
+ from_c(cmatrix, &matrix);
+ }
+ return ToPathEffect(SkPath2DPathEffect::Make(matrix, AsPath(*path)).release());
+}
+
+sk_path_effect_t* sk_path_effect_create_dash(const float intervals[], int count, float phase)
+{
+ return ToPathEffect(SkDashPathEffect::Make(intervals, count, phase).release());
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkPicture.h"
+
+#include "sk_picture.h"
+
+#include "sk_types_priv.h"
+
+sk_picture_recorder_t* sk_picture_recorder_new() {
+ return ToPictureRecorder(new SkPictureRecorder);
+}
+
+void sk_picture_recorder_delete(sk_picture_recorder_t* crec) {
+ delete AsPictureRecorder(crec);
+}
+
+sk_canvas_t* sk_picture_recorder_begin_recording(sk_picture_recorder_t* crec,
+ const sk_rect_t* cbounds) {
+ return ToCanvas(AsPictureRecorder(crec)->beginRecording(AsRect(*cbounds)));
+}
+
+sk_picture_t* sk_picture_recorder_end_recording(sk_picture_recorder_t* crec) {
+ return ToPicture(AsPictureRecorder(crec)->finishRecordingAsPicture().release());
+}
+
+void sk_picture_ref(sk_picture_t* cpic) {
+ SkSafeRef(AsPicture(cpic));
+}
+
+void sk_picture_unref(sk_picture_t* cpic) {
+ SkSafeUnref(AsPicture(cpic));
+}
+
+uint32_t sk_picture_get_unique_id(sk_picture_t* cpic) {
+ return AsPicture(cpic)->uniqueID();
+}
+
+sk_rect_t sk_picture_get_bounds(sk_picture_t* cpic) {
+ return ToRect(AsPicture(cpic)->cullRect());
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkShader.h"
+#include "SkComposeShader.h"
+#include "SkColorFilter.h"
+#include "SkGradientShader.h"
+#include "SkPerlinNoiseShader.h"
+
+#include "sk_shader.h"
+
+#include "sk_types_priv.h"
+
+sk_shader_t* sk_shader_new_empty() {
+ return ToShader(SkShader::MakeEmptyShader().release());
+}
+
+sk_shader_t* sk_shader_new_color(sk_color_t color) {
+ return ToShader(SkShader::MakeColorShader(color).release());
+}
+
+sk_shader_t* sk_shader_new_bitmap(const sk_bitmap_t* src,
+ sk_shader_tilemode_t tmx,
+ sk_shader_tilemode_t tmy,
+ const sk_matrix_t* localMatrix) {
+ SkMatrix matrix;
+ if (localMatrix) {
+ from_c(localMatrix, &matrix);
+ } else {
+ matrix.setIdentity();
+ }
+ sk_sp<SkShader> s = SkShader::MakeBitmapShader(
+ *AsBitmap(src),
+ (SkShader::TileMode)tmx,
+ (SkShader::TileMode)tmy,
+ &matrix);
+ return ToShader(s.release());
+}
+
+sk_shader_t* sk_shader_new_picture(sk_picture_t* src,
+ sk_shader_tilemode_t tmx,
+ sk_shader_tilemode_t tmy,
+ const sk_matrix_t* localMatrix,
+ const sk_rect_t* tile) {
+ SkMatrix matrix;
+ if (localMatrix) {
+ from_c(localMatrix, &matrix);
+ }
+ else {
+ matrix.setIdentity();
+ }
+ sk_sp<SkShader> s = SkShader::MakePictureShader(
+ sk_ref_sp(AsPicture(src)),
+ (SkShader::TileMode)tmx,
+ (SkShader::TileMode)tmy,
+ &matrix,
+ AsRect(tile));
+ return ToShader(s.release());
+}
+
+sk_shader_t* sk_shader_new_color_filter(sk_shader_t* proxy,
+ sk_colorfilter_t* filter) {
+ sk_sp<SkShader> s = AsShader(proxy)->makeWithColorFilter(sk_ref_sp(AsColorFilter(filter)));
+ return ToShader(s.release());
+}
+
+sk_shader_t* sk_shader_new_local_matrix(sk_shader_t* proxy,
+ const sk_matrix_t* localMatrix) {
+ SkMatrix matrix;
+ if (localMatrix) {
+ from_c(localMatrix, &matrix);
+ } else {
+ matrix.setIdentity();
+ }
+ sk_sp<SkShader> s = AsShader(proxy)->makeWithLocalMatrix(matrix);
+ return ToShader(s.release());
+}
+
+sk_shader_t* sk_shader_new_perlin_noise_fractal_noise(
+ float baseFrequencyX,
+ float baseFrequencyY,
+ int numOctaves,
+ float seed,
+ const sk_isize_t* ctileSize) {
+
+ const SkISize* tileSize = AsISize(ctileSize);
+ sk_sp<SkShader> s = SkPerlinNoiseShader::MakeFractalNoise(
+ baseFrequencyX,
+ baseFrequencyY,
+ numOctaves,
+ seed,
+ tileSize);
+ return ToShader(s.release());
+}
+
+sk_shader_t* sk_shader_new_perlin_noise_turbulence(
+ float baseFrequencyX,
+ float baseFrequencyY,
+ int numOctaves,
+ float seed,
+ const sk_isize_t* ctileSize) {
+
+ const SkISize* tileSize = AsISize(ctileSize);
+ sk_sp<SkShader> s = SkPerlinNoiseShader::MakeTurbulence(
+ baseFrequencyX,
+ baseFrequencyY,
+ numOctaves,
+ seed,
+ tileSize);
+ return ToShader(s.release());
+}
+
+sk_shader_t* sk_shader_new_compose(
+ sk_shader_t* shaderA,
+ sk_shader_t* shaderB) {
+
+ sk_sp<SkShader> s = SkShader::MakeComposeShader(
+ sk_ref_sp(AsShader(shaderA)),
+ sk_ref_sp(AsShader(shaderB)),
+ SkXfermode::kSrcOver_Mode);
+ return ToShader(s.release());
+}
+
+sk_shader_t* sk_shader_new_compose_with_mode(
+ sk_shader_t* shaderA,
+ sk_shader_t* shaderB,
+ sk_xfermode_mode_t cmode) {
+
+ sk_sp<SkShader> s = SkShader::MakeComposeShader(
+ sk_ref_sp(AsShader(shaderA)),
+ sk_ref_sp(AsShader(shaderB)),
+ (SkXfermode::Mode)cmode);
+ return ToShader(s.release());
+}
+
+void sk_shader_ref(sk_shader_t* cshader) {
+ SkSafeRef(AsShader(cshader));
+}
+
+void sk_shader_unref(sk_shader_t* cshader) {
+ SkSafeUnref(AsShader(cshader));
+}
+
+sk_shader_t* sk_shader_new_linear_gradient(const sk_point_t pts[2],
+ const sk_color_t colors[],
+ const float colorPos[],
+ int colorCount,
+ sk_shader_tilemode_t cmode,
+ const sk_matrix_t* cmatrix) {
+ SkMatrix matrix;
+ if (cmatrix) {
+ from_c(cmatrix, &matrix);
+ } else {
+ matrix.setIdentity();
+ }
+ return (sk_shader_t*)SkGradientShader::MakeLinear(reinterpret_cast<const SkPoint*>(pts),
+ reinterpret_cast<const SkColor*>(colors),
+ colorPos, colorCount,
+ (SkShader::TileMode)cmode, 0, &matrix).release();
+}
+
+sk_shader_t* sk_shader_new_radial_gradient(const sk_point_t* ccenter,
+ float radius,
+ const sk_color_t colors[],
+ const float colorPos[],
+ int colorCount,
+ sk_shader_tilemode_t cmode,
+ const sk_matrix_t* cmatrix) {
+ SkMatrix matrix;
+ if (cmatrix) {
+ from_c(cmatrix, &matrix);
+ } else {
+ matrix.setIdentity();
+ }
+ SkPoint center = AsPoint(*ccenter);
+ return (sk_shader_t*)SkGradientShader::MakeRadial(center, (SkScalar)radius,
+ reinterpret_cast<const SkColor*>(colors),
+ reinterpret_cast<const SkScalar*>(colorPos),
+ colorCount, (SkShader::TileMode)cmode, 0, &matrix).release();
+}
+
+sk_shader_t* sk_shader_new_sweep_gradient(const sk_point_t* ccenter,
+ const sk_color_t colors[],
+ const float colorPos[],
+ int colorCount,
+ const sk_matrix_t* cmatrix) {
+ SkMatrix matrix;
+ if (cmatrix) {
+ from_c(cmatrix, &matrix);
+ } else {
+ matrix.setIdentity();
+ }
+ return (sk_shader_t*)SkGradientShader::MakeSweep((SkScalar)(ccenter->x),
+ (SkScalar)(ccenter->y),
+ reinterpret_cast<const SkColor*>(colors),
+ reinterpret_cast<const SkScalar*>(colorPos),
+ colorCount, 0, &matrix).release();
+}
+
+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 cmode,
+ const sk_matrix_t* cmatrix) {
+ SkMatrix matrix;
+ if (cmatrix) {
+ from_c(cmatrix, &matrix);
+ } else {
+ matrix.setIdentity();
+ }
+ SkPoint skstart = AsPoint(*start);
+ SkPoint skend = AsPoint(*end);
+ return (sk_shader_t*)SkGradientShader::MakeTwoPointConical(skstart, (SkScalar)startRadius,
+ skend, (SkScalar)endRadius,
+ reinterpret_cast<const SkColor*>(colors),
+ reinterpret_cast<const SkScalar*>(colorPos),
+ colorCount, (SkShader::TileMode)cmode, 0, &matrix).release();
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkStream.h"
+
+#include "sk_stream.h"
+
+#include "sk_types_priv.h"
+
+void sk_stream_asset_destroy(sk_stream_asset_t* cstream)
+{
+ delete AsStreamAsset(cstream);
+}
+
+void sk_filestream_destroy(sk_stream_filestream_t* cstream)
+{
+ delete AsFileStream(cstream);
+}
+
+void sk_memorystream_destroy(sk_stream_memorystream_t* cstream)
+{
+ delete AsMemoryStream(cstream);
+}
+
+sk_stream_filestream_t* sk_filestream_new (const char* path)
+{
+ return ToFileStream(new SkFILEStream(path));
+}
+
+sk_stream_memorystream_t* sk_memorystream_new ()
+{
+ return ToMemoryStream(new SkMemoryStream());
+}
+sk_stream_memorystream_t* sk_memorystream_new_with_length (size_t length)
+{
+ return ToMemoryStream(new SkMemoryStream(length));
+}
+sk_stream_memorystream_t* sk_memorystream_new_with_data (const void* data, size_t length, bool copyData)
+{
+ return ToMemoryStream(new SkMemoryStream(data, length, copyData));
+}
+sk_stream_memorystream_t* sk_memorystream_new_with_skdata (sk_data_t* data)
+{
+ return ToMemoryStream(new SkMemoryStream(AsData(data)));
+}
+void sk_memorystream_set_memory (sk_stream_memorystream_t* cmemorystream, const void* data, size_t length, bool copyData)
+{
+ AsMemoryStream(cmemorystream)->setMemory(data, length, copyData);
+}
+
+size_t sk_stream_read (sk_stream_t* cstream, void* buffer, size_t size)
+{
+ return AsStream(cstream)->read(buffer, size);
+}
+
+size_t sk_stream_skip (sk_stream_t* cstream, size_t size)
+{
+ return AsStream(cstream)->skip(size);
+}
+
+bool sk_stream_is_at_end (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->isAtEnd();
+}
+int8_t sk_stream_read_s8 (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->readS8();
+}
+int16_t sk_stream_read_s16 (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->readS16();
+}
+int32_t sk_stream_read_s32 (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->readS32();
+}
+uint8_t sk_stream_read_u8 (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->readU8();
+}
+uint16_t sk_stream_read_u16 (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->readU16();
+}
+uint32_t sk_stream_read_u32 (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->readU32();
+}
+bool sk_stream_read_bool (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->readBool();
+}
+
+bool sk_stream_rewind (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->rewind();
+}
+
+bool sk_stream_has_position (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->hasPosition();
+}
+
+size_t sk_stream_get_position (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->getPosition();
+}
+
+bool sk_stream_seek (sk_stream_t* cstream, size_t position)
+{
+ return AsStream(cstream)->seek(position);
+}
+
+bool sk_stream_move (sk_stream_t* cstream, long offset)
+{
+ return AsStream(cstream)->move(offset);
+}
+
+bool sk_stream_has_length (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->hasLength();
+}
+
+size_t sk_stream_get_length (sk_stream_t* cstream)
+{
+ return AsStream(cstream)->getLength();
+}
+
+void sk_filewstream_destroy(sk_wstream_filestream_t* cstream)
+{
+ delete AsFileWStream(cstream);
+}
+
+void sk_dynamicmemorywstream_destroy(sk_wstream_dynamicmemorystream_t* cstream)
+{
+ delete AsDynamicMemoryWStream(cstream);
+}
+
+sk_wstream_filestream_t* sk_filewstream_new(const char* path)
+{
+ return ToFileWStream(new SkFILEWStream(path));
+}
+
+sk_wstream_dynamicmemorystream_t* sk_dynamicmemorywstream_new()
+{
+ return ToDynamicMemoryWStream(new SkDynamicMemoryWStream());
+}
+
+sk_data_t* sk_dynamicmemorywstream_copy_to_data(sk_wstream_dynamicmemorystream_t* cstream)
+{
+ return ToData(AsDynamicMemoryWStream(cstream)->copyToData());
+}
+
+sk_stream_asset_t* sk_dynamicmemorywstream_detach_as_stream(sk_wstream_dynamicmemorystream_t* cstream)
+{
+ return ToStreamAsset(AsDynamicMemoryWStream(cstream)->detachAsStream());
+}
+
+bool sk_wstream_write(sk_wstream_t* cstream, const void* buffer, size_t size)
+{
+ return AsWStream(cstream)->write(buffer, size);
+}
+
+void sk_wstream_newline(sk_wstream_t* cstream)
+{
+ return AsWStream(cstream)->newline();
+}
+
+void sk_wstream_flush(sk_wstream_t* cstream)
+{
+ return AsWStream(cstream)->flush();
+}
+
+size_t sk_wstream_bytes_written(sk_wstream_t* cstream)
+{
+ return AsWStream(cstream)->bytesWritten();
+}
+
+bool sk_wstream_write_8(sk_wstream_t* cstream, uint8_t value)
+{
+ return AsWStream(cstream)->write8(value);
+}
+
+bool sk_wstream_write_16(sk_wstream_t* cstream, uint16_t value)
+{
+ return AsWStream(cstream)->write16(value);
+}
+
+bool sk_wstream_write_32(sk_wstream_t* cstream, uint32_t value)
+{
+ return AsWStream(cstream)->write32(value);
+}
+
+bool sk_wstream_write_text(sk_wstream_t* cstream, const char* value)
+{
+ return AsWStream(cstream)->writeText(value);
+}
+
+bool sk_wstream_write_dec_as_text(sk_wstream_t* cstream, int32_t value)
+{
+ return AsWStream(cstream)->writeDecAsText(value);
+}
+
+bool sk_wstream_write_bigdec_as_text(sk_wstream_t* cstream, int64_t value, int minDigits)
+{
+ return AsWStream(cstream)->writeBigDecAsText(value, minDigits);
+}
+
+bool sk_wstream_write_hex_as_text(sk_wstream_t* cstream, uint32_t value, int minDigits)
+{
+ return AsWStream(cstream)->writeHexAsText(value, minDigits);
+}
+
+bool sk_wstream_write_scalar_as_text(sk_wstream_t* cstream, float value)
+{
+ return AsWStream(cstream)->writeScalarAsText(value);
+}
+
+bool sk_wstream_write_bool(sk_wstream_t* cstream, bool value)
+{
+ return AsWStream(cstream)->writeBool(value);
+}
+
+bool sk_wstream_write_scalar(sk_wstream_t* cstream, float value)
+{
+ return AsWStream(cstream)->writeScalar(value);
+}
+
+bool sk_wstream_write_packed_uint(sk_wstream_t* cstream, size_t value)
+{
+ return AsWStream(cstream)->writePackedUInt(value);
+}
+
+bool sk_wstream_write_stream(sk_wstream_t* cstream, sk_stream_t* input, size_t length)
+{
+ return AsWStream(cstream)->writeStream(AsStream(input), length);
+}
+
+int sk_wstream_get_size_of_packed_uint(size_t value)
+{
+ return SkWStream::SizeOfPackedUInt(value);
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkString.h"
+
+#include "sk_string.h"
+
+#include "sk_types_priv.h"
+
+sk_string_t* sk_string_new_empty() {
+ return ToString(new SkString());
+}
+
+sk_string_t* sk_string_new_with_copy(const char* src, size_t length) {
+ return ToString(new SkString(src, length));
+}
+
+void sk_string_destructor(const sk_string_t* cstring) {
+ delete AsString(cstring);
+}
+
+size_t sk_string_get_size(const sk_string_t* cstring) {
+ return AsString(cstring)->size();
+}
+
+const char* sk_string_get_c_str(const sk_string_t* cstring) {
+ return AsString(cstring)->c_str();
+}
#include "sk_path.h"
#include "sk_picture.h"
#include "sk_surface.h"
-#include "sk_types_priv.h"
-#include "xamarin/sk_x_types_priv.h"
-///////////////////////////////////////////////////////////////////////////////////////////
+#include "sk_types_priv.h"
sk_colortype_t sk_colortype_get_default_8888() {
return (sk_colortype_t)SkColorType::kN32_SkColorType;
}
-///////////////////////////////////////////////////////////////////////////////////////////
-
-sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t* cinfo, const void* pixels,
- size_t rowBytes) {
- const SkImageInfo* info = AsImageInfo(cinfo);
- return (sk_image_t*)SkImage::MakeRasterCopy(SkPixmap(*info, pixels, rowBytes)).release();
-}
-
-sk_image_t* sk_image_new_from_encoded(const sk_data_t* cdata, const sk_irect_t* subset) {
- return ToImage(SkImage::MakeFromEncoded(sk_ref_sp(AsData(cdata)),
- reinterpret_cast<const SkIRect*>(subset)).release());
-}
-
-sk_data_t* sk_image_encode(const sk_image_t* cimage) {
- return ToData(AsImage(cimage)->encode());
-}
-
-void sk_image_ref(const sk_image_t* cimage) {
- AsImage(cimage)->ref();
-}
-
-void sk_image_unref(const sk_image_t* cimage) {
- AsImage(cimage)->unref();
-}
-
-int sk_image_get_width(const sk_image_t* cimage) {
- return AsImage(cimage)->width();
-}
-
-int sk_image_get_height(const sk_image_t* cimage) {
- return AsImage(cimage)->height();
-}
-
-uint32_t sk_image_get_unique_id(const sk_image_t* cimage) {
- return AsImage(cimage)->uniqueID();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-sk_path_t* sk_path_new() { return (sk_path_t*)new SkPath; }
-
-void sk_path_delete(sk_path_t* cpath) { delete AsPath(cpath); }
-
-void sk_path_move_to(sk_path_t* cpath, float x, float y) {
- AsPath(cpath)->moveTo(x, y);
-}
-
-void sk_path_line_to(sk_path_t* cpath, float x, float y) {
- AsPath(cpath)->lineTo(x, y);
-}
-
-void sk_path_quad_to(sk_path_t* cpath, float x0, float y0, float x1, float y1) {
- AsPath(cpath)->quadTo(x0, y0, x1, y1);
-}
-
-void sk_path_conic_to(sk_path_t* cpath, float x0, float y0, float x1, float y1, float w) {
- AsPath(cpath)->conicTo(x0, y0, x1, y1, w);
-}
-
-void sk_path_cubic_to(sk_path_t* cpath, float x0, float y0, float x1, float y1, float x2, float y2) {
- AsPath(cpath)->cubicTo(x0, y0, x1, y1, x2, y2);
-}
-
-void sk_path_close(sk_path_t* cpath) {
- AsPath(cpath)->close();
-}
-
-void sk_path_add_rect(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir) {
- AsPath(cpath)->addRect(AsRect(*crect), (SkPath::Direction)cdir);
-}
-
-void sk_path_add_oval(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir) {
- AsPath(cpath)->addOval(AsRect(*crect), (SkPath::Direction)cdir);
-}
-
-bool sk_path_get_bounds(const sk_path_t* cpath, sk_rect_t* crect) {
- const SkPath& path = AsPath(*cpath);
-
- if (path.isEmpty()) {
- if (crect) {
- *crect = ToRect(SkRect::MakeEmpty());
- }
- return false;
- }
-
- if (crect) {
- *crect = ToRect(path.getBounds());
- }
- return true;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-int sk_canvas_save(sk_canvas_t* ccanvas) {
- return AsCanvas(ccanvas)->save();
-}
-
-int sk_canvas_save_layer(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint) {
- return AsCanvas(ccanvas)->saveLayer(AsRect(crect), AsPaint(cpaint));
-}
-
-void sk_canvas_restore(sk_canvas_t* ccanvas) {
- AsCanvas(ccanvas)->restore();
-}
-
-void sk_canvas_translate(sk_canvas_t* ccanvas, float dx, float dy) {
- AsCanvas(ccanvas)->translate(dx, dy);
-}
-
-void sk_canvas_scale(sk_canvas_t* ccanvas, float sx, float sy) {
- AsCanvas(ccanvas)->scale(sx, sy);
-}
-
-void sk_canvas_rotate_degrees(sk_canvas_t* ccanvas, float degrees) {
- AsCanvas(ccanvas)->rotate(degrees);
-}
-
-void sk_canvas_rotate_radians(sk_canvas_t* ccanvas, float radians) {
- AsCanvas(ccanvas)->rotate(SkRadiansToDegrees(radians));
-}
-
-void sk_canvas_skew(sk_canvas_t* ccanvas, float sx, float sy) {
- AsCanvas(ccanvas)->skew(sx, sy);
-}
-
-void sk_canvas_concat(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix) {
- SkASSERT(cmatrix);
- SkMatrix matrix;
- from_c(cmatrix, &matrix);
- AsCanvas(ccanvas)->concat(matrix);
-}
-
-void sk_canvas_clip_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect) {
- AsCanvas(ccanvas)->clipRect(AsRect(*crect));
-}
-
-void sk_canvas_clip_path(sk_canvas_t* ccanvas, const sk_path_t* cpath) {
- AsCanvas(ccanvas)->clipPath(AsPath(*cpath));
-}
-
-void sk_canvas_draw_paint(sk_canvas_t* ccanvas, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawPaint(AsPaint(*cpaint));
-}
-
-void sk_canvas_draw_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawRect(AsRect(*crect), AsPaint(*cpaint));
-}
-
-void sk_canvas_draw_circle(sk_canvas_t* ccanvas, float cx, float cy, float rad,
- const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawCircle(cx, cy, rad, AsPaint(*cpaint));
-}
-
-void sk_canvas_draw_oval(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawOval(AsRect(*crect), AsPaint(*cpaint));
-}
-
-void sk_canvas_draw_path(sk_canvas_t* ccanvas, const sk_path_t* cpath, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawPath(AsPath(*cpath), AsPaint(*cpaint));
-}
-
-void sk_canvas_draw_image(sk_canvas_t* ccanvas, const sk_image_t* cimage, float x, float y,
- const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawImage(AsImage(cimage), x, y, AsPaint(cpaint));
-}
-
-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) {
- SkCanvas* canvas = AsCanvas(ccanvas);
- const SkImage* image = AsImage(cimage);
- const SkRect& dst = AsRect(*cdstR);
- const SkPaint* paint = AsPaint(cpaint);
-
- if (csrcR) {
- canvas->drawImageRect(image, AsRect(*csrcR), dst, paint);
- } else {
- canvas->drawImageRect(image, dst, paint);
- }
-}
-
-void sk_canvas_draw_picture(sk_canvas_t* ccanvas, const sk_picture_t* cpicture,
- const sk_matrix_t* cmatrix, const sk_paint_t* cpaint) {
- const SkMatrix* matrixPtr = NULL;
- SkMatrix matrix;
- if (cmatrix) {
- from_c(cmatrix, &matrix);
- matrixPtr = &matrix;
- }
- AsCanvas(ccanvas)->drawPicture(AsPicture(cpicture), matrixPtr, AsPaint(cpaint));
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t* cinfo,
const sk_surfaceprops_t* props) {
const SkImageInfo* info = AsImageInfo(cinfo);
SkSurface* surf = (SkSurface*)csurf;
return (sk_image_t*)surf->makeImageSnapshot().release();
}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-sk_picture_recorder_t* sk_picture_recorder_new() {
- return ToPictureRecorder(new SkPictureRecorder);
-}
-
-void sk_picture_recorder_delete(sk_picture_recorder_t* crec) {
- delete AsPictureRecorder(crec);
-}
-
-sk_canvas_t* sk_picture_recorder_begin_recording(sk_picture_recorder_t* crec,
- const sk_rect_t* cbounds) {
- return ToCanvas(AsPictureRecorder(crec)->beginRecording(AsRect(*cbounds)));
-}
-
-sk_picture_t* sk_picture_recorder_end_recording(sk_picture_recorder_t* crec) {
- return ToPicture(AsPictureRecorder(crec)->finishRecordingAsPicture().release());
-}
-
-void sk_picture_ref(sk_picture_t* cpic) {
- SkSafeRef(AsPicture(cpic));
-}
-
-void sk_picture_unref(sk_picture_t* cpic) {
- SkSafeUnref(AsPicture(cpic));
-}
-
-uint32_t sk_picture_get_unique_id(sk_picture_t* cpic) {
- return AsPicture(cpic)->uniqueID();
-}
-
-sk_rect_t sk_picture_get_bounds(sk_picture_t* cpic) {
- return ToRect(AsPicture(cpic)->cullRect());
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#include "../../include/effects/SkGradientShader.h"
-#include "sk_shader.h"
-
-void sk_shader_ref(sk_shader_t* cshader) {
- SkSafeRef(AsShader(cshader));
-}
-
-void sk_shader_unref(sk_shader_t* cshader) {
- SkSafeUnref(AsShader(cshader));
-}
-
-sk_shader_t* sk_shader_new_linear_gradient(const sk_point_t pts[2],
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- sk_shader_tilemode_t cmode,
- const sk_matrix_t* cmatrix) {
- SkMatrix matrix;
- if (cmatrix) {
- from_c(cmatrix, &matrix);
- } else {
- matrix.setIdentity();
- }
- return (sk_shader_t*)SkGradientShader::MakeLinear(reinterpret_cast<const SkPoint*>(pts),
- reinterpret_cast<const SkColor*>(colors),
- colorPos, colorCount,
- (SkShader::TileMode)cmode, 0, &matrix).release();
-}
-
-sk_shader_t* sk_shader_new_radial_gradient(const sk_point_t* ccenter,
- float radius,
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- sk_shader_tilemode_t cmode,
- const sk_matrix_t* cmatrix) {
- SkMatrix matrix;
- if (cmatrix) {
- from_c(cmatrix, &matrix);
- } else {
- matrix.setIdentity();
- }
- SkPoint center = AsPoint(*ccenter);
- return (sk_shader_t*)SkGradientShader::MakeRadial(center, (SkScalar)radius,
- reinterpret_cast<const SkColor*>(colors),
- reinterpret_cast<const SkScalar*>(colorPos),
- colorCount, (SkShader::TileMode)cmode, 0, &matrix).release();
-}
-
-sk_shader_t* sk_shader_new_sweep_gradient(const sk_point_t* ccenter,
- const sk_color_t colors[],
- const float colorPos[],
- int colorCount,
- const sk_matrix_t* cmatrix) {
- SkMatrix matrix;
- if (cmatrix) {
- from_c(cmatrix, &matrix);
- } else {
- matrix.setIdentity();
- }
- return (sk_shader_t*)SkGradientShader::MakeSweep((SkScalar)(ccenter->x),
- (SkScalar)(ccenter->y),
- reinterpret_cast<const SkColor*>(colors),
- reinterpret_cast<const SkScalar*>(colorPos),
- colorCount, 0, &matrix).release();
-}
-
-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 cmode,
- const sk_matrix_t* cmatrix) {
- SkMatrix matrix;
- if (cmatrix) {
- from_c(cmatrix, &matrix);
- } else {
- matrix.setIdentity();
- }
- SkPoint skstart = AsPoint(*start);
- SkPoint skend = AsPoint(*end);
- return (sk_shader_t*)SkGradientShader::MakeTwoPointConical(skstart, (SkScalar)startRadius,
- skend, (SkScalar)endRadius,
- reinterpret_cast<const SkColor*>(colors),
- reinterpret_cast<const SkScalar*>(colorPos),
- colorCount, (SkShader::TileMode)cmode, 0, &matrix).release();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-#include "../../include/effects/SkBlurMaskFilter.h"
-#include "sk_maskfilter.h"
-
-void sk_maskfilter_ref(sk_maskfilter_t* cfilter) {
- SkSafeRef(AsMaskFilter(cfilter));
-}
-
-void sk_maskfilter_unref(sk_maskfilter_t* cfilter) {
- SkSafeUnref(AsMaskFilter(cfilter));
-}
-
-sk_maskfilter_t* sk_maskfilter_new_blur(sk_blurstyle_t cstyle, float sigma) {
- return ToMaskFilter(SkBlurMaskFilter::Make((SkBlurStyle)cstyle, sigma).release());
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
-
-sk_data_t* sk_data_new_empty() {
- return ToData(SkData::NewEmpty());
-}
-
-sk_data_t* sk_data_new_with_copy(const void* src, size_t length) {
- return ToData(SkData::MakeWithCopy(src, length).release());
-}
-
-sk_data_t* sk_data_new_from_malloc(const void* memory, size_t length) {
- return ToData(SkData::MakeFromMalloc(memory, length).release());
-}
-
-sk_data_t* sk_data_new_subset(const sk_data_t* csrc, size_t offset, size_t length) {
- return ToData(SkData::MakeSubset(AsData(csrc), offset, length).release());
-}
-
-void sk_data_ref(const sk_data_t* cdata) {
- SkSafeRef(AsData(cdata));
-}
-
-void sk_data_unref(const sk_data_t* cdata) {
- SkSafeUnref(AsData(cdata));
-}
-
-size_t sk_data_get_size(const sk_data_t* cdata) {
- return AsData(cdata)->size();
-}
-
-const void* sk_data_get_data(const sk_data_t* cdata) {
- return AsData(cdata)->data();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkTypeface.h"
+
+#include "sk_typeface.h"
+
+#include "sk_types_priv.h"
+
+void sk_typeface_unref(sk_typeface_t* tf)
+{
+ AsTypeface(tf)->unref();
+}
+
+sk_typeface_t* sk_typeface_create_from_name(const char *familyName, sk_typeface_style_t sstyle)
+{
+ return ToTypeface(SkTypeface::MakeFromName (familyName, SkFontStyle::FromOldStyle((SkTypeface::Style)sstyle)).release());
+}
+
+sk_typeface_t* sk_typeface_create_from_name_with_font_style(const char *familyName, int weight, int width, sk_font_style_slant_t slant)
+{
+ return ToTypeface(SkTypeface::MakeFromName (familyName, SkFontStyle(weight, width, (SkFontStyle::Slant)slant)).release());
+}
+
+sk_typeface_t* sk_typeface_create_from_typeface(sk_typeface_t* typeface, sk_typeface_style_t sstyle)
+{
+ return ToTypeface(SkTypeface::MakeFromTypeface (AsTypeface(typeface), (SkTypeface::Style)sstyle).release());
+}
+
+sk_typeface_t* sk_typeface_create_from_file(const char* path, int index)
+{
+ return ToTypeface(SkTypeface::MakeFromFile (path, index).release());
+}
+
+sk_typeface_t* sk_typeface_create_from_stream(sk_stream_asset_t* stream, int index)
+{
+ return ToTypeface(SkTypeface::MakeFromStream (AsStreamAsset(stream), index).release());
+}
+
+int sk_typeface_chars_to_glyphs (sk_typeface_t* typeface, const char *chars, sk_encoding_t encoding, uint16_t glyphs [], int glyphCount)
+{
+ return (AsTypeface(typeface))->charsToGlyphs(chars, (SkTypeface::Encoding)encoding, glyphs, glyphCount);
+}
+
+int sk_typeface_glyph_count (sk_typeface_t* typeface)
+{
+ return AsTypeface(typeface)->countGlyphs();
+}
+
+sk_string_t* sk_typeface_get_family_name(sk_typeface_t* typeface)
+{
+ SkString* family_name = new SkString();
+ AsTypeface(typeface)->getFamilyName(family_name);
+ return ToString(family_name);
+}
+
+int sk_typeface_count_tables(sk_typeface_t* typeface)
+{
+ return AsTypeface(typeface)->countTables();
+}
+
+int sk_typeface_get_table_tags(sk_typeface_t* typeface, sk_font_table_tag_t tags[])
+{
+ return AsTypeface(typeface)->getTableTags(tags);
+}
+
+size_t sk_typeface_get_table_size(sk_typeface_t* typeface, sk_font_table_tag_t tag)
+{
+ return AsTypeface(typeface)->getTableSize(tag);
+}
+
+size_t sk_typeface_get_table_data(sk_typeface_t* typeface, sk_font_table_tag_t tag, size_t offset, size_t length, void* data)
+{
+ return AsTypeface(typeface)->getTableData(tag, offset, length, data);
+}
#ifndef sk_types_priv_DEFINED
#define sk_types_priv_DEFINED
+#include "SkImageInfo.h"
+#include "SkBlurTypes.h"
+#include "SkDocument.h"
+#include "SkPaint.h"
+#include "SkPath.h"
+#include "SkCodec.h"
+#include "SkPicture.h"
+#include "SkPictureRecorder.h"
+#include "SkPoint3.h"
+#include "SkStream.h"
+#include "SkString.h"
+#include "SkDisplacementMapEffect.h"
+#include "SkDropShadowImageFilter.h"
+#include "SkMatrixConvolutionImageFilter.h"
+#include "Sk1DPathEffect.h"
+#include "SkFontStyle.h"
+
+#include "sk_path.h"
+#include "sk_paint.h"
+#include "sk_shader.h"
+#include "sk_maskfilter.h"
+
#include "sk_types.h"
class SkMaskFilter;
return reinterpret_cast<SkShader*>(cshader);
}
+static inline SkRect* AsRect(sk_rect_t* crect) {
+ return reinterpret_cast<SkRect*>(crect);
+}
+
+static inline const SkRect* AsRect(const sk_rect_t* crect) {
+ return reinterpret_cast<const SkRect*>(crect);
+}
+
+static inline const SkRect& AsRect(const sk_rect_t& crect) {
+ return reinterpret_cast<const SkRect&>(crect);
+}
+
+static inline sk_rect_t ToRect(const SkRect& rect) {
+ return reinterpret_cast<const sk_rect_t&>(rect);
+}
+
+static inline SkIRect* AsIRect(sk_irect_t* crect) {
+ return reinterpret_cast<SkIRect*>(crect);
+}
+
+static inline const SkIRect* AsIRect(const sk_irect_t* crect) {
+ return reinterpret_cast<const SkIRect*>(crect);
+}
+
+static inline const SkIRect& AsIRect(const sk_irect_t& crect) {
+ return reinterpret_cast<const SkIRect&>(crect);
+}
+
+static inline const SkBitmap* AsBitmap(const sk_bitmap_t* cbitmap) {
+ return reinterpret_cast<const SkBitmap*>(cbitmap);
+}
+
+static inline const SkBitmap& AsBitmap(const sk_bitmap_t& cbitmap) {
+ return reinterpret_cast<const SkBitmap&>(cbitmap);
+}
+
+static inline SkBitmap* AsBitmap(sk_bitmap_t* cbitmap) {
+ return reinterpret_cast<SkBitmap*>(cbitmap);
+}
+
+static inline SkData* AsData(const sk_data_t* cdata) {
+ return reinterpret_cast<SkData*>(const_cast<sk_data_t*>(cdata));
+}
+
+static inline sk_data_t* ToData(SkData* data) {
+ return reinterpret_cast<sk_data_t*>(data);
+}
+
+static inline sk_path_t* ToPath(SkPath* cpath) {
+ return reinterpret_cast<sk_path_t*>(cpath);
+}
+
+static inline const SkPath& AsPath(const sk_path_t& cpath) {
+ return reinterpret_cast<const SkPath&>(cpath);
+}
+
+static inline SkPath* AsPath(sk_path_t* cpath) {
+ return reinterpret_cast<SkPath*>(cpath);
+}
+
+static inline const SkImage* AsImage(const sk_image_t* cimage) {
+ return reinterpret_cast<const SkImage*>(cimage);
+}
+
+static inline sk_image_t* ToImage(SkImage* cimage) {
+ return reinterpret_cast<sk_image_t*>(cimage);
+}
+
+static inline sk_canvas_t* ToCanvas(SkCanvas* canvas) {
+ return reinterpret_cast<sk_canvas_t*>(canvas);
+}
+
+static inline SkCanvas* AsCanvas(sk_canvas_t* ccanvas) {
+ return reinterpret_cast<SkCanvas*>(ccanvas);
+}
+
+static inline SkPictureRecorder* AsPictureRecorder(sk_picture_recorder_t* crec) {
+ return reinterpret_cast<SkPictureRecorder*>(crec);
+}
+
+static inline sk_picture_recorder_t* ToPictureRecorder(SkPictureRecorder* rec) {
+ return reinterpret_cast<sk_picture_recorder_t*>(rec);
+}
+
+static inline const SkPicture* AsPicture(const sk_picture_t* cpic) {
+ return reinterpret_cast<const SkPicture*>(cpic);
+}
+
+static inline SkPicture* AsPicture(sk_picture_t* cpic) {
+ return reinterpret_cast<SkPicture*>(cpic);
+}
+
+static inline sk_picture_t* ToPicture(SkPicture* pic) {
+ return reinterpret_cast<sk_picture_t*>(pic);
+}
+
+static inline SkImageFilter* AsImageFilter(sk_imagefilter_t* cfilter) {
+ return reinterpret_cast<SkImageFilter*>(cfilter);
+}
+
+static inline SkImageFilter** AsImageFilters(sk_imagefilter_t** cfilter) {
+ return reinterpret_cast<SkImageFilter**>(cfilter);
+}
+
+static inline sk_imagefilter_t* ToImageFilter(SkImageFilter* filter) {
+ return reinterpret_cast<sk_imagefilter_t*>(filter);
+}
+
+static inline SkColorFilter* AsColorFilter(sk_colorfilter_t* cfilter) {
+ return reinterpret_cast<SkColorFilter*>(cfilter);
+}
+
+static inline sk_colorfilter_t* ToColorFilter(SkColorFilter* filter) {
+ return reinterpret_cast<sk_colorfilter_t*>(filter);
+}
+
+static inline const SkCodec* AsCodec(const sk_codec_t* codec) {
+ return reinterpret_cast<const SkCodec*>(codec);
+}
+
+static inline const SkCodec& AsCodec(const sk_codec_t& codec) {
+ return reinterpret_cast<const SkCodec&>(codec);
+}
+
+static inline SkCodec* AsCodec(sk_codec_t* codec) {
+ return reinterpret_cast<SkCodec*>(codec);
+}
+
+static inline sk_codec_t* ToCodec(SkCodec* codec) {
+ return reinterpret_cast<sk_codec_t*>(codec);
+}
+
+static inline SkTypeface* AsTypeface(sk_typeface_t* typeface) {
+ return reinterpret_cast<SkTypeface*>(typeface);
+}
+
+static inline sk_typeface_t* ToTypeface(SkTypeface* typeface) {
+ return reinterpret_cast<sk_typeface_t*>(typeface);
+}
+
+static inline sk_colorspace_t* ToColorSpace(SkColorSpace* colorspace) {
+ return reinterpret_cast<sk_colorspace_t*>(colorspace);
+}
+
+static inline void from_c(const sk_matrix_t* cmatrix, SkMatrix* matrix) {
+ matrix->setAll(
+ cmatrix->mat[0], cmatrix->mat[1], cmatrix->mat[2],
+ cmatrix->mat[3], cmatrix->mat[4], cmatrix->mat[5],
+ cmatrix->mat[6], cmatrix->mat[7], cmatrix->mat[8]);
+}
+
+static inline void from_sk(const SkMatrix* matrix, sk_matrix_t* cmatrix) {
+ matrix->get9(cmatrix->mat);
+}
+
+static inline sk_shader_t* ToShader(SkShader* shader) {
+ return reinterpret_cast<sk_shader_t*>(shader);
+}
+
+static inline const SkFILEStream* AsFileStream(const sk_stream_filestream_t* cfilestream) {
+ return reinterpret_cast<const SkFILEStream*>(cfilestream);
+}
+
+static inline SkFILEStream* AsFileStream(sk_stream_filestream_t* cfilestream) {
+ return reinterpret_cast<SkFILEStream*>(cfilestream);
+}
+
+static inline sk_stream_filestream_t* ToFileStream(SkFILEStream* stream) {
+ return reinterpret_cast<sk_stream_filestream_t*>(stream);
+}
+
+static inline const SkMemoryStream* AsMemoryStream(const sk_stream_memorystream_t* cmemorystream) {
+ return reinterpret_cast<const SkMemoryStream*>(cmemorystream);
+}
+
+static inline SkMemoryStream* AsMemoryStream(sk_stream_memorystream_t* cmemorystream) {
+ return reinterpret_cast<SkMemoryStream*>(cmemorystream);
+}
+
+static inline sk_stream_memorystream_t* ToMemoryStream(SkMemoryStream* stream) {
+ return reinterpret_cast<sk_stream_memorystream_t*>(stream);
+}
+
+static inline SkStreamRewindable* AsStreamRewindable(sk_stream_streamrewindable_t* cstreamrewindable) {
+ return reinterpret_cast<SkStreamRewindable*>(cstreamrewindable);
+}
+
+static inline const SkStream* AsStream(const sk_stream_t* cstream) {
+ return reinterpret_cast<const SkStream*>(cstream);
+}
+
+static inline SkStream* AsStream(sk_stream_t* cstream) {
+ return reinterpret_cast<SkStream*>(cstream);
+}
+
+static inline sk_stream_t* ToStream(SkStream* cstream) {
+ return reinterpret_cast<sk_stream_t*>(cstream);
+}
+
+static inline sk_stream_asset_t* ToStreamAsset(SkStreamAsset* cstream) {
+ return reinterpret_cast<sk_stream_asset_t*>(cstream);
+}
+
+static inline SkStreamAsset* AsStreamAsset(sk_stream_asset_t* cstream) {
+ return reinterpret_cast<SkStreamAsset*>(cstream);
+}
+
+static inline SkFILEWStream* AsFileWStream(sk_wstream_filestream_t* cfilestream) {
+ return reinterpret_cast<SkFILEWStream*>(cfilestream);
+}
+
+static inline SkDynamicMemoryWStream* AsDynamicMemoryWStream(sk_wstream_dynamicmemorystream_t* cmemorystream) {
+ return reinterpret_cast<SkDynamicMemoryWStream*>(cmemorystream);
+}
+
+static inline SkWStream* AsWStream(sk_wstream_t* cstream) {
+ return reinterpret_cast<SkWStream*>(cstream);
+}
+
+static inline sk_wstream_filestream_t* ToFileWStream(SkFILEWStream* filestream) {
+ return reinterpret_cast<sk_wstream_filestream_t*>(filestream);
+}
+
+static inline sk_wstream_dynamicmemorystream_t* ToDynamicMemoryWStream(SkDynamicMemoryWStream* memorystream) {
+ return reinterpret_cast<sk_wstream_dynamicmemorystream_t*>(memorystream);
+}
+
+static inline sk_wstream_t* ToWStream(SkWStream* stream) {
+ return reinterpret_cast<sk_wstream_t*>(stream);
+}
+
+static inline const SkPoint& AsPoint(const sk_point_t& p) {
+ return reinterpret_cast<const SkPoint&>(p);
+}
+
+static inline const SkPoint* AsPoint(const sk_point_t* p) {
+ return reinterpret_cast<const SkPoint*>(p);
+}
+
+static inline SkPoint* AsPoint(sk_point_t* p) {
+ return reinterpret_cast<SkPoint*>(p);
+}
+
+static inline sk_point_t* ToPoint(SkPoint *p) {
+ return reinterpret_cast<sk_point_t*>(p);
+}
+
+static inline const SkIPoint& AsIPoint(const sk_ipoint_t& p) {
+ return reinterpret_cast<const SkIPoint&>(p);
+}
+
+static inline const SkIPoint* AsIPoint(const sk_ipoint_t* p) {
+ return reinterpret_cast<const SkIPoint*>(p);
+}
+
+static inline const SkSize& AsSize(const sk_size_t& p) {
+ return reinterpret_cast<const SkSize&>(p);
+}
+
+static inline const SkSize* AsSize(const sk_size_t* p) {
+ return reinterpret_cast<const SkSize*>(p);
+}
+
+static inline const SkISize& AsISize(const sk_isize_t& p) {
+ return reinterpret_cast<const SkISize&>(p);
+}
+
+static inline const SkISize* AsISize(const sk_isize_t* p) {
+ return reinterpret_cast<const SkISize*>(p);
+}
+
+static inline SkISize* AsISize(sk_isize_t* p) {
+ return reinterpret_cast<SkISize*>(p);
+}
+
+static inline const sk_isize_t& ToISize(const SkISize& p) {
+ return reinterpret_cast<const sk_isize_t&>(p);
+}
+
+static inline const sk_isize_t* ToISize(const SkISize* p) {
+ return reinterpret_cast<const sk_isize_t*>(p);
+}
+
+static inline const SkPoint3& AsPoint3(const sk_point3_t& p) {
+ return reinterpret_cast<const SkPoint3&>(p);
+}
+
+static inline const SkPoint3* AsPoint3(const sk_point3_t* p) {
+ return reinterpret_cast<const SkPoint3*>(p);
+}
+
+static inline const SkImageFilter::CropRect& AsImageFilterCropRect(const sk_imagefilter_croprect_t& p) {
+ return reinterpret_cast<const SkImageFilter::CropRect&>(p);
+}
+
+static inline const SkImageFilter::CropRect* AsImageFilterCropRect(const sk_imagefilter_croprect_t* p) {
+ return reinterpret_cast<const SkImageFilter::CropRect*>(p);
+}
+
+static inline SkPaint::FontMetrics* AsFontMetrics(sk_fontmetrics_t* p) {
+ return reinterpret_cast<SkPaint::FontMetrics*>(p);
+}
+
+static inline sk_fontmetrics_t* ToFontMetrics(SkPaint::FontMetrics* p) {
+ return reinterpret_cast<sk_fontmetrics_t*>(p);
+}
+
+static inline SkString* AsString(const sk_string_t* cdata) {
+ return reinterpret_cast<SkString*>(const_cast<sk_string_t*>(cdata));
+}
+
+static inline sk_string_t* ToString(SkString* data) {
+ return reinterpret_cast<sk_string_t*>(data);
+}
+
+static inline SkDocument* AsDocument(sk_document_t* cdocument) {
+ return reinterpret_cast<SkDocument*>(cdocument);
+}
+
+static inline sk_document_t* ToDocument(SkDocument* document) {
+ return reinterpret_cast<sk_document_t*>(document);
+}
+
+static inline SkImageInfo* AsImageInfo(sk_imageinfo_t* cinfo) {
+ return reinterpret_cast<SkImageInfo*>(cinfo);
+}
+static inline SkPath::Iter* AsPathIter(sk_path_iterator_t* iter) {
+ return reinterpret_cast<SkPath::Iter*>(iter);
+}
+
+static inline const SkImageInfo* AsImageInfo(const sk_imageinfo_t* cinfo) {
+ return reinterpret_cast<const SkImageInfo*>(cinfo);
+}
+
+static inline sk_imageinfo_t* ToImageInfo(SkImageInfo* info) {
+ return reinterpret_cast<sk_imageinfo_t*>(info);
+}
+
+static inline sk_imageinfo_t& ToImageInfo(SkImageInfo& info) {
+ return reinterpret_cast<sk_imageinfo_t&>(info);
+}
+
+static inline const sk_imageinfo_t* ToImageInfo(const SkImageInfo* info) {
+ return reinterpret_cast<const sk_imageinfo_t*>(info);
+}
+
+static inline const sk_imageinfo_t& ToImageInfo(const SkImageInfo& info) {
+ return reinterpret_cast<const sk_imageinfo_t&>(info);
+}
+
+static inline bool find_sk(const sk_codec_options_t& coptions, SkCodec::Options* options) {
+ if (options) {
+ *options = SkCodec::Options();
+ options->fZeroInitialized = (SkCodec::ZeroInitialized)coptions.fZeroInitialized;
+ if (coptions.fHasSubset) {
+ options->fSubset = AsIRect((sk_irect_t*)&coptions.fSubset);
+ }
+ }
+ return true;
+}
+
+
+static inline sk_path_iterator_t* ToPathIter(SkPath::Iter* iter) {
+ return reinterpret_cast<sk_path_iterator_t*>(iter);
+}
+
+static inline SkPath::RawIter* AsPathRawIter(sk_path_rawiterator_t* iter) {
+ return reinterpret_cast<SkPath::RawIter*>(iter);
+}
+
+static inline sk_path_rawiterator_t* ToPathRawIter(SkPath::RawIter* iter) {
+ return reinterpret_cast<sk_path_rawiterator_t*>(iter);
+}
+
+static inline const SkPathEffect* AsPathEffect(const sk_path_effect_t* p) {
+ return reinterpret_cast<const SkPathEffect*>(p);
+}
+
+static inline SkPathEffect* AsPathEffect(sk_path_effect_t* p) {
+ return reinterpret_cast<SkPathEffect*>(p);
+}
+
+static inline sk_path_effect_t* ToPathEffect(SkPathEffect* p) {
+ return reinterpret_cast<sk_path_effect_t*>(p);
+}
+
+static inline const sk_path_effect_t* ToPathEffect(const SkPathEffect* p) {
+ return reinterpret_cast<const sk_path_effect_t*>(p);
+}
+
#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkBitmap.h"
-#include "SkColor.h"
-#include "SkColorPriv.h"
-#include "SkDither.h"
-#include "SkImageInfo.h"
-#include "SkUnPreMultiply.h"
-
-#include "xamarin/sk_x_bitmap.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-static inline void copyAlpha8ToColor(size_t size, const uint8_t* pixels, sk_color_t* colors)
-{
- while (size-- != 0) {
- const uint8_t* addr = pixels++;
- *colors++ = SkColorSetA(0, *addr);
- }
-}
-static inline void copyRgb565ToColor(size_t size, const uint16_t* pixels, sk_color_t* colors)
-{
- while (size-- != 0) {
- const uint16_t* addr = pixels++;
- *colors++ = SkPixel16ToColor(*addr);
- }
-}
-static inline void copy8888ToColor(size_t size, const uint32_t* pixels, sk_color_t* colors)
-{
- while (size-- != 0) {
- const uint32_t* addr = pixels++;
- *colors++ = SkUnPreMultiply::PMColorToColor(*addr);
- }
-}
-
-static inline void copyAlpha8FromColor(size_t size, const sk_color_t* colors, uint8_t* pixels)
-{
- while (size-- != 0) {
- *pixels++ = SkColorGetA(*colors++);
- }
-}
-static inline void copyRgb565FromColor(size_t width, size_t height, const sk_color_t* colors, uint16_t* pixels)
-{
- for (size_t y = 0; y < height; y++) {
- DITHER_565_SCAN(y);
- for (size_t x = 0; x < width; x++) {
- SkColor c = *colors++;
- *pixels++ = SkDitherRGBTo565(SkColorGetR(c), SkColorGetG(c), SkColorGetB(c), DITHER_VALUE(x));
- }
- }
-}
-static inline void copy8888FromColor(size_t size, const sk_color_t* colors, uint32_t* pixels)
-{
- while (size-- != 0) {
- *pixels++ = SkPreMultiplyColor(*colors++);
- }
-}
-
-
-void sk_bitmap_destructor(sk_bitmap_t* cbitmap)
-{
- delete AsBitmap(cbitmap);
-}
-
-sk_bitmap_t* sk_bitmap_new()
-{
- return (sk_bitmap_t*) new SkBitmap();
-}
-
-void sk_bitmap_get_info(sk_bitmap_t* cbitmap, sk_imageinfo_t* info)
-{
- *info = ToImageInfo(AsBitmap(cbitmap)->info());
-}
-
-void* sk_bitmap_get_pixels(sk_bitmap_t* cbitmap, size_t* length)
-{
- SkBitmap* bmp = AsBitmap(cbitmap);
- *length = bmp->getSize();
- return bmp->getPixels();
-}
-
-size_t sk_bitmap_get_row_bytes(sk_bitmap_t* cbitmap)
-{
- return AsBitmap(cbitmap)->rowBytes();
-}
-
-size_t sk_bitmap_get_byte_count(sk_bitmap_t* cbitmap)
-{
- return AsBitmap(cbitmap)->getSize();
-}
-
-void sk_bitmap_reset(sk_bitmap_t* cbitmap)
-{
- AsBitmap(cbitmap)->reset();
-}
-
-bool sk_bitmap_is_null(sk_bitmap_t* cbitmap)
-{
- return AsBitmap(cbitmap)->isNull();
-}
-
-bool sk_bitmap_is_immutable(sk_bitmap_t* cbitmap)
-{
- return AsBitmap(cbitmap)->isImmutable();
-}
-
-void sk_bitmap_set_immutable(sk_bitmap_t* cbitmap)
-{
- AsBitmap(cbitmap)->setImmutable();
-}
-
-bool sk_bitmap_is_volatile(sk_bitmap_t* cbitmap)
-{
- return AsBitmap(cbitmap)->isVolatile();
-}
-
-void sk_bitmap_set_volatile(sk_bitmap_t* cbitmap, bool value)
-{
- AsBitmap(cbitmap)->setIsVolatile(value);
-}
-
-void sk_bitmap_erase(sk_bitmap_t* cbitmap, sk_color_t color)
-{
- AsBitmap(cbitmap)->eraseColor(color);
-}
-
-void sk_bitmap_erase_rect(sk_bitmap_t* cbitmap, sk_color_t color, sk_irect_t* rect)
-{
- AsBitmap(cbitmap)->erase(color, AsIRect(*rect));
-}
-
-sk_color_t sk_bitmap_get_pixel_color(sk_bitmap_t* cbitmap, int x, int y)
-{
- return AsBitmap(cbitmap)->getColor(x, y);
-}
-
-void sk_bitmap_set_pixel_color(sk_bitmap_t* cbitmap, int x, int y, sk_color_t color)
-{
- SkBitmap* bmp = AsBitmap(cbitmap);
-
- SkAutoLockPixels alp(*bmp);
-
- switch (bmp->colorType()) {
- case kAlpha_8_SkColorType:
- copyAlpha8FromColor(1, &color, (uint8_t*)bmp->getAddr8(x, y));
- break;
- case kRGB_565_SkColorType:
- copyRgb565FromColor(1, 1, &color, (uint16_t*)bmp->getAddr16(x, y));
- break;
- case kBGRA_8888_SkColorType:
- case kRGBA_8888_SkColorType:
- copy8888FromColor(1, &color, (uint32_t*)bmp->getAddr32(x, y));
- break;
- default:
- break;
- }
-}
-
-bool sk_bitmap_copy(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, sk_colortype_t ct)
-{
- return AsBitmap(cbitmap)->copyTo(AsBitmap(dst), (SkColorType)ct);
-}
-
-bool sk_bitmap_can_copy_to(sk_bitmap_t* cbitmap, sk_colortype_t ct)
-{
- return AsBitmap(cbitmap)->canCopyTo((SkColorType)ct);
-}
-
-void sk_bitmap_unlock_pixels(sk_bitmap_t* cbitmap)
-{
- AsBitmap(cbitmap)->unlockPixels();
-}
-
-void sk_bitmap_lock_pixels(sk_bitmap_t* cbitmap)
-{
- AsBitmap(cbitmap)->lockPixels();
-}
-
-void sk_bitmap_get_pixel_colors(sk_bitmap_t* cbitmap, sk_color_t* colors)
-{
- SkBitmap* bmp = AsBitmap(cbitmap);
-
- SkAutoLockPixels alp(*bmp);
-
- size_t size = bmp->height() * bmp->width();
- const void* pixels = bmp->getPixels();
-
- switch (bmp->colorType()) {
- case kAlpha_8_SkColorType:
- copyAlpha8ToColor(size, (const uint8_t*)pixels, colors);
- break;
- case kRGB_565_SkColorType:
- copyRgb565ToColor(size, (const uint16_t*)pixels, colors);
- break;
- case kBGRA_8888_SkColorType:
- case kRGBA_8888_SkColorType:
- copy8888ToColor(size, (const uint32_t*)pixels, colors);
- break;
- default:
- break;
- }
-}
-
-void sk_bitmap_set_pixel_colors(sk_bitmap_t* cbitmap, const sk_color_t* colors)
-{
- SkBitmap* bmp = AsBitmap(cbitmap);
-
- SkAutoLockPixels alp(*bmp);
-
- size_t width = bmp->width();
- size_t height = bmp->height();
- size_t size = height * width;
- void* pixels = bmp->getPixels();
-
- switch (bmp->colorType()) {
- case kAlpha_8_SkColorType:
- copyAlpha8FromColor(size, colors, (uint8_t*)pixels);
- break;
- case kRGB_565_SkColorType:
- copyRgb565FromColor(width, height, colors, (uint16_t*)pixels);
- break;
- case kBGRA_8888_SkColorType:
- case kRGBA_8888_SkColorType:
- copy8888FromColor(size, colors, (uint32_t*)pixels);
- break;
- default:
- break;
- }
-}
-
-bool sk_bitmap_try_alloc_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, size_t rowBytes)
-{
- SkBitmap* bmp = AsBitmap(cbitmap);
-
- const SkImageInfo* info = AsImageInfo(requestedInfo);
-
- return bmp->tryAllocPixels(*info, rowBytes);
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkCanvas.h"
-
-#include "xamarin/sk_x_canvas.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-void sk_canvas_clear(sk_canvas_t* ccanvas, sk_color_t color) {
- AsCanvas(ccanvas)->clear(color);
-}
-
-void sk_canvas_discard(sk_canvas_t* ccanvas) {
- AsCanvas(ccanvas)->discard();
-}
-
-int sk_canvas_get_save_count(sk_canvas_t* ccanvas) {
- return AsCanvas(ccanvas)->getSaveCount();
-}
-
-void sk_canvas_restore_to_count(sk_canvas_t* ccanvas, int saveCount) {
- AsCanvas(ccanvas)->restoreToCount(saveCount);
-}
-
-void sk_canvas_draw_color(sk_canvas_t* ccanvas, sk_color_t color, sk_xfermode_mode_t cmode) {
- AsCanvas(ccanvas)->drawColor(color, (SkXfermode::Mode)cmode);
-}
-
-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)
-{
- AsCanvas(ccanvas)->drawPoints ((SkCanvas::PointMode)pointMode, count, AsPoint(points), *AsPaint(cpaint));
-}
-
-void sk_canvas_draw_point(sk_canvas_t* ccanvas, float x, float y, const sk_paint_t* cpaint)
-{
- AsCanvas(ccanvas)->drawPoint (x, y, *AsPaint(cpaint));
-}
-
-void sk_canvas_draw_point_color(sk_canvas_t* ccanvas, float x, float y, sk_color_t color)
-{
- AsCanvas(ccanvas)->drawPoint (x, y, color);
-}
-
-void sk_canvas_draw_line(sk_canvas_t* ccanvas, float x0, float y0, float x1, float y1, sk_paint_t* cpaint)
-{
- AsCanvas(ccanvas)->drawLine(x0, y0, x1, y1, *AsPaint(cpaint));
-}
-
-void sk_canvas_draw_text (sk_canvas_t* ccanvas, const char *text, size_t byteLength, float x, float y, const sk_paint_t* cpaint)
-{
- AsCanvas(ccanvas)->drawText(text, byteLength, x, y, *AsPaint(cpaint));
-}
-
-void sk_canvas_draw_pos_text (sk_canvas_t* ccanvas, const char *text, size_t byteLength, const sk_point_t pos[], const sk_paint_t* cpaint)
-{
- AsCanvas(ccanvas)->drawPosText(text, byteLength, AsPoint(pos), *AsPaint(cpaint));
-}
-
-void sk_canvas_draw_text_on_path (sk_canvas_t* ccanvas, const char *text, size_t byteLength, const sk_path_t* path,
- float hOffset, float vOffset, const sk_paint_t* cpaint)
-{
- AsCanvas(ccanvas)->drawTextOnPathHV(text, byteLength, AsPath(*path), hOffset, vOffset, *AsPaint(cpaint));
-}
-
-void sk_canvas_draw_bitmap(sk_canvas_t* ccanvas, const sk_bitmap_t* cbitmap, float x, float y, const sk_paint_t* cpaint)
-{
- AsCanvas(ccanvas)->drawBitmap(*AsBitmap(cbitmap), x, y, AsPaint(cpaint));
-}
-
-void sk_canvas_draw_bitmap_rect(sk_canvas_t* ccanvas, const sk_bitmap_t* cbitmap, const sk_rect_t* csrcR, const sk_rect_t* cdstR, const sk_paint_t* cpaint)
-{
- SkCanvas* canvas = AsCanvas(ccanvas);
- const SkBitmap& bitmap = *AsBitmap(cbitmap);
- const SkRect& dst = AsRect(*cdstR);
- const SkPaint* paint = AsPaint(cpaint);
-
- if (csrcR) {
- canvas->drawBitmapRect(bitmap, AsRect(*csrcR), dst, paint);
- }
- else {
- canvas->drawBitmapRect(bitmap, dst, paint);
- }
-}
-
-void sk_canvas_reset_matrix(sk_canvas_t* ccanvas)
-{
- AsCanvas(ccanvas)->resetMatrix();
-}
-
-void sk_canvas_set_matrix(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix)
-{
- SkMatrix matrix;
- if (cmatrix) {
- from_c(cmatrix, &matrix);
- }
- AsCanvas(ccanvas)->setMatrix(matrix);
-}
-
-void sk_canvas_get_total_matrix(sk_canvas_t* ccanvas, sk_matrix_t* cmatrix)
-{
- SkMatrix matrix = AsCanvas(ccanvas)->getTotalMatrix();
- from_sk(&matrix, cmatrix);
-}
-
-void sk_canvas_draw_round_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect, float rx, float ry, const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawRoundRect(AsRect(*crect), rx, ry, AsPaint(*cpaint));
-}
-
-void sk_canvas_clip_rect_with_operation(sk_canvas_t* ccanvas, const sk_rect_t* crect, sk_region_op_t op, bool doAA) {
- AsCanvas(ccanvas)->clipRect(AsRect(*crect), (SkRegion::Op)op, doAA);
-}
-
-void sk_canvas_clip_path_with_operation(sk_canvas_t* ccanvas, const sk_path_t* cpath, sk_region_op_t op, bool doAA) {
- AsCanvas(ccanvas)->clipPath(AsPath(*cpath), (SkRegion::Op)op, doAA);
-}
-
-bool sk_canvas_get_clip_bounds(sk_canvas_t* ccanvas, sk_rect_t* cbounds) {
- return AsCanvas(ccanvas)->getClipBounds(AsRect(cbounds));
-}
-
-bool sk_canvas_get_clip_device_bounds(sk_canvas_t* ccanvas, sk_irect_t* cbounds) {
- return AsCanvas(ccanvas)->getClipDeviceBounds(AsIRect(cbounds));
-}
-
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkCodec.h"
-
-#include "xamarin/sk_x_codec.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-size_t sk_codec_min_buffered_bytes_needed()
-{
- return SkCodec::MinBufferedBytesNeeded();
-}
-
-sk_codec_t* sk_codec_new_from_stream(sk_stream_t* stream)
-{
- return ToCodec(SkCodec::NewFromStream(AsStream(stream)));
-}
-
-sk_codec_t* sk_codec_new_from_data(sk_data_t* data)
-{
- return ToCodec(SkCodec::NewFromData(AsData(data)));
-}
-
-void sk_codec_destroy(sk_codec_t* codec)
-{
- delete AsCodec(codec);
-}
-
-void sk_codec_get_info(sk_codec_t* codec, sk_imageinfo_t* info)
-{
- *info = ToImageInfo(AsCodec(codec)->getInfo());
-}
-
-sk_colorspace_t* sk_codec_get_color_space(sk_codec_t* codec)
-{
- return ToColorSpace(AsCodec(codec)->getColorSpace());
-}
-
-sk_codec_origin_t sk_codec_get_origin(sk_codec_t* codec)
-{
- return (sk_codec_origin_t)AsCodec(codec)->getOrigin();
-}
-
-void sk_codec_get_scaled_dimensions(sk_codec_t* codec, float desiredScale, sk_isize_t* dimensions)
-{
- *dimensions = ToISize(AsCodec(codec)->getScaledDimensions(desiredScale));
-}
-
-void sk_codec_get_valid_subset(sk_codec_t* codec, sk_irect_t* desiredSubset)
-{
- AsCodec(codec)->getValidSubset(AsIRect(desiredSubset));
-}
-
-sk_encoded_format_t sk_codec_get_encoded_format(sk_codec_t* codec)
-{
- return (sk_encoded_format_t)AsCodec(codec)->getEncodedFormat();
-}
-
-sk_codec_result_t sk_codec_get_pixels(sk_codec_t* codec, const sk_imageinfo_t* cinfo, void* pixels, size_t rowBytes, const sk_codec_options_t* coptions, sk_color_t ctable[], int* ctableCount)
-{
- const SkImageInfo* info = AsImageInfo(cinfo);
- SkCodec::Options options;
- if (!find_sk(*coptions, &options)) {
- return INVALID_PARAMETERS_SK_CODEC_RESULT;
- }
- return (sk_codec_result_t)AsCodec(codec)->getPixels(*info, pixels, rowBytes, &options, ctable, ctableCount);
-}
-
-sk_codec_result_t sk_codec_get_pixels_using_defaults(sk_codec_t* codec, const sk_imageinfo_t* cinfo, void* pixels, size_t rowBytes)
-{
- const SkImageInfo* info = AsImageInfo(cinfo);
- return (sk_codec_result_t)AsCodec(codec)->getPixels(*info, pixels, rowBytes);
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkColorCubeFilter.h"
-#include "SkColorMatrixFilter.h"
-#include "SkLumaColorFilter.h"
-#include "SkTableColorFilter.h"
-
-#include "xamarin/sk_x_colorfilter.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-void sk_colorfilter_unref(sk_colorfilter_t* filter) {
- SkSafeUnref(AsColorFilter(filter));
-}
-
-sk_colorfilter_t* sk_colorfilter_new_mode(sk_color_t c, sk_xfermode_mode_t cmode) {
-
- sk_sp<SkColorFilter> filter = SkColorFilter::MakeModeFilter(
- c,
- (SkXfermode::Mode)cmode);
- return ToColorFilter(filter.release());
-}
-
-sk_colorfilter_t* sk_colorfilter_new_lighting(sk_color_t mul, sk_color_t add) {
-
- sk_sp<SkColorFilter> filter = SkColorMatrixFilter::MakeLightingFilter(
- mul,
- add);
- return ToColorFilter(filter.release());
-}
-
-sk_colorfilter_t* sk_colorfilter_new_compose(sk_colorfilter_t* outer, sk_colorfilter_t* inner) {
-
- sk_sp<SkColorFilter> filter = SkColorFilter::MakeComposeFilter(
- sk_ref_sp(AsColorFilter(outer)),
- sk_ref_sp(AsColorFilter(inner)));
- return ToColorFilter(filter.release());
-}
-
-sk_colorfilter_t* sk_colorfilter_new_color_cube(sk_data_t* cubeData, int cubeDimension) {
-
- sk_sp<SkColorFilter> filter = SkColorCubeFilter::Make(
- sk_ref_sp(AsData(cubeData)),
- cubeDimension);
- return ToColorFilter(filter.release());
-}
-
-sk_colorfilter_t* sk_colorfilter_new_color_matrix(const float array[20]) {
-
- sk_sp<SkColorFilter> filter = SkColorFilter::MakeMatrixFilterRowMajor255(
- array);
- return ToColorFilter(filter.release());
-}
-
-sk_colorfilter_t* sk_colorfilter_new_luma_color() {
-
- sk_sp<SkColorFilter> filter = SkLumaColorFilter::Make();
- return ToColorFilter(filter.release());
-}
-
-sk_colorfilter_t* sk_colorfilter_new_table(const uint8_t table[256]) {
-
- sk_sp<SkColorFilter> filter = SkTableColorFilter::Make(table);
- return ToColorFilter(filter.release());
-}
-
-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_sp<SkColorFilter> filter = SkTableColorFilter::MakeARGB(tableA, tableR, tableG, tableB);
- return ToColorFilter(filter.release());
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkData.h"
-
-#include "xamarin/sk_x_data.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-sk_data_t* sk_data_new_from_file(const char* path) {
- return ToData(SkData::NewFromFileName(path));
-}
-
-sk_data_t* sk_data_new_from_stream(sk_stream_t* stream, size_t length) {
- return ToData(SkData::NewFromStream(AsStream(stream), length));
-}
-
-const uint8_t* sk_data_get_bytes(const sk_data_t* cdata) {
- return AsData(cdata)->bytes();
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkDocument.h"
-
-#include "xamarin/sk_x_document.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-void sk_document_unref(sk_document_t* document) {
- AsDocument(document)->unref();
-}
-
-sk_document_t* sk_document_create_pdf_from_stream(sk_wstream_t* stream, float dpi) {
- return ToDocument(SkDocument::CreatePDF(AsWStream(stream), dpi));
-}
-
-sk_document_t* sk_document_create_pdf_from_filename(const char* path, float dpi) {
- return ToDocument(SkDocument::CreatePDF(path, dpi));
-}
-
-//sk_document_t* sk_document_create_xps_from_stream(sk_wstream_t* stream, float dpi) {
-// return ToDocument(SkDocument::CreateXPS(AsWStream(stream), dpi));
-//}
-//
-//sk_document_t* sk_document_create_xps_from_filename(const char* path, float dpi) {
-// return ToDocument(SkDocument::CreateXPS(path, dpi));
-//}
-
-sk_canvas_t* sk_document_begin_page(sk_document_t* document, float width, float height, const sk_rect_t* content) {
- return ToCanvas(AsDocument(document)->beginPage(width, height, AsRect(content)));
-}
-
-void sk_document_end_page(sk_document_t* document) {
- AsDocument(document)->endPage();
-}
-
-bool sk_document_close(sk_document_t* document) {
- return AsDocument(document)->close();
-}
-
-void sk_document_abort(sk_document_t* document) {
- AsDocument(document)->abort();
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkTypeface.h"
-#include "SkFontStyle.h"
-
-#include "sk_x_types_priv.h"
-
-#if __cplusplus >= 199711L
-
-#define STRINGIFY(x) #x
-#define TOSTRING(x) STRINGIFY(x)
-#define ASSERT_MSG(SK, C) "ABI changed, you must write a enumeration mapper for " TOSTRING(#SK) " to " TOSTRING(#C) "."
-
-// sk_typeface_style_t
-static_assert ((int)SkTypeface::Style::kNormal == (int)NORMAL_TYPEFACE_STYLE, ASSERT_MSG(SkTypeface::Style, sk_typeface_style_t));
-static_assert ((int)SkTypeface::Style::kBold == (int)BOLD_TYPEFACE_STYLE, ASSERT_MSG(SkTypeface::Style, sk_typeface_style_t));
-static_assert ((int)SkTypeface::Style::kItalic == (int)ITALIC_TYPEFACE_STYLE, ASSERT_MSG(SkTypeface::Style, sk_typeface_style_t));
-static_assert ((int)SkTypeface::Style::kBoldItalic == (int)BOLD_ITALIC_TYPEFACE_STYLE, ASSERT_MSG(SkTypeface::Style, sk_typeface_style_t));
-
-// sk_encoding_t
-static_assert ((int)SkTypeface::Encoding::kUTF8_Encoding == (int)UTF8_ENCODING, ASSERT_MSG(SkTypeface::Encoding, sk_encoding_t));
-static_assert ((int)SkTypeface::Encoding::kUTF16_Encoding == (int)UTF16_ENCODING, ASSERT_MSG(SkTypeface::Encoding, sk_encoding_t));
-static_assert ((int)SkTypeface::Encoding::kUTF32_Encoding == (int)UTF32_ENCODING, ASSERT_MSG(SkTypeface::Encoding, sk_encoding_t));
-
-// sk_font_style_slant_t
-static_assert ((int)SkFontStyle::Slant::kUpright_Slant == (int)UPRIGHT_SK_FONT_STYLE_SLANT, ASSERT_MSG(SkFontStyle::Slant, sk_font_style_slant_t));
-static_assert ((int)SkFontStyle::Slant::kItalic_Slant == (int)ITALIC_SK_FONT_STYLE_SLANT, ASSERT_MSG(SkFontStyle::Slant, sk_font_style_slant_t));
-static_assert ((int)SkFontStyle::Slant::kOblique_Slant == (int)OBLIQUE_SK_FONT_STYLE_SLANT, ASSERT_MSG(SkFontStyle::Slant, sk_font_style_slant_t));
-
-// sk_path_verb_t
-static_assert ((int)SkPath::Verb::kMove_Verb == (int)MOVE_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
-static_assert ((int)SkPath::Verb::kLine_Verb == (int)LINE_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
-static_assert ((int)SkPath::Verb::kQuad_Verb == (int)QUAD_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
-static_assert ((int)SkPath::Verb::kConic_Verb == (int)CONIC_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
-static_assert ((int)SkPath::Verb::kCubic_Verb == (int)CUBIC_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
-static_assert ((int)SkPath::Verb::kClose_Verb == (int)CLOSE_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
-static_assert ((int)SkPath::Verb::kDone_Verb == (int)DONE_PATH_VERB, ASSERT_MSG(SkPath::Verb, sk_path_verb_t));
-
-// sk_path_add_mode_t
-static_assert ((int)SkPath::AddPathMode::kAppend_AddPathMode == (int)APPEND_ADD_MODE, ASSERT_MSG(SkPath::AddPathMode, sk_path_add_mode_t));
-static_assert ((int)SkPath::AddPathMode::kExtend_AddPathMode == (int)EXTEND_ADD_MODE, ASSERT_MSG(SkPath::AddPathMode, sk_path_add_mode_t));
-
-// sk_path_direction_t
-static_assert ((int)SkPath::Direction::kCCW_Direction == (int)CCW_SK_PATH_DIRECTION, ASSERT_MSG(SkPath::Direction, sk_path_direction_t));
-static_assert ((int)SkPath::Direction::kCW_Direction == (int)CW_SK_PATH_DIRECTION, ASSERT_MSG(SkPath::Direction, sk_path_direction_t));
-
-// sk_path_filltype_t
-static_assert ((int)SkPath::FillType::kWinding_FillType == (int)WINDING_SK_PATH_FILLTYPE, ASSERT_MSG(SkPath::FillType, sk_path_filltype_t));
-static_assert ((int)SkPath::FillType::kEvenOdd_FillType == (int)EVENODD_SK_PATH_FILLTYPE, ASSERT_MSG(SkPath::FillType, sk_path_filltype_t));
-static_assert ((int)SkPath::FillType::kInverseWinding_FillType == (int)INVERSE_WINDING_SK_PATH_FILLTYPE, ASSERT_MSG(SkPath::FillType, sk_path_filltype_t));
-static_assert ((int)SkPath::FillType::kInverseEvenOdd_FillType == (int)INVERSE_EVENODD_SK_PATH_FILLTYPE, ASSERT_MSG(SkPath::FillType, sk_path_filltype_t));
-
-// sk_text_align_t
-static_assert ((int)SkPaint::Align::kLeft_Align == (int)LEFT_SK_TEXT_ALIGN, ASSERT_MSG(SkPaint::Align, sk_text_align_t));
-static_assert ((int)SkPaint::Align::kCenter_Align == (int)CENTER_SK_TEXT_ALIGN, ASSERT_MSG(SkPaint::Align, sk_text_align_t));
-static_assert ((int)SkPaint::Align::kRight_Align == (int)RIGHT_SK_TEXT_ALIGN, ASSERT_MSG(SkPaint::Align, sk_text_align_t));
-
-// sk_text_encoding_t
-static_assert ((int)SkPaint::TextEncoding::kUTF8_TextEncoding == (int)UTF8_SK_TEXT_ENCODING, ASSERT_MSG(SkPaint::TextEncoding, sk_text_encoding_t));
-static_assert ((int)SkPaint::TextEncoding::kUTF16_TextEncoding == (int)UTF16_SK_TEXT_ENCODING, ASSERT_MSG(SkPaint::TextEncoding, sk_text_encoding_t));
-static_assert ((int)SkPaint::TextEncoding::kUTF32_TextEncoding == (int)UTF32_SK_TEXT_ENCODING, ASSERT_MSG(SkPaint::TextEncoding, sk_text_encoding_t));
-static_assert ((int)SkPaint::TextEncoding::kGlyphID_TextEncoding == (int)GLYPH_ID_SK_TEXT_ENCODING, ASSERT_MSG(SkPaint::TextEncoding, sk_text_encoding_t));
-
-// sk_filter_quality_t
-static_assert ((int)SkFilterQuality::kNone_SkFilterQuality == (int)NONE_SK_FILTER_QUALITY, ASSERT_MSG(SkFilterQuality, sk_filter_quality_t));
-static_assert ((int)SkFilterQuality::kLow_SkFilterQuality == (int)LOW_SK_FILTER_QUALITY, ASSERT_MSG(SkFilterQuality, sk_filter_quality_t));
-static_assert ((int)SkFilterQuality::kMedium_SkFilterQuality == (int)MEDIUM_SK_FILTER_QUALITY, ASSERT_MSG(SkFilterQuality, sk_filter_quality_t));
-static_assert ((int)SkFilterQuality::kHigh_SkFilterQuality == (int)HIGH_SK_FILTER_QUALITY, ASSERT_MSG(SkFilterQuality, sk_filter_quality_t));
-
-// sk_crop_rect_flags_t
-static_assert ((int)SkImageFilter::CropRect::CropEdge::kHasLeft_CropEdge == (int)HAS_LEFT_SK_CROP_RECT_FLAG, ASSERT_MSG(SkImageFilter::CropRect::CropEdge, sk_crop_rect_flags_t));
-static_assert ((int)SkImageFilter::CropRect::CropEdge::kHasTop_CropEdge == (int)HAS_TOP_SK_CROP_RECT_FLAG, ASSERT_MSG(SkImageFilter::CropRect::CropEdge, sk_crop_rect_flags_t));
-static_assert ((int)SkImageFilter::CropRect::CropEdge::kHasWidth_CropEdge == (int)HAS_WIDTH_SK_CROP_RECT_FLAG, ASSERT_MSG(SkImageFilter::CropRect::CropEdge, sk_crop_rect_flags_t));
-static_assert ((int)SkImageFilter::CropRect::CropEdge::kHasHeight_CropEdge == (int)HAS_HEIGHT_SK_CROP_RECT_FLAG, ASSERT_MSG(SkImageFilter::CropRect::CropEdge, sk_crop_rect_flags_t));
-static_assert ((int)SkImageFilter::CropRect::CropEdge::kHasAll_CropEdge == (int)HAS_ALL_SK_CROP_RECT_FLAG, ASSERT_MSG(SkImageFilter::CropRect::CropEdge, sk_crop_rect_flags_t));
-
-// sk_drop_shadow_image_filter_shadow_mode_t
-static_assert ((int)SkDropShadowImageFilter::ShadowMode::kDrawShadowAndForeground_ShadowMode == (int)DRAW_SHADOW_AND_FOREGROUND_SK_DROP_SHADOW_IMAGE_FILTER_SHADOW_MODE, ASSERT_MSG(SkDropShadowImageFilter::ShadowMode, sk_drop_shadow_image_filter_shadow_mode_t));
-static_assert ((int)SkDropShadowImageFilter::ShadowMode::kDrawShadowOnly_ShadowMode == (int)DRAW_SHADOW_ONLY_SK_DROP_SHADOW_IMAGE_FILTER_SHADOW_MODE, ASSERT_MSG(SkDropShadowImageFilter::ShadowMode, sk_drop_shadow_image_filter_shadow_mode_t));
-
-// sk_displacement_map_effect_channel_selector_type_t
-static_assert ((int)SkDisplacementMapEffect::ChannelSelectorType::kUnknown_ChannelSelectorType == (int)UNKNOWN_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE, ASSERT_MSG(SkDisplacementMapEffect::ChannelSelectorType, sk_displacement_map_effect_channel_selector_type_t));
-static_assert ((int)SkDisplacementMapEffect::ChannelSelectorType::kR_ChannelSelectorType == (int)R_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE, ASSERT_MSG(SkDisplacementMapEffect::ChannelSelectorType, sk_displacement_map_effect_channel_selector_type_t));
-static_assert ((int)SkDisplacementMapEffect::ChannelSelectorType::kG_ChannelSelectorType == (int)G_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE, ASSERT_MSG(SkDisplacementMapEffect::ChannelSelectorType, sk_displacement_map_effect_channel_selector_type_t));
-static_assert ((int)SkDisplacementMapEffect::ChannelSelectorType::kB_ChannelSelectorType == (int)B_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE, ASSERT_MSG(SkDisplacementMapEffect::ChannelSelectorType, sk_displacement_map_effect_channel_selector_type_t));
-static_assert ((int)SkDisplacementMapEffect::ChannelSelectorType::kA_ChannelSelectorType == (int)A_SK_DISPLACEMENT_MAP_EFFECT_CHANNEL_SELECTOR_TYPE, ASSERT_MSG(SkDisplacementMapEffect::ChannelSelectorType, sk_displacement_map_effect_channel_selector_type_t));
-
-// sk_matrix_convolution_tilemode_t
-static_assert ((int)SkMatrixConvolutionImageFilter::TileMode::kClamp_TileMode == (int)CLAMP_SK_MATRIX_CONVOLUTION_TILEMODE, ASSERT_MSG(SkMatrixConvolutionImageFilter::TileMode, sk_matrix_convolution_tilemode_t));
-static_assert ((int)SkMatrixConvolutionImageFilter::TileMode::kRepeat_TileMode == (int)REPEAT_SK_MATRIX_CONVOLUTION_TILEMODE, ASSERT_MSG(SkMatrixConvolutionImageFilter::TileMode, sk_matrix_convolution_tilemode_t));
-static_assert ((int)SkMatrixConvolutionImageFilter::TileMode::kClampToBlack_TileMode == (int)CLAMP_TO_BLACK_SK_MATRIX_CONVOLUTION_TILEMODE, ASSERT_MSG(SkMatrixConvolutionImageFilter::TileMode, sk_matrix_convolution_tilemode_t));
-
-// sk_image_encoder_t
-static_assert ((int)SkImageEncoder::Type::kUnknown_Type == (int)UNKNOWN_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
-static_assert ((int)SkImageEncoder::Type::kBMP_Type == (int)BMP_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
-static_assert ((int)SkImageEncoder::Type::kGIF_Type == (int)GIF_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
-static_assert ((int)SkImageEncoder::Type::kICO_Type == (int)ICO_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
-static_assert ((int)SkImageEncoder::Type::kJPEG_Type == (int)JPEG_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
-static_assert ((int)SkImageEncoder::Type::kPNG_Type == (int)PNG_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
-static_assert ((int)SkImageEncoder::Type::kWBMP_Type == (int)WBMP_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
-static_assert ((int)SkImageEncoder::Type::kWEBP_Type == (int)WEBP_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
-static_assert ((int)SkImageEncoder::Type::kKTX_Type == (int)KTX_SK_IMAGE_ENCODER_TYPE, ASSERT_MSG(SkImageEncoder::Type, sk_image_encoder_t));
-
-// sk_xfermode_mode_t
-static_assert ((int)SkXfermode::Mode::kClear_Mode == (int)CLEAR_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kSrc_Mode == (int)SRC_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kDst_Mode == (int)DST_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kSrcOver_Mode == (int)SRCOVER_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kDstOver_Mode == (int)DSTOVER_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kSrcIn_Mode == (int)SRCIN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kDstIn_Mode == (int)DSTIN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kSrcOut_Mode == (int)SRCOUT_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kDstOut_Mode == (int)DSTOUT_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kSrcATop_Mode == (int)SRCATOP_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kDstATop_Mode == (int)DSTATOP_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kXor_Mode == (int)XOR_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kPlus_Mode == (int)PLUS_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kModulate_Mode == (int)MODULATE_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kScreen_Mode == (int)SCREEN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kOverlay_Mode == (int)OVERLAY_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kDarken_Mode == (int)DARKEN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kLighten_Mode == (int)LIGHTEN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kColorDodge_Mode == (int)COLORDODGE_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kColorBurn_Mode == (int)COLORBURN_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kHardLight_Mode == (int)HARDLIGHT_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kSoftLight_Mode == (int)SOFTLIGHT_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kDifference_Mode == (int)DIFFERENCE_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kExclusion_Mode == (int)EXCLUSION_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kMultiply_Mode == (int)MULTIPLY_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kHue_Mode == (int)HUE_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kSaturation_Mode == (int)SATURATION_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kColor_Mode == (int)COLOR_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-static_assert ((int)SkXfermode::Mode::kLuminosity_Mode == (int)LUMINOSITY_SK_XFERMODE_MODE, ASSERT_MSG(SkXfermode::Mode, sk_xfermode_mode_t));
-
-// sk_colortype_t
-static_assert ((int)SkColorType::kUnknown_SkColorType == (int)UNKNOWN_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
-static_assert ((int)SkColorType::kAlpha_8_SkColorType == (int)ALPHA_8_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
-static_assert ((int)SkColorType::kRGB_565_SkColorType == (int)RGB_565_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
-static_assert ((int)SkColorType::kARGB_4444_SkColorType == (int)ARGB_4444_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
-static_assert ((int)SkColorType::kRGBA_8888_SkColorType == (int)RGBA_8888_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
-static_assert ((int)SkColorType::kBGRA_8888_SkColorType == (int)BGRA_8888_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
-static_assert ((int)SkColorType::kIndex_8_SkColorType == (int)Index_8_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
-static_assert ((int)SkColorType::kGray_8_SkColorType == (int)Gray_8_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
-static_assert ((int)SkColorType::kRGBA_F16_SkColorType == (int)RGBA_F16_SK_COLORTYPE, ASSERT_MSG(SkColorType, sk_colortype_t));
-
-// sk_alphatype_t
-static_assert ((int)SkAlphaType::kUnknown_SkAlphaType == (int)UNKNOWN_SK_ALPHATYPE, ASSERT_MSG(SkAlphaType, sk_alphatype_t));
-static_assert ((int)SkAlphaType::kOpaque_SkAlphaType == (int)OPAQUE_SK_ALPHATYPE, ASSERT_MSG(SkAlphaType, sk_alphatype_t));
-static_assert ((int)SkAlphaType::kPremul_SkAlphaType == (int)PREMUL_SK_ALPHATYPE, ASSERT_MSG(SkAlphaType, sk_alphatype_t));
-static_assert ((int)SkAlphaType::kUnpremul_SkAlphaType == (int)UNPREMUL_SK_ALPHATYPE, ASSERT_MSG(SkAlphaType, sk_alphatype_t));
-
-// sk_pixelgeometry_t
-static_assert ((int)SkPixelGeometry::kUnknown_SkPixelGeometry == (int)UNKNOWN_SK_PIXELGEOMETRY, ASSERT_MSG(SkPixelGeometry, sk_pixelgeometry_t));
-static_assert ((int)SkPixelGeometry::kRGB_H_SkPixelGeometry == (int)RGB_H_SK_PIXELGEOMETRY, ASSERT_MSG(SkPixelGeometry, sk_pixelgeometry_t));
-static_assert ((int)SkPixelGeometry::kBGR_H_SkPixelGeometry == (int)BGR_H_SK_PIXELGEOMETRY, ASSERT_MSG(SkPixelGeometry, sk_pixelgeometry_t));
-static_assert ((int)SkPixelGeometry::kRGB_V_SkPixelGeometry == (int)RGB_V_SK_PIXELGEOMETRY, ASSERT_MSG(SkPixelGeometry, sk_pixelgeometry_t));
-static_assert ((int)SkPixelGeometry::kBGR_V_SkPixelGeometry == (int)BGR_V_SK_PIXELGEOMETRY, ASSERT_MSG(SkPixelGeometry, sk_pixelgeometry_t));
-
-// sk_shader_tilemode_t
-static_assert ((int)SkShader::TileMode::kClamp_TileMode == (int)CLAMP_SK_SHADER_TILEMODE, ASSERT_MSG(SkShader::TileMode, sk_shader_tilemode_t));
-static_assert ((int)SkShader::TileMode::kRepeat_TileMode == (int)REPEAT_SK_SHADER_TILEMODE, ASSERT_MSG(SkShader::TileMode, sk_shader_tilemode_t));
-static_assert ((int)SkShader::TileMode::kMirror_TileMode == (int)MIRROR_SK_SHADER_TILEMODE, ASSERT_MSG(SkShader::TileMode, sk_shader_tilemode_t));
-
-// sk_blurstyle_t
-static_assert ((int)SkBlurStyle::kNormal_SkBlurStyle == (int)NORMAL_SK_BLUR_STYLE, ASSERT_MSG(SkBlurStyle, sk_blurstyle_t));
-static_assert ((int)SkBlurStyle::kSolid_SkBlurStyle == (int)SOLID_SK_BLUR_STYLE, ASSERT_MSG(SkBlurStyle, sk_blurstyle_t));
-static_assert ((int)SkBlurStyle::kOuter_SkBlurStyle == (int)OUTER_SK_BLUR_STYLE, ASSERT_MSG(SkBlurStyle, sk_blurstyle_t));
-static_assert ((int)SkBlurStyle::kInner_SkBlurStyle == (int)INNER_SK_BLUR_STYLE, ASSERT_MSG(SkBlurStyle, sk_blurstyle_t));
-
-// sk_stroke_cap_t
-static_assert ((int)SkPaint::Cap::kButt_Cap == (int)BUTT_SK_STROKE_CAP, ASSERT_MSG(SkPaint::Cap, sk_stroke_cap_t));
-static_assert ((int)SkPaint::Cap::kRound_Cap == (int)ROUND_SK_STROKE_CAP, ASSERT_MSG(SkPaint::Cap, sk_stroke_cap_t));
-static_assert ((int)SkPaint::Cap::kSquare_Cap == (int)SQUARE_SK_STROKE_CAP, ASSERT_MSG(SkPaint::Cap, sk_stroke_cap_t));
-
-// sk_stroke_join_t
-static_assert ((int)SkPaint::Join::kMiter_Join == (int)MITER_SK_STROKE_JOIN, ASSERT_MSG(SkPaint::Join, sk_stroke_join_t));
-static_assert ((int)SkPaint::Join::kRound_Join == (int)ROUND_SK_STROKE_JOIN, ASSERT_MSG(SkPaint::Join, sk_stroke_join_t));
-static_assert ((int)SkPaint::Join::kBevel_Join == (int)BEVEL_SK_STROKE_JOIN, ASSERT_MSG(SkPaint::Join, sk_stroke_join_t));
-
-// sk_region_op_t
-static_assert ((int)SkRegion::Op::kDifference_Op == (int)DIFFERENCE_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
-static_assert ((int)SkRegion::Op::kIntersect_Op == (int)INTERSECT_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
-static_assert ((int)SkRegion::Op::kUnion_Op == (int)UNION_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
-static_assert ((int)SkRegion::Op::kXOR_Op == (int)XOR_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
-static_assert ((int)SkRegion::Op::kReverseDifference_Op == (int)REVERSE_DIFFERENCE_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
-static_assert ((int)SkRegion::Op::kReplace_Op == (int)REPLACE_SK_REGION_OP, ASSERT_MSG(SkRegion::Op, sk_region_op_t));
-
-// sk_encoded_format_t
-static_assert ((int)SkEncodedFormat::kUnknown_SkEncodedFormat == (int)UNKNOWN_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kBMP_SkEncodedFormat == (int)BMP_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kGIF_SkEncodedFormat == (int)GIF_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kICO_SkEncodedFormat == (int)ICO_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kJPEG_SkEncodedFormat == (int)JPEG_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kPNG_SkEncodedFormat == (int)PNG_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kWBMP_SkEncodedFormat == (int)WBMP_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kWEBP_SkEncodedFormat == (int)WEBP_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kPKM_SkEncodedFormat == (int)PKM_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kKTX_SkEncodedFormat == (int)KTX_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kASTC_SkEncodedFormat == (int)ASTC_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-static_assert ((int)SkEncodedFormat::kDNG_SkEncodedFormat == (int)DNG_SK_ENCODED_FORMAT, ASSERT_MSG(SkEncodedFormat, sk_encoded_format_t));
-
-// sk_codec_origin_t
-static_assert ((int)SkCodec::Origin::kTopLeft_Origin == (int)TOP_LEFT_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
-static_assert ((int)SkCodec::Origin::kTopRight_Origin == (int)TOP_RIGHT_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
-static_assert ((int)SkCodec::Origin::kBottomRight_Origin == (int)BOTTOM_RIGHT_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
-static_assert ((int)SkCodec::Origin::kBottomLeft_Origin == (int)BOTTOM_LEFT_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
-static_assert ((int)SkCodec::Origin::kLeftTop_Origin == (int)LEFT_TOP_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
-static_assert ((int)SkCodec::Origin::kRightTop_Origin == (int)RIGHT_TOP_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
-static_assert ((int)SkCodec::Origin::kRightBottom_Origin == (int)RIGHT_BOTTOM_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
-static_assert ((int)SkCodec::Origin::kLeftBottom_Origin == (int)LEFT_BOTTOM_SK_CODEC_ORIGIN, ASSERT_MSG(SkCodec::Origin, sk_codec_origin_t));
-
-// sk_codec_result_t
-static_assert ((int)SkCodec::Result::kSuccess == (int)SUCCESS_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
-static_assert ((int)SkCodec::Result::kIncompleteInput == (int)INCOMPLETE_INPUT_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
-static_assert ((int)SkCodec::Result::kInvalidConversion == (int)INVALID_CONVERSION_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
-static_assert ((int)SkCodec::Result::kInvalidScale == (int)INVALID_SCALE_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
-static_assert ((int)SkCodec::Result::kInvalidParameters == (int)INVALID_PARAMETERS_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
-static_assert ((int)SkCodec::Result::kInvalidInput == (int)INVALID_INPUT_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
-static_assert ((int)SkCodec::Result::kCouldNotRewind == (int)COULD_NOT_REWIND_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
-static_assert ((int)SkCodec::Result::kUnimplemented == (int)UNIMPLEMENTED_SK_CODEC_RESULT, ASSERT_MSG(SkCodec::Result, sk_codec_result_t));
-
-// sk_codec_zero_initialized_t
-static_assert ((int)SkCodec::ZeroInitialized::kYes_ZeroInitialized == (int)YES_SK_CODEC_ZERO_INITIALIZED, ASSERT_MSG(SkCodec::ZeroInitialized, sk_codec_zero_initialized_t));
-static_assert ((int)SkCodec::ZeroInitialized::kNo_ZeroInitialized == (int)NO_SK_CODEC_ZERO_INITIALIZED, ASSERT_MSG(SkCodec::ZeroInitialized, sk_codec_zero_initialized_t));
-
-// sk_path_effect_1d_style_t
-static_assert ((int)SkPath1DPathEffect::Style::kTranslate_Style == (int)TRANSLATE_SK_PATH_EFFECT_1D_STYLE, ASSERT_MSG(SkPath1DPathEffect::Style, sk_path_effect_1d_style_t));
-static_assert ((int)SkPath1DPathEffect::Style::kRotate_Style == (int)ROTATE_SK_PATH_EFFECT_1D_STYLE, ASSERT_MSG(SkPath1DPathEffect::Style, sk_path_effect_1d_style_t));
-static_assert ((int)SkPath1DPathEffect::Style::kMorph_Style == (int)MORPH_SK_PATH_EFFECT_1D_STYLE, ASSERT_MSG(SkPath1DPathEffect::Style, sk_path_effect_1d_style_t));
-
-// sk_point_mode_t
-static_assert ((int)SkCanvas::PointMode::kPoints_PointMode == (int)POINTS_SK_POINT_MODE, ASSERT_MSG(SkCanvas::PointMode, sk_point_mode_t));
-static_assert ((int)SkCanvas::PointMode::kLines_PointMode == (int)LINES_SK_POINT_MODE, ASSERT_MSG(SkCanvas::PointMode, sk_point_mode_t));
-static_assert ((int)SkCanvas::PointMode::kPolygon_PointMode == (int)POLYGON_SK_POINT_MODE, ASSERT_MSG(SkCanvas::PointMode, sk_point_mode_t));
-
-#endif
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkImageEncoder.h"
-
-#include "xamarin/sk_x_image.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-sk_data_t* sk_image_encode_specific(const sk_image_t* cimage, sk_image_encoder_t encoder, int quality) {
- return ToData(AsImage(cimage)->encode((SkImageEncoder::Type)encoder, quality));
-}
-
-sk_image_t* sk_image_new_from_bitmap (const sk_bitmap_t* cbitmap)
-{
- return ToImage(SkImage::MakeFromBitmap(*AsBitmap(cbitmap)).release());
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkImageFilter.h"
-#include "SkColorFilter.h"
-#include "SkAlphaThresholdFilter.h"
-#include "SkBlurImageFilter.h"
-#include "SkColorFilterImageFilter.h"
-#include "SkComposeImageFilter.h"
-#include "SkDisplacementMapEffect.h"
-#include "SkDropShadowImageFilter.h"
-#include "SkLightingImageFilter.h"
-#include "SkMagnifierImageFilter.h"
-#include "SkMatrixConvolutionImageFilter.h"
-#include "SkMergeImageFilter.h"
-#include "SkMorphologyImageFilter.h"
-#include "SkOffsetImageFilter.h"
-#include "SkPictureImageFilter.h"
-#include "SkTileImageFilter.h"
-#include "SkXfermodeImageFilter.h"
-
-#include "xamarin/sk_x_imagefilter.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-sk_imagefilter_croprect_t* sk_imagefilter_croprect_new() {
- return (sk_imagefilter_croprect_t*) new SkImageFilter::CropRect();
-}
-
-sk_imagefilter_croprect_t* sk_imagefilter_croprect_new_with_rect(const sk_rect_t* rect, uint32_t flags) {
- return (sk_imagefilter_croprect_t*) new SkImageFilter::CropRect(*AsRect(rect), flags);
-}
-
-void sk_imagefilter_croprect_destructor(sk_imagefilter_croprect_t* cropRect) {
- delete AsImageFilterCropRect(cropRect);
-}
-
-void sk_imagefilter_croprect_get_rect(sk_imagefilter_croprect_t* cropRect, sk_rect_t* rect) {
- if (rect) {
- *rect = ToRect(AsImageFilterCropRect(cropRect)->rect());
- }
-}
-
-uint32_t sk_imagefilter_croprect_get_flags(sk_imagefilter_croprect_t* cropRect) {
- return AsImageFilterCropRect(cropRect)->flags();
-}
-
-void sk_imagefilter_unref(sk_imagefilter_t* cfilter) {
- SkSafeUnref(AsImageFilter(cfilter));
-}
-
-sk_imagefilter_t* sk_imagefilter_new_matrix(
- const sk_matrix_t* cmatrix,
- sk_filter_quality_t cquality,
- sk_imagefilter_t* input /*NULL*/) {
-
- SkMatrix matrix;
- from_c(cmatrix, &matrix);
-
- sk_sp<SkImageFilter> filter = SkImageFilter::MakeMatrixFilter(matrix, (SkFilterQuality)cquality, sk_ref_sp(AsImageFilter(input)));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_alpha_threshold(
- const sk_irect_t* region,
- float innerThreshold,
- float outerThreshold,
- sk_imagefilter_t* input /*NULL*/) {
-
- SkRegion r = SkRegion(AsIRect(*region));
-
- sk_sp<SkImageFilter> filter = SkAlphaThresholdFilter::Make(r, innerThreshold, outerThreshold, sk_ref_sp(AsImageFilter(input)));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_blur(
- float sigmaX,
- float sigmaY,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkBlurImageFilter::Make(sigmaX, sigmaY, sk_ref_sp(AsImageFilter(input)), AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_color_filter(
- sk_colorfilter_t* cf,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkColorFilterImageFilter::Make(sk_ref_sp(AsColorFilter(cf)), sk_ref_sp(AsImageFilter(input)), AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_compose(
- sk_imagefilter_t* outer,
- sk_imagefilter_t* inner) {
-
- sk_sp<SkImageFilter> filter = SkComposeImageFilter::Make(sk_ref_sp(AsImageFilter(outer)), sk_ref_sp(AsImageFilter(inner)));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_displacement_map_effect(
- sk_displacement_map_effect_channel_selector_type_t xChannelSelector,
- sk_displacement_map_effect_channel_selector_type_t yChannelSelector,
- float scale,
- sk_imagefilter_t* displacement,
- sk_imagefilter_t* color /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkDisplacementMapEffect::Make(
- (SkDisplacementMapEffect::ChannelSelectorType)xChannelSelector,
- (SkDisplacementMapEffect::ChannelSelectorType)yChannelSelector,
- scale,
- sk_ref_sp(AsImageFilter(displacement)),
- sk_ref_sp(AsImageFilter(color)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_drop_shadow(
- float dx,
- float dy,
- float sigmaX,
- float sigmaY,
- sk_color_t color,
- sk_drop_shadow_image_filter_shadow_mode_t cShadowMode,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkDropShadowImageFilter::Make(
- dx,
- dy,
- sigmaX,
- sigmaY,
- color,
- (SkDropShadowImageFilter::ShadowMode)cShadowMode,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_distant_lit_diffuse(
- const sk_point3_t* direction,
- sk_color_t lightColor,
- float surfaceScale,
- float kd,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakeDistantLitDiffuse(
- *AsPoint3(direction),
- lightColor,
- surfaceScale,
- kd,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_point_lit_diffuse(
- const sk_point3_t* location,
- sk_color_t lightColor,
- float surfaceScale,
- float kd,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakePointLitDiffuse(
- *AsPoint3(location),
- lightColor,
- surfaceScale,
- kd,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-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,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakeSpotLitDiffuse(
- *AsPoint3(location),
- *AsPoint3(target),
- specularExponent,
- cutoffAngle,
- lightColor,
- surfaceScale,
- kd,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_distant_lit_specular(
- const sk_point3_t* direction,
- sk_color_t lightColor,
- float surfaceScale,
- float ks,
- float shininess,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakeDistantLitSpecular(
- *AsPoint3(direction),
- lightColor,
- surfaceScale,
- ks,
- shininess,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_point_lit_specular(
- const sk_point3_t* location,
- sk_color_t lightColor,
- float surfaceScale,
- float ks,
- float shininess,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakePointLitSpecular(
- *AsPoint3(location),
- lightColor,
- surfaceScale,
- ks,
- shininess,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-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,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakeSpotLitSpecular(
- *AsPoint3(location),
- *AsPoint3(target),
- specularExponent,
- cutoffAngle,
- lightColor,
- surfaceScale,
- ks,
- shininess,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_magnifier(
- const sk_rect_t* src,
- float inset,
- sk_imagefilter_t* input /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkMagnifierImageFilter::Make(
- *AsRect(src),
- inset,
- sk_ref_sp(AsImageFilter(input)));
- return ToImageFilter(filter.release());
-}
-
-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_matrix_convolution_tilemode_t ctileMode,
- bool convolveAlpha,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkMatrixConvolutionImageFilter::Make(
- *AsISize(kernelSize),
- kernel,
- gain,
- bias,
- *AsIPoint(kernelOffset),
- (SkMatrixConvolutionImageFilter::TileMode)ctileMode,
- convolveAlpha,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_merge(
- sk_imagefilter_t* cfilters[],
- int count,
- const sk_xfermode_mode_t cmodes[] /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter>* filters = new sk_sp<SkImageFilter>[count];
- for (int i = 0; i < count; i++) {
- filters[i] = sk_ref_sp(AsImageFilter(cfilters[i]));
- }
-
- sk_sp<SkImageFilter> filter = SkMergeImageFilter::Make(
- filters,
- count,
- (SkXfermode::Mode*)cmodes,
- AsImageFilterCropRect(cropRect));
-
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_dilate(
- int radiusX,
- int radiusY,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkDilateImageFilter::Make(
- radiusX,
- radiusY,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_erode(
- int radiusX,
- int radiusY,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkErodeImageFilter::Make(
- radiusX,
- radiusY,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_offset(
- float dx,
- float dy,
- sk_imagefilter_t* input /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkOffsetImageFilter::Make(
- dx,
- dy,
- sk_ref_sp(AsImageFilter(input)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_picture(
- sk_picture_t* picture) {
-
- sk_sp<SkImageFilter> filter = SkPictureImageFilter::Make(
- sk_ref_sp(AsPicture(picture)));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_picture_with_croprect(
- sk_picture_t* picture,
- const sk_rect_t* cropRect) {
-
- sk_sp<SkImageFilter> filter = SkPictureImageFilter::Make(
- sk_ref_sp(AsPicture(picture)),
- *AsRect(cropRect));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_picture_for_localspace(
- sk_picture_t* picture,
- const sk_rect_t* cropRect,
- sk_filter_quality_t filterQuality) {
-
- sk_sp<SkImageFilter> filter = SkPictureImageFilter::MakeForLocalSpace(
- sk_ref_sp(AsPicture(picture)),
- *AsRect(cropRect),
- (SkFilterQuality)filterQuality);
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_tile(
- const sk_rect_t* src,
- const sk_rect_t* dst,
- sk_imagefilter_t* input) {
-
- sk_sp<SkImageFilter> filter = SkTileImageFilter::Make(
- *AsRect(src),
- *AsRect(dst),
- sk_ref_sp(AsImageFilter(input)));
- return ToImageFilter(filter.release());
-}
-
-sk_imagefilter_t* sk_imagefilter_new_xfermode(
- sk_xfermode_mode_t cmode,
- sk_imagefilter_t* background,
- sk_imagefilter_t* foreground /*NULL*/,
- const sk_imagefilter_croprect_t* cropRect /*NULL*/) {
-
- sk_sp<SkImageFilter> filter = SkXfermodeImageFilter::Make(
- SkXfermode::Make((SkXfermode::Mode)cmode),
- sk_ref_sp(AsImageFilter(background)),
- sk_ref_sp(AsImageFilter(foreground)),
- AsImageFilterCropRect(cropRect));
- return ToImageFilter(filter.release());
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkBlurMaskFilter.h"
-#include "SkTableMaskFilter.h"
-
-#include "xamarin/sk_x_maskfilter.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-sk_maskfilter_t* sk_maskfilter_new_emboss(
- float blurSigma,
- const float direction[3],
- float ambient,
- float specular) {
- return ToMaskFilter(SkBlurMaskFilter::MakeEmboss(blurSigma, direction, ambient, specular).release());
-}
-
-sk_maskfilter_t* sk_maskfilter_new_table(const uint8_t table[256]) {
- return ToMaskFilter(SkTableMaskFilter::Create(table));
-}
-
-sk_maskfilter_t* sk_maskfilter_new_gamma(float gamma) {
- return ToMaskFilter(SkTableMaskFilter::CreateGamma(gamma));
-}
-
-sk_maskfilter_t* sk_maskfilter_new_clip(uint8_t min, uint8_t max) {
- return ToMaskFilter(SkTableMaskFilter::CreateClip(min, max));
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkStream.h"
-
-#include "xamarin/sk_x_matrix.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-int sk_matrix_try_invert (sk_matrix_t *matrix, sk_matrix_t *result)
-{
- SkMatrix copy, inverse;
- from_c (matrix, ©);
- if (copy.invert (&inverse)){
- from_sk (&inverse, result);
- return 1;
- }
- return 0;
-}
-
-void sk_matrix_concat (sk_matrix_t *matrix, sk_matrix_t *first, sk_matrix_t *second)
-{
- SkMatrix target, skfirst, sksecond;
-
- from_c (matrix, &target);
- from_c (first, &skfirst);
- from_c (second, &sksecond);
- target.setConcat (skfirst, sksecond);
- from_sk (&target, matrix);
-}
-
-void sk_matrix_pre_concat (sk_matrix_t *target, sk_matrix_t *matrix)
-{
- SkMatrix sktarget, skmatrix;
- from_c (target, &sktarget);
- from_c (matrix, &skmatrix);
- sktarget.preConcat (skmatrix);
- from_sk (&sktarget, target);
-}
-
-void sk_matrix_post_concat (sk_matrix_t *target, sk_matrix_t *matrix)
-{
- SkMatrix sktarget, skmatrix;
- from_c (target, &sktarget);
- from_c (matrix, &skmatrix);
- sktarget.postConcat (skmatrix);
- from_sk (&sktarget, target);
-}
-
-void sk_matrix_map_rect (sk_matrix_t *matrix, sk_rect_t *dest, sk_rect_t *source)
-{
- SkMatrix skmatrix;
- from_c (matrix, &skmatrix);
- skmatrix.mapRect (AsRect (dest), *AsRect(source));
-}
-
-void sk_matrix_map_points (sk_matrix_t *matrix, sk_point_t *dst, sk_point_t *src, int count)
-{
- SkMatrix skmatrix;
- from_c (matrix, &skmatrix);
- skmatrix.mapPoints (AsPoint (dst), AsPoint (src), count);
-}
-
-void sk_matrix_map_vectors (sk_matrix_t *matrix, sk_point_t *dst, sk_point_t *src, int count)
-{
- SkMatrix skmatrix;
- from_c (matrix, &skmatrix);
- skmatrix.mapVectors (AsPoint (dst), AsPoint (src), count);
-}
-
-sk_point_t sk_matrix_map_xy (sk_matrix_t *matrix, float x, float y)
-{
- SkMatrix skmatrix;
- SkPoint result;
- from_c (matrix, &skmatrix);
- skmatrix.mapXY (x, y, &result);
- return *ToPoint(&result);
-}
-
-sk_point_t sk_matrix_map_vector (sk_matrix_t *matrix, float x, float y)
-{
- SkMatrix skmatrix;
- SkPoint result;
- from_c (matrix, &skmatrix);
- skmatrix.mapVector (x, y, &result);
- return *ToPoint(&result);
-}
-
-float sk_matrix_map_radius (sk_matrix_t *matrix, float radius)
-{
- SkMatrix skmatrix;
- from_c (matrix, &skmatrix);
- return skmatrix.mapRadius (radius);
-}
-
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkPaint.h"
-#include "SkTypeface.h"
-#include "SkColorFilter.h"
-
-#include "xamarin/sk_x_paint.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-bool sk_paint_is_dither(const sk_paint_t* cpaint) {
- return AsPaint(*cpaint).isDither();
-}
-
-void sk_paint_set_dither(sk_paint_t* cpaint, bool isdither) {
- AsPaint(cpaint)->setDither(isdither);
-}
-
-bool sk_paint_is_verticaltext(const sk_paint_t* cpaint) {
- return AsPaint(*cpaint).isVerticalText();
-}
-
-void sk_paint_set_verticaltext(sk_paint_t* cpaint, bool vt) {
- AsPaint(cpaint)->setVerticalText(vt);
-}
-
-sk_shader_t* sk_paint_get_shader(sk_paint_t* cpaint) {
- return ToShader(AsPaint(cpaint)->getShader());
-}
-
-sk_maskfilter_t* sk_paint_get_maskfilter(sk_paint_t* cpaint) {
- return ToMaskFilter(AsPaint(cpaint)->getMaskFilter());
-}
-
-void sk_paint_set_colorfilter(sk_paint_t* cpaint, sk_colorfilter_t* cfilter) {
- AsPaint(cpaint)->setColorFilter(sk_ref_sp(AsColorFilter(cfilter)));
-}
-
-sk_colorfilter_t* sk_paint_get_colorfilter(sk_paint_t* cpaint) {
- return ToColorFilter(AsPaint(cpaint)->getColorFilter());
-}
-
-void sk_paint_set_imagefilter(sk_paint_t* cpaint, sk_imagefilter_t* cfilter) {
- AsPaint(cpaint)->setImageFilter(AsImageFilter(cfilter));
-}
-
-sk_imagefilter_t* sk_paint_get_imagefilter(sk_paint_t* cpaint) {
- return ToImageFilter(AsPaint(cpaint)->getImageFilter());
-}
-
-sk_xfermode_mode_t sk_paint_get_xfermode_mode(sk_paint_t* paint) {
- SkASSERT(paint);
- SkXfermode::Mode mode;
- if (SkXfermode::AsMode(AsPaint(paint)->getXfermode(), &mode)) {
- return (sk_xfermode_mode_t)mode;
- }
- return SRCOVER_SK_XFERMODE_MODE;
-}
-
-void sk_paint_set_filter_quality(sk_paint_t* cpaint, sk_filter_quality_t filterQuality)
-{
- SkASSERT(cpaint);
- AsPaint(cpaint)->setFilterQuality((SkFilterQuality)filterQuality);
-}
-
-sk_filter_quality_t sk_paint_get_filter_quality(sk_paint_t* cpaint)
-{
- SkASSERT(cpaint);
- return (sk_filter_quality_t)AsPaint(cpaint)->getFilterQuality();
-}
-
-sk_typeface_t* sk_paint_get_typeface(sk_paint_t* paint)
-{
- return ToTypeface(AsPaint(paint)->getTypeface());
-}
-
-void sk_paint_set_typeface(sk_paint_t* paint, sk_typeface_t* typeface)
-{
- AsPaint(paint)->setTypeface(sk_ref_sp(AsTypeface(typeface)));
-}
-
-float sk_paint_get_textsize(sk_paint_t* paint)
-{
- return AsPaint(paint)->getTextSize();
-}
-
-void sk_paint_set_textsize(sk_paint_t* paint, float size)
-{
- AsPaint(paint)->setTextSize(size);
-}
-
-sk_text_align_t sk_paint_get_text_align(const sk_paint_t* cpaint) {
- return (sk_text_align_t)AsPaint(*cpaint).getTextAlign();
-}
-
-void sk_paint_set_text_align(sk_paint_t* cpaint, sk_text_align_t calign) {
- AsPaint(cpaint)->setTextAlign((SkPaint::Align)calign);
-}
-
-sk_text_encoding_t sk_paint_get_text_encoding(const sk_paint_t* cpaint) {
- return (sk_text_encoding_t)AsPaint(*cpaint).getTextEncoding();
-}
-
-void sk_paint_set_text_encoding(sk_paint_t* cpaint, sk_text_encoding_t cencoding) {
- AsPaint(cpaint)->setTextEncoding((SkPaint::TextEncoding)cencoding);
-}
-
-float sk_paint_get_text_scale_x(const sk_paint_t* cpaint) {
- return AsPaint(cpaint)->getTextScaleX();
-}
-
-void sk_paint_set_text_scale_x(sk_paint_t* cpaint, float scale) {
- AsPaint(cpaint)->setTextScaleX(scale);
-}
-
-float sk_paint_get_text_skew_x(const sk_paint_t* cpaint) {
- return AsPaint(cpaint)->getTextSkewX();
-}
-
-void sk_paint_set_text_skew_x(sk_paint_t* cpaint, float skew) {
- AsPaint(cpaint)->setTextSkewX(skew);
-}
-
-size_t sk_paint_break_text(const sk_paint_t* cpaint, const void* text, size_t length, float maxWidth, float* measuredWidth) {
- return AsPaint(cpaint)->breakText(text, length, maxWidth, measuredWidth);
-}
-
-float sk_paint_measure_text(const sk_paint_t* cpaint, const void* text, size_t length, sk_rect_t* bounds) {
- return AsPaint(cpaint)->measureText(text, length, AsRect(bounds));
-}
-
-sk_path_t* sk_paint_get_text_path(sk_paint_t* cpaint, const void* text, size_t length, float x, float y) {
- SkPath* path = new SkPath();
- AsPaint(cpaint)->getTextPath(text, length, x, y, path);
- return ToPath(path);
-}
-
-sk_path_t* sk_paint_get_pos_text_path(sk_paint_t* cpaint, const void* text, size_t length, const sk_point_t pos[]) {
- SkPath* path = new SkPath();
- AsPaint(cpaint)->getPosTextPath(text, length, reinterpret_cast<const SkPoint*>(pos), path);
- return ToPath(path);
-}
-
-float sk_paint_get_fontmetrics(sk_paint_t* cpaint, sk_fontmetrics_t* cfontmetrics, float scale)
-{
- SkPaint *paint = AsPaint(cpaint);
- return paint->getFontMetrics(AsFontMetrics(cfontmetrics), scale);
-}
-
-sk_path_effect_t* sk_paint_get_path_effect(sk_paint_t* cpaint) {
- return ToPathEffect(AsPaint(cpaint)->getPathEffect());
-}
-
-void sk_paint_set_path_effect(sk_paint_t* cpaint, sk_path_effect_t* effect) {
- AsPaint(cpaint)->setPathEffect(sk_ref_sp(AsPathEffect(effect)));
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkPath.h"
-
-#include "xamarin/sk_x_path.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-void sk_path_rmove_to(sk_path_t* cpath, float dx, float dy) {
- AsPath(cpath)->rMoveTo(dx, dy);
-}
-
-void sk_path_rline_to(sk_path_t* cpath, float dx, float dy) {
- AsPath(cpath)->rLineTo(dx, dy);
-}
-
-void sk_path_rquad_to(sk_path_t* cpath, float dx0, float dy0, float dx1, float dy1) {
- AsPath(cpath)->rQuadTo(dx0, dy0, dx1, dy1);
-}
-
-void sk_path_rconic_to(sk_path_t* cpath, float dx0, float dy0, float dx1, float dy1, float w) {
- AsPath(cpath)->rConicTo(dx0, dy0, dx1, dy1, w);
-}
-
-void sk_path_rcubic_to(sk_path_t* cpath, float dx0, float dy0, float dx1, float dy1, float dx2, float dy2) {
- AsPath(cpath)->rCubicTo(dx0, dy0, dx1, dy1, dx2, dy2);
-}
-
-void sk_path_add_rect_start(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir, uint32_t startIndex) {
- AsPath(cpath)->addRect(AsRect(*crect), (SkPath::Direction)cdir, startIndex);
-}
-
-void sk_path_add_arc(sk_path_t* cpath, const sk_rect_t* crect, float startAngle, float sweepAngle) {
- AsPath(cpath)->addArc(AsRect(*crect), startAngle, sweepAngle);
-}
-
-void sk_path_set_filltype(sk_path_t* cpath, sk_path_filltype_t cfilltype) {
- AsPath(cpath)->setFillType((SkPath::FillType)cfilltype);
-}
-
-sk_path_filltype_t sk_path_get_filltype(sk_path_t *cpath) {
- return (sk_path_filltype_t)AsPath(cpath)->getFillType();
-}
-
-void sk_path_transform(sk_path_t* cpath, const sk_matrix_t* cmatrix)
-{
- SkMatrix matrix;
- if (cmatrix) {
- from_c(cmatrix, &matrix);
- }
- return AsPath(cpath)->transform(matrix);
-}
-
-sk_path_t* sk_path_clone(const sk_path_t* cpath)
-{
- return (sk_path_t*)new SkPath(AsPath(*cpath));
-}
-
-void sk_path_rewind (sk_path_t* cpath)
-{
- AsPath (cpath)->rewind ();
-}
-
-void sk_path_reset (sk_path_t* cpath)
-{
- AsPath (cpath)->reset ();
-}
-
-sk_path_iterator_t* sk_path_create_iter (sk_path_t *cpath, int forceClose)
-{
- SkPath::Iter* iter = new SkPath::Iter(AsPath(*cpath), forceClose);
- return ToPathIter(iter);
-}
-
-sk_path_verb_t sk_path_iter_next (sk_path_iterator_t *iterator, sk_point_t points [4], int doConsumeDegenerates, int exact)
-{
- SkPath::Iter *iter = AsPathIter(iterator);
- SkPoint *pts = AsPoint(points);
- SkPath::Verb verb = iter->next(pts, doConsumeDegenerates, exact);
- return (sk_path_verb_t)verb;
-}
-
-float sk_path_iter_conic_weight (sk_path_iterator_t *iterator)
-{
- return AsPathIter(iterator)->conicWeight ();
-}
-
-int sk_path_iter_is_close_line (sk_path_iterator_t *iterator)
-{
- return AsPathIter(iterator)->isCloseLine ();
-}
-
-int sk_path_iter_is_closed_contour (sk_path_iterator_t *iterator)
-{
- return AsPathIter(iterator)->isClosedContour ();
-}
-
-void sk_path_iter_destroy (sk_path_iterator_t *iterator)
-{
- delete AsPathIter (iterator);
-}
-
-sk_path_rawiterator_t* sk_path_create_rawiter (sk_path_t *cpath)
-{
- SkPath::RawIter* iter = new SkPath::RawIter(AsPath(*cpath));
- return ToPathRawIter(iter);
-}
-
-sk_path_verb_t sk_path_rawiter_next (sk_path_rawiterator_t *iterator, sk_point_t points [4])
-{
- SkPath::RawIter *iter = AsPathRawIter(iterator);
- SkPoint *pts = AsPoint(points);
- SkPath::Verb verb = iter->next(pts);
- return (sk_path_verb_t)verb;
-}
-
-sk_path_verb_t sk_path_rawiter_peek (sk_path_rawiterator_t *iterator)
-{
- return (sk_path_verb_t) AsPathRawIter(iterator)->peek ();
-}
-
-float sk_path_rawiter_conic_weight (sk_path_rawiterator_t *iterator)
-{
- return AsPathRawIter(iterator)->conicWeight ();
-}
-
-void sk_path_rawiter_destroy (sk_path_rawiterator_t *iterator)
-{
- delete AsPathRawIter (iterator);
-}
-
-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)
-{
- AsPath (cpath)->addPath (AsPath (*other), dx, dy, (SkPath::AddPathMode) add_mode);
-}
-
-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)
-{
- SkMatrix skmatrix;
- from_c(matrix, &skmatrix);
- AsPath (cpath)->addPath (AsPath (*other), skmatrix, (SkPath::AddPathMode) add_mode);
-}
-
-void sk_path_add_path (sk_path_t* cpath, sk_path_t* other, sk_path_add_mode_t add_mode)
-{
- AsPath (cpath)->addPath (AsPath (*other), (SkPath::AddPathMode) add_mode);
-}
-
-void sk_path_add_path_reverse (sk_path_t* cpath, sk_path_t* other)
-{
- AsPath (cpath)->reverseAddPath (AsPath (*other));
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkPathEffect.h"
-#include "SkDiscretePathEffect.h"
-#include "SkCornerPathEffect.h"
-#include "Sk1DPathEffect.h"
-#include "Sk2DPathEffect.h"
-#include "SkDashPathEffect.h"
-#include "SkPath.h"
-
-#include "xamarin/sk_x_patheffect.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-void sk_path_effect_unref(sk_path_effect_t* effect)
-{
- SkSafeUnref(AsPathEffect(effect));
-}
-
-sk_path_effect_t* sk_path_effect_create_compose(sk_path_effect_t* outer, sk_path_effect_t* inner)
-{
- return ToPathEffect(SkComposePathEffect::Make(sk_ref_sp(AsPathEffect(outer)), sk_ref_sp(AsPathEffect(inner))).release());
-}
-
-sk_path_effect_t* sk_path_effect_create_sum(sk_path_effect_t* first, sk_path_effect_t* second)
-{
- return ToPathEffect(SkSumPathEffect::Make(sk_ref_sp(AsPathEffect(first)), sk_ref_sp(AsPathEffect(second))).release());
-}
-
-sk_path_effect_t* sk_path_effect_create_discrete(float segLength, float deviation, uint32_t seedAssist /*0*/)
-{
- return ToPathEffect(SkDiscretePathEffect::Make(segLength, deviation, seedAssist).release());
-}
-
-sk_path_effect_t* sk_path_effect_create_corner(float radius)
-{
- return ToPathEffect(SkCornerPathEffect::Make(radius).release());
-}
-
-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)
-{
- return ToPathEffect(SkPath1DPathEffect::Make(AsPath(*path), advance, phase, (SkPath1DPathEffect::Style)style).release());
-}
-
-sk_path_effect_t* sk_path_effect_create_2d_line(float width, const sk_matrix_t* cmatrix)
-{
- SkMatrix matrix;
- if (cmatrix) {
- from_c(cmatrix, &matrix);
- }
- return ToPathEffect(SkLine2DPathEffect::Make(width, matrix).release());
-}
-
-sk_path_effect_t* sk_path_effect_create_2d_path(const sk_matrix_t* cmatrix, const sk_path_t* path)
-{
- SkMatrix matrix;
- if (cmatrix) {
- from_c(cmatrix, &matrix);
- }
- return ToPathEffect(SkPath2DPathEffect::Make(matrix, AsPath(*path)).release());
-}
-
-sk_path_effect_t* sk_path_effect_create_dash(const float intervals[], int count, float phase)
-{
- return ToPathEffect(SkDashPathEffect::Make(intervals, count, phase).release());
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkShader.h"
-#include "SkComposeShader.h"
-#include "SkColorFilter.h"
-#include "SkPerlinNoiseShader.h"
-
-#include "xamarin/sk_x_shader.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-sk_shader_t* sk_shader_new_empty() {
- return ToShader(SkShader::MakeEmptyShader().release());
-}
-
-sk_shader_t* sk_shader_new_color(sk_color_t color) {
- return ToShader(SkShader::MakeColorShader(color).release());
-}
-
-sk_shader_t* sk_shader_new_bitmap(const sk_bitmap_t* src,
- sk_shader_tilemode_t tmx,
- sk_shader_tilemode_t tmy,
- const sk_matrix_t* localMatrix) {
- SkMatrix matrix;
- if (localMatrix) {
- from_c(localMatrix, &matrix);
- } else {
- matrix.setIdentity();
- }
- sk_sp<SkShader> s = SkShader::MakeBitmapShader(
- *AsBitmap(src),
- (SkShader::TileMode)tmx,
- (SkShader::TileMode)tmy,
- &matrix);
- return ToShader(s.release());
-}
-
-sk_shader_t* sk_shader_new_picture(sk_picture_t* src,
- sk_shader_tilemode_t tmx,
- sk_shader_tilemode_t tmy,
- const sk_matrix_t* localMatrix,
- const sk_rect_t* tile) {
- SkMatrix matrix;
- if (localMatrix) {
- from_c(localMatrix, &matrix);
- }
- else {
- matrix.setIdentity();
- }
- sk_sp<SkShader> s = SkShader::MakePictureShader(
- sk_ref_sp(AsPicture(src)),
- (SkShader::TileMode)tmx,
- (SkShader::TileMode)tmy,
- &matrix,
- AsRect(tile));
- return ToShader(s.release());
-}
-
-sk_shader_t* sk_shader_new_color_filter(sk_shader_t* proxy,
- sk_colorfilter_t* filter) {
- sk_sp<SkShader> s = AsShader(proxy)->makeWithColorFilter(sk_ref_sp(AsColorFilter(filter)));
- return ToShader(s.release());
-}
-
-sk_shader_t* sk_shader_new_local_matrix(sk_shader_t* proxy,
- const sk_matrix_t* localMatrix) {
- SkMatrix matrix;
- if (localMatrix) {
- from_c(localMatrix, &matrix);
- } else {
- matrix.setIdentity();
- }
- sk_sp<SkShader> s = AsShader(proxy)->makeWithLocalMatrix(matrix);
- return ToShader(s.release());
-}
-
-sk_shader_t* sk_shader_new_perlin_noise_fractal_noise(
- float baseFrequencyX,
- float baseFrequencyY,
- int numOctaves,
- float seed,
- const sk_isize_t* ctileSize) {
-
- const SkISize* tileSize = AsISize(ctileSize);
- sk_sp<SkShader> s = SkPerlinNoiseShader::MakeFractalNoise(
- baseFrequencyX,
- baseFrequencyY,
- numOctaves,
- seed,
- tileSize);
- return ToShader(s.release());
-}
-
-sk_shader_t* sk_shader_new_perlin_noise_turbulence(
- float baseFrequencyX,
- float baseFrequencyY,
- int numOctaves,
- float seed,
- const sk_isize_t* ctileSize) {
-
- const SkISize* tileSize = AsISize(ctileSize);
- sk_sp<SkShader> s = SkPerlinNoiseShader::MakeTurbulence(
- baseFrequencyX,
- baseFrequencyY,
- numOctaves,
- seed,
- tileSize);
- return ToShader(s.release());
-}
-
-sk_shader_t* sk_shader_new_compose(
- sk_shader_t* shaderA,
- sk_shader_t* shaderB) {
-
- sk_sp<SkShader> s = SkShader::MakeComposeShader(
- sk_ref_sp(AsShader(shaderA)),
- sk_ref_sp(AsShader(shaderB)),
- SkXfermode::kSrcOver_Mode);
- return ToShader(s.release());
-}
-
-sk_shader_t* sk_shader_new_compose_with_mode(
- sk_shader_t* shaderA,
- sk_shader_t* shaderB,
- sk_xfermode_mode_t cmode) {
-
- sk_sp<SkShader> s = SkShader::MakeComposeShader(
- sk_ref_sp(AsShader(shaderA)),
- sk_ref_sp(AsShader(shaderB)),
- (SkXfermode::Mode)cmode);
- return ToShader(s.release());
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkStream.h"
-
-#include "xamarin/sk_x_stream.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-void sk_stream_asset_destroy(sk_stream_asset_t* cstream)
-{
- delete AsStreamAsset(cstream);
-}
-
-void sk_filestream_destroy(sk_stream_filestream_t* cstream)
-{
- delete AsFileStream(cstream);
-}
-
-void sk_memorystream_destroy(sk_stream_memorystream_t* cstream)
-{
- delete AsMemoryStream(cstream);
-}
-
-sk_stream_filestream_t* sk_filestream_new (const char* path)
-{
- return ToFileStream(new SkFILEStream(path));
-}
-
-sk_stream_memorystream_t* sk_memorystream_new ()
-{
- return ToMemoryStream(new SkMemoryStream());
-}
-sk_stream_memorystream_t* sk_memorystream_new_with_length (size_t length)
-{
- return ToMemoryStream(new SkMemoryStream(length));
-}
-sk_stream_memorystream_t* sk_memorystream_new_with_data (const void* data, size_t length, bool copyData)
-{
- return ToMemoryStream(new SkMemoryStream(data, length, copyData));
-}
-sk_stream_memorystream_t* sk_memorystream_new_with_skdata (sk_data_t* data)
-{
- return ToMemoryStream(new SkMemoryStream(AsData(data)));
-}
-void sk_memorystream_set_memory (sk_stream_memorystream_t* cmemorystream, const void* data, size_t length, bool copyData)
-{
- AsMemoryStream(cmemorystream)->setMemory(data, length, copyData);
-}
-
-size_t sk_stream_read (sk_stream_t* cstream, void* buffer, size_t size)
-{
- return AsStream(cstream)->read(buffer, size);
-}
-
-size_t sk_stream_skip (sk_stream_t* cstream, size_t size)
-{
- return AsStream(cstream)->skip(size);
-}
-
-bool sk_stream_is_at_end (sk_stream_t* cstream)
-{
- return AsStream(cstream)->isAtEnd();
-}
-int8_t sk_stream_read_s8 (sk_stream_t* cstream)
-{
- return AsStream(cstream)->readS8();
-}
-int16_t sk_stream_read_s16 (sk_stream_t* cstream)
-{
- return AsStream(cstream)->readS16();
-}
-int32_t sk_stream_read_s32 (sk_stream_t* cstream)
-{
- return AsStream(cstream)->readS32();
-}
-uint8_t sk_stream_read_u8 (sk_stream_t* cstream)
-{
- return AsStream(cstream)->readU8();
-}
-uint16_t sk_stream_read_u16 (sk_stream_t* cstream)
-{
- return AsStream(cstream)->readU16();
-}
-uint32_t sk_stream_read_u32 (sk_stream_t* cstream)
-{
- return AsStream(cstream)->readU32();
-}
-bool sk_stream_read_bool (sk_stream_t* cstream)
-{
- return AsStream(cstream)->readBool();
-}
-
-bool sk_stream_rewind (sk_stream_t* cstream)
-{
- return AsStream(cstream)->rewind();
-}
-
-bool sk_stream_has_position (sk_stream_t* cstream)
-{
- return AsStream(cstream)->hasPosition();
-}
-
-size_t sk_stream_get_position (sk_stream_t* cstream)
-{
- return AsStream(cstream)->getPosition();
-}
-
-bool sk_stream_seek (sk_stream_t* cstream, size_t position)
-{
- return AsStream(cstream)->seek(position);
-}
-
-bool sk_stream_move (sk_stream_t* cstream, long offset)
-{
- return AsStream(cstream)->move(offset);
-}
-
-bool sk_stream_has_length (sk_stream_t* cstream)
-{
- return AsStream(cstream)->hasLength();
-}
-
-size_t sk_stream_get_length (sk_stream_t* cstream)
-{
- return AsStream(cstream)->getLength();
-}
-
-void sk_filewstream_destroy(sk_wstream_filestream_t* cstream)
-{
- delete AsFileWStream(cstream);
-}
-
-void sk_dynamicmemorywstream_destroy(sk_wstream_dynamicmemorystream_t* cstream)
-{
- delete AsDynamicMemoryWStream(cstream);
-}
-
-sk_wstream_filestream_t* sk_filewstream_new(const char* path)
-{
- return ToFileWStream(new SkFILEWStream(path));
-}
-
-sk_wstream_dynamicmemorystream_t* sk_dynamicmemorywstream_new()
-{
- return ToDynamicMemoryWStream(new SkDynamicMemoryWStream());
-}
-
-sk_data_t* sk_dynamicmemorywstream_copy_to_data(sk_wstream_dynamicmemorystream_t* cstream)
-{
- return ToData(AsDynamicMemoryWStream(cstream)->copyToData());
-}
-
-sk_stream_asset_t* sk_dynamicmemorywstream_detach_as_stream(sk_wstream_dynamicmemorystream_t* cstream)
-{
- return ToStreamAsset(AsDynamicMemoryWStream(cstream)->detachAsStream());
-}
-
-bool sk_wstream_write(sk_wstream_t* cstream, const void* buffer, size_t size)
-{
- return AsWStream(cstream)->write(buffer, size);
-}
-
-void sk_wstream_newline(sk_wstream_t* cstream)
-{
- return AsWStream(cstream)->newline();
-}
-
-void sk_wstream_flush(sk_wstream_t* cstream)
-{
- return AsWStream(cstream)->flush();
-}
-
-size_t sk_wstream_bytes_written(sk_wstream_t* cstream)
-{
- return AsWStream(cstream)->bytesWritten();
-}
-
-bool sk_wstream_write_8(sk_wstream_t* cstream, uint8_t value)
-{
- return AsWStream(cstream)->write8(value);
-}
-
-bool sk_wstream_write_16(sk_wstream_t* cstream, uint16_t value)
-{
- return AsWStream(cstream)->write16(value);
-}
-
-bool sk_wstream_write_32(sk_wstream_t* cstream, uint32_t value)
-{
- return AsWStream(cstream)->write32(value);
-}
-
-bool sk_wstream_write_text(sk_wstream_t* cstream, const char* value)
-{
- return AsWStream(cstream)->writeText(value);
-}
-
-bool sk_wstream_write_dec_as_text(sk_wstream_t* cstream, int32_t value)
-{
- return AsWStream(cstream)->writeDecAsText(value);
-}
-
-bool sk_wstream_write_bigdec_as_text(sk_wstream_t* cstream, int64_t value, int minDigits)
-{
- return AsWStream(cstream)->writeBigDecAsText(value, minDigits);
-}
-
-bool sk_wstream_write_hex_as_text(sk_wstream_t* cstream, uint32_t value, int minDigits)
-{
- return AsWStream(cstream)->writeHexAsText(value, minDigits);
-}
-
-bool sk_wstream_write_scalar_as_text(sk_wstream_t* cstream, float value)
-{
- return AsWStream(cstream)->writeScalarAsText(value);
-}
-
-bool sk_wstream_write_bool(sk_wstream_t* cstream, bool value)
-{
- return AsWStream(cstream)->writeBool(value);
-}
-
-bool sk_wstream_write_scalar(sk_wstream_t* cstream, float value)
-{
- return AsWStream(cstream)->writeScalar(value);
-}
-
-bool sk_wstream_write_packed_uint(sk_wstream_t* cstream, size_t value)
-{
- return AsWStream(cstream)->writePackedUInt(value);
-}
-
-bool sk_wstream_write_stream(sk_wstream_t* cstream, sk_stream_t* input, size_t length)
-{
- return AsWStream(cstream)->writeStream(AsStream(input), length);
-}
-
-int sk_wstream_get_size_of_packed_uint(size_t value)
-{
- return SkWStream::SizeOfPackedUInt(value);
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkString.h"
-
-#include "xamarin/sk_x_string.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-sk_string_t* sk_string_new_empty() {
- return ToString(new SkString());
-}
-
-sk_string_t* sk_string_new_with_copy(const char* src, size_t length) {
- return ToString(new SkString(src, length));
-}
-
-void sk_string_destructor(const sk_string_t* cstring) {
- delete AsString(cstring);
-}
-
-size_t sk_string_get_size(const sk_string_t* cstring) {
- return AsString(cstring)->size();
-}
-
-const char* sk_string_get_c_str(const sk_string_t* cstring) {
- return AsString(cstring)->c_str();
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkTypeface.h"
-
-#include "xamarin/sk_x_typeface.h"
-
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
-
-void sk_typeface_unref(sk_typeface_t* tf)
-{
- AsTypeface(tf)->unref();
-}
-
-sk_typeface_t* sk_typeface_create_from_name(const char *familyName, sk_typeface_style_t sstyle)
-{
- return ToTypeface(SkTypeface::MakeFromName (familyName, SkFontStyle::FromOldStyle((SkTypeface::Style)sstyle)).release());
-}
-
-sk_typeface_t* sk_typeface_create_from_name_with_font_style(const char *familyName, int weight, int width, sk_font_style_slant_t slant)
-{
- return ToTypeface(SkTypeface::MakeFromName (familyName, SkFontStyle(weight, width, (SkFontStyle::Slant)slant)).release());
-}
-
-sk_typeface_t* sk_typeface_create_from_typeface(sk_typeface_t* typeface, sk_typeface_style_t sstyle)
-{
- return ToTypeface(SkTypeface::MakeFromTypeface (AsTypeface(typeface), (SkTypeface::Style)sstyle).release());
-}
-
-sk_typeface_t* sk_typeface_create_from_file(const char* path, int index)
-{
- return ToTypeface(SkTypeface::MakeFromFile (path, index).release());
-}
-
-sk_typeface_t* sk_typeface_create_from_stream(sk_stream_asset_t* stream, int index)
-{
- return ToTypeface(SkTypeface::MakeFromStream (AsStreamAsset(stream), index).release());
-}
-
-int sk_typeface_chars_to_glyphs (sk_typeface_t* typeface, const char *chars, sk_encoding_t encoding, uint16_t glyphs [], int glyphCount)
-{
- return (AsTypeface(typeface))->charsToGlyphs(chars, (SkTypeface::Encoding)encoding, glyphs, glyphCount);
-}
-
-int sk_typeface_glyph_count (sk_typeface_t* typeface)
-{
- return AsTypeface(typeface)->countGlyphs();
-}
-
-sk_string_t* sk_typeface_get_family_name(sk_typeface_t* typeface)
-{
- SkString* family_name = new SkString();
- AsTypeface(typeface)->getFamilyName(family_name);
- return ToString(family_name);
-}
-
-int sk_typeface_count_tables(sk_typeface_t* typeface)
-{
- return AsTypeface(typeface)->countTables();
-}
-
-int sk_typeface_get_table_tags(sk_typeface_t* typeface, sk_font_table_tag_t tags[])
-{
- return AsTypeface(typeface)->getTableTags(tags);
-}
-
-size_t sk_typeface_get_table_size(sk_typeface_t* typeface, sk_font_table_tag_t tag)
-{
- return AsTypeface(typeface)->getTableSize(tag);
-}
-
-size_t sk_typeface_get_table_data(sk_typeface_t* typeface, sk_font_table_tag_t tag, size_t offset, size_t length, void* data)
-{
- return AsTypeface(typeface)->getTableData(tag, offset, length, data);
-}
+++ /dev/null
-/*
- * Copyright 2016 Xamarin Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
-// DO NOT USE -- FOR INTERNAL TESTING ONLY
-
-#ifndef sk_x_types_priv_DEFINED
-#define sk_x_types_priv_DEFINED
-
-#include "SkImageInfo.h"
-#include "SkBlurTypes.h"
-#include "SkDocument.h"
-#include "SkPaint.h"
-#include "SkPath.h"
-#include "SkCodec.h"
-#include "SkPicture.h"
-#include "SkPictureRecorder.h"
-#include "SkPoint3.h"
-#include "SkStream.h"
-#include "SkString.h"
-#include "SkDisplacementMapEffect.h"
-#include "SkDropShadowImageFilter.h"
-#include "SkMatrixConvolutionImageFilter.h"
-#include "Sk1DPathEffect.h"
-#include "SkFontStyle.h"
-
-#include "sk_path.h"
-#include "sk_paint.h"
-#include "sk_shader.h"
-#include "sk_maskfilter.h"
-
-#include "sk_types.h"
-#include "xamarin/sk_x_types.h"
-
-#include "../sk_types_priv.h"
-
-#define MAKE_FROM_TO_NAME(FROM) g_ ## FROM ## _map
-
-static inline SkRect* AsRect(sk_rect_t* crect) {
- return reinterpret_cast<SkRect*>(crect);
-}
-
-static inline const SkRect* AsRect(const sk_rect_t* crect) {
- return reinterpret_cast<const SkRect*>(crect);
-}
-
-static inline const SkRect& AsRect(const sk_rect_t& crect) {
- return reinterpret_cast<const SkRect&>(crect);
-}
-
-static inline sk_rect_t ToRect(const SkRect& rect) {
- return reinterpret_cast<const sk_rect_t&>(rect);
-}
-
-static inline SkIRect* AsIRect(sk_irect_t* crect) {
- return reinterpret_cast<SkIRect*>(crect);
-}
-
-static inline const SkIRect* AsIRect(const sk_irect_t* crect) {
- return reinterpret_cast<const SkIRect*>(crect);
-}
-
-static inline const SkIRect& AsIRect(const sk_irect_t& crect) {
- return reinterpret_cast<const SkIRect&>(crect);
-}
-
-static inline const SkBitmap* AsBitmap(const sk_bitmap_t* cbitmap) {
- return reinterpret_cast<const SkBitmap*>(cbitmap);
-}
-
-static inline const SkBitmap& AsBitmap(const sk_bitmap_t& cbitmap) {
- return reinterpret_cast<const SkBitmap&>(cbitmap);
-}
-
-static inline SkBitmap* AsBitmap(sk_bitmap_t* cbitmap) {
- return reinterpret_cast<SkBitmap*>(cbitmap);
-}
-
-static inline SkData* AsData(const sk_data_t* cdata) {
- return reinterpret_cast<SkData*>(const_cast<sk_data_t*>(cdata));
-}
-
-static inline sk_data_t* ToData(SkData* data) {
- return reinterpret_cast<sk_data_t*>(data);
-}
-
-static inline sk_path_t* ToPath(SkPath* cpath) {
- return reinterpret_cast<sk_path_t*>(cpath);
-}
-
-static inline const SkPath& AsPath(const sk_path_t& cpath) {
- return reinterpret_cast<const SkPath&>(cpath);
-}
-
-static inline SkPath* AsPath(sk_path_t* cpath) {
- return reinterpret_cast<SkPath*>(cpath);
-}
-
-static inline const SkImage* AsImage(const sk_image_t* cimage) {
- return reinterpret_cast<const SkImage*>(cimage);
-}
-
-static inline sk_image_t* ToImage(SkImage* cimage) {
- return reinterpret_cast<sk_image_t*>(cimage);
-}
-
-static inline sk_canvas_t* ToCanvas(SkCanvas* canvas) {
- return reinterpret_cast<sk_canvas_t*>(canvas);
-}
-
-static inline SkCanvas* AsCanvas(sk_canvas_t* ccanvas) {
- return reinterpret_cast<SkCanvas*>(ccanvas);
-}
-
-static inline SkPictureRecorder* AsPictureRecorder(sk_picture_recorder_t* crec) {
- return reinterpret_cast<SkPictureRecorder*>(crec);
-}
-
-static inline sk_picture_recorder_t* ToPictureRecorder(SkPictureRecorder* rec) {
- return reinterpret_cast<sk_picture_recorder_t*>(rec);
-}
-
-static inline const SkPicture* AsPicture(const sk_picture_t* cpic) {
- return reinterpret_cast<const SkPicture*>(cpic);
-}
-
-static inline SkPicture* AsPicture(sk_picture_t* cpic) {
- return reinterpret_cast<SkPicture*>(cpic);
-}
-
-static inline sk_picture_t* ToPicture(SkPicture* pic) {
- return reinterpret_cast<sk_picture_t*>(pic);
-}
-
-static inline SkImageFilter* AsImageFilter(sk_imagefilter_t* cfilter) {
- return reinterpret_cast<SkImageFilter*>(cfilter);
-}
-
-static inline SkImageFilter** AsImageFilters(sk_imagefilter_t** cfilter) {
- return reinterpret_cast<SkImageFilter**>(cfilter);
-}
-
-static inline sk_imagefilter_t* ToImageFilter(SkImageFilter* filter) {
- return reinterpret_cast<sk_imagefilter_t*>(filter);
-}
-
-static inline SkColorFilter* AsColorFilter(sk_colorfilter_t* cfilter) {
- return reinterpret_cast<SkColorFilter*>(cfilter);
-}
-
-static inline sk_colorfilter_t* ToColorFilter(SkColorFilter* filter) {
- return reinterpret_cast<sk_colorfilter_t*>(filter);
-}
-
-static inline const SkCodec* AsCodec(const sk_codec_t* codec) {
- return reinterpret_cast<const SkCodec*>(codec);
-}
-
-static inline const SkCodec& AsCodec(const sk_codec_t& codec) {
- return reinterpret_cast<const SkCodec&>(codec);
-}
-
-static inline SkCodec* AsCodec(sk_codec_t* codec) {
- return reinterpret_cast<SkCodec*>(codec);
-}
-
-static inline sk_codec_t* ToCodec(SkCodec* codec) {
- return reinterpret_cast<sk_codec_t*>(codec);
-}
-
-static inline SkTypeface* AsTypeface(sk_typeface_t* typeface) {
- return reinterpret_cast<SkTypeface*>(typeface);
-}
-
-static inline sk_typeface_t* ToTypeface(SkTypeface* typeface) {
- return reinterpret_cast<sk_typeface_t*>(typeface);
-}
-
-static inline sk_colorspace_t* ToColorSpace(SkColorSpace* colorspace) {
- return reinterpret_cast<sk_colorspace_t*>(colorspace);
-}
-
-static inline void from_c(const sk_matrix_t* cmatrix, SkMatrix* matrix) {
- matrix->setAll(
- cmatrix->mat[0], cmatrix->mat[1], cmatrix->mat[2],
- cmatrix->mat[3], cmatrix->mat[4], cmatrix->mat[5],
- cmatrix->mat[6], cmatrix->mat[7], cmatrix->mat[8]);
-}
-
-static inline void from_sk(const SkMatrix* matrix, sk_matrix_t* cmatrix) {
- matrix->get9(cmatrix->mat);
-}
-
-static inline sk_shader_t* ToShader(SkShader* shader) {
- return reinterpret_cast<sk_shader_t*>(shader);
-}
-
-static inline const SkFILEStream* AsFileStream(const sk_stream_filestream_t* cfilestream) {
- return reinterpret_cast<const SkFILEStream*>(cfilestream);
-}
-
-static inline SkFILEStream* AsFileStream(sk_stream_filestream_t* cfilestream) {
- return reinterpret_cast<SkFILEStream*>(cfilestream);
-}
-
-static inline sk_stream_filestream_t* ToFileStream(SkFILEStream* stream) {
- return reinterpret_cast<sk_stream_filestream_t*>(stream);
-}
-
-static inline const SkMemoryStream* AsMemoryStream(const sk_stream_memorystream_t* cmemorystream) {
- return reinterpret_cast<const SkMemoryStream*>(cmemorystream);
-}
-
-static inline SkMemoryStream* AsMemoryStream(sk_stream_memorystream_t* cmemorystream) {
- return reinterpret_cast<SkMemoryStream*>(cmemorystream);
-}
-
-static inline sk_stream_memorystream_t* ToMemoryStream(SkMemoryStream* stream) {
- return reinterpret_cast<sk_stream_memorystream_t*>(stream);
-}
-
-static inline SkStreamRewindable* AsStreamRewindable(sk_stream_streamrewindable_t* cstreamrewindable) {
- return reinterpret_cast<SkStreamRewindable*>(cstreamrewindable);
-}
-
-static inline const SkStream* AsStream(const sk_stream_t* cstream) {
- return reinterpret_cast<const SkStream*>(cstream);
-}
-
-static inline SkStream* AsStream(sk_stream_t* cstream) {
- return reinterpret_cast<SkStream*>(cstream);
-}
-
-static inline sk_stream_t* ToStream(SkStream* cstream) {
- return reinterpret_cast<sk_stream_t*>(cstream);
-}
-
-static inline sk_stream_asset_t* ToStreamAsset(SkStreamAsset* cstream) {
- return reinterpret_cast<sk_stream_asset_t*>(cstream);
-}
-
-static inline SkStreamAsset* AsStreamAsset(sk_stream_asset_t* cstream) {
- return reinterpret_cast<SkStreamAsset*>(cstream);
-}
-
-static inline SkFILEWStream* AsFileWStream(sk_wstream_filestream_t* cfilestream) {
- return reinterpret_cast<SkFILEWStream*>(cfilestream);
-}
-
-static inline SkDynamicMemoryWStream* AsDynamicMemoryWStream(sk_wstream_dynamicmemorystream_t* cmemorystream) {
- return reinterpret_cast<SkDynamicMemoryWStream*>(cmemorystream);
-}
-
-static inline SkWStream* AsWStream(sk_wstream_t* cstream) {
- return reinterpret_cast<SkWStream*>(cstream);
-}
-
-static inline sk_wstream_filestream_t* ToFileWStream(SkFILEWStream* filestream) {
- return reinterpret_cast<sk_wstream_filestream_t*>(filestream);
-}
-
-static inline sk_wstream_dynamicmemorystream_t* ToDynamicMemoryWStream(SkDynamicMemoryWStream* memorystream) {
- return reinterpret_cast<sk_wstream_dynamicmemorystream_t*>(memorystream);
-}
-
-static inline sk_wstream_t* ToWStream(SkWStream* stream) {
- return reinterpret_cast<sk_wstream_t*>(stream);
-}
-
-static inline const SkPoint& AsPoint(const sk_point_t& p) {
- return reinterpret_cast<const SkPoint&>(p);
-}
-
-static inline const SkPoint* AsPoint(const sk_point_t* p) {
- return reinterpret_cast<const SkPoint*>(p);
-}
-
-static inline SkPoint* AsPoint(sk_point_t* p) {
- return reinterpret_cast<SkPoint*>(p);
-}
-
-static inline sk_point_t* ToPoint(SkPoint *p) {
- return reinterpret_cast<sk_point_t*>(p);
-}
-
-static inline const SkIPoint& AsIPoint(const sk_ipoint_t& p) {
- return reinterpret_cast<const SkIPoint&>(p);
-}
-
-static inline const SkIPoint* AsIPoint(const sk_ipoint_t* p) {
- return reinterpret_cast<const SkIPoint*>(p);
-}
-
-static inline const SkSize& AsSize(const sk_size_t& p) {
- return reinterpret_cast<const SkSize&>(p);
-}
-
-static inline const SkSize* AsSize(const sk_size_t* p) {
- return reinterpret_cast<const SkSize*>(p);
-}
-
-static inline const SkISize& AsISize(const sk_isize_t& p) {
- return reinterpret_cast<const SkISize&>(p);
-}
-
-static inline const SkISize* AsISize(const sk_isize_t* p) {
- return reinterpret_cast<const SkISize*>(p);
-}
-
-static inline SkISize* AsISize(sk_isize_t* p) {
- return reinterpret_cast<SkISize*>(p);
-}
-
-static inline const sk_isize_t& ToISize(const SkISize& p) {
- return reinterpret_cast<const sk_isize_t&>(p);
-}
-
-static inline const sk_isize_t* ToISize(const SkISize* p) {
- return reinterpret_cast<const sk_isize_t*>(p);
-}
-
-static inline const SkPoint3& AsPoint3(const sk_point3_t& p) {
- return reinterpret_cast<const SkPoint3&>(p);
-}
-
-static inline const SkPoint3* AsPoint3(const sk_point3_t* p) {
- return reinterpret_cast<const SkPoint3*>(p);
-}
-
-static inline const SkImageFilter::CropRect& AsImageFilterCropRect(const sk_imagefilter_croprect_t& p) {
- return reinterpret_cast<const SkImageFilter::CropRect&>(p);
-}
-
-static inline const SkImageFilter::CropRect* AsImageFilterCropRect(const sk_imagefilter_croprect_t* p) {
- return reinterpret_cast<const SkImageFilter::CropRect*>(p);
-}
-
-static inline SkPaint::FontMetrics* AsFontMetrics(sk_fontmetrics_t* p) {
- return reinterpret_cast<SkPaint::FontMetrics*>(p);
-}
-
-static inline sk_fontmetrics_t* ToFontMetrics(SkPaint::FontMetrics* p) {
- return reinterpret_cast<sk_fontmetrics_t*>(p);
-}
-
-static inline SkString* AsString(const sk_string_t* cdata) {
- return reinterpret_cast<SkString*>(const_cast<sk_string_t*>(cdata));
-}
-
-static inline sk_string_t* ToString(SkString* data) {
- return reinterpret_cast<sk_string_t*>(data);
-}
-
-static inline SkDocument* AsDocument(sk_document_t* cdocument) {
- return reinterpret_cast<SkDocument*>(cdocument);
-}
-
-static inline sk_document_t* ToDocument(SkDocument* document) {
- return reinterpret_cast<sk_document_t*>(document);
-}
-
-static inline SkImageInfo* AsImageInfo(sk_imageinfo_t* cinfo) {
- return reinterpret_cast<SkImageInfo*>(cinfo);
-}
-static inline SkPath::Iter* AsPathIter(sk_path_iterator_t* iter) {
- return reinterpret_cast<SkPath::Iter*>(iter);
-}
-
-static inline const SkImageInfo* AsImageInfo(const sk_imageinfo_t* cinfo) {
- return reinterpret_cast<const SkImageInfo*>(cinfo);
-}
-
-static inline sk_imageinfo_t* ToImageInfo(SkImageInfo* info) {
- return reinterpret_cast<sk_imageinfo_t*>(info);
-}
-
-static inline sk_imageinfo_t& ToImageInfo(SkImageInfo& info) {
- return reinterpret_cast<sk_imageinfo_t&>(info);
-}
-
-static inline const sk_imageinfo_t* ToImageInfo(const SkImageInfo* info) {
- return reinterpret_cast<const sk_imageinfo_t*>(info);
-}
-
-static inline const sk_imageinfo_t& ToImageInfo(const SkImageInfo& info) {
- return reinterpret_cast<const sk_imageinfo_t&>(info);
-}
-
-static inline bool find_sk(const sk_codec_options_t& coptions, SkCodec::Options* options) {
- if (options) {
- *options = SkCodec::Options();
- options->fZeroInitialized = (SkCodec::ZeroInitialized)coptions.fZeroInitialized;
- if (coptions.fHasSubset) {
- options->fSubset = AsIRect((sk_irect_t*)&coptions.fSubset);
- }
- }
- return true;
-}
-
-
-static inline sk_path_iterator_t* ToPathIter(SkPath::Iter* iter) {
- return reinterpret_cast<sk_path_iterator_t*>(iter);
-}
-
-static inline SkPath::RawIter* AsPathRawIter(sk_path_rawiterator_t* iter) {
- return reinterpret_cast<SkPath::RawIter*>(iter);
-}
-
-static inline sk_path_rawiterator_t* ToPathRawIter(SkPath::RawIter* iter) {
- return reinterpret_cast<sk_path_rawiterator_t*>(iter);
-}
-
-static inline const SkPathEffect* AsPathEffect(const sk_path_effect_t* p) {
- return reinterpret_cast<const SkPathEffect*>(p);
-}
-
-static inline SkPathEffect* AsPathEffect(sk_path_effect_t* p) {
- return reinterpret_cast<SkPathEffect*>(p);
-}
-
-static inline sk_path_effect_t* ToPathEffect(SkPathEffect* p) {
- return reinterpret_cast<sk_path_effect_t*>(p);
-}
-
-static inline const sk_path_effect_t* ToPathEffect(const SkPathEffect* p) {
- return reinterpret_cast<const sk_path_effect_t*>(p);
-}
-
-#endif