Merged the C code for upstreaming
authorMatthew Leibowitz <mattleibow@live.com>
Wed, 20 Jul 2016 12:25:54 +0000 (14:25 +0200)
committerMatthew Leibowitz <mattleibow@live.com>
Wed, 20 Jul 2016 12:25:54 +0000 (14:25 +0200)
55 files changed:
gyp/core.gypi
include/c/sk_bitmap.h [moved from include/c/xamarin/sk_x_bitmap.h with 95% similarity]
include/c/sk_canvas.h
include/c/sk_codec.h [moved from include/c/xamarin/sk_x_codec.h with 94% similarity]
include/c/sk_colorfilter.h [moved from include/c/xamarin/sk_x_colorfilter.h with 92% similarity]
include/c/sk_data.h
include/c/sk_document.h [moved from include/c/xamarin/sk_x_document.h with 92% similarity]
include/c/sk_image.h
include/c/sk_imagefilter.h [moved from include/c/xamarin/sk_x_imagefilter.h with 98% similarity]
include/c/sk_maskfilter.h
include/c/sk_paint.h
include/c/sk_path.h
include/c/sk_patheffect.h [moved from include/c/xamarin/sk_x_patheffect.h with 92% similarity]
include/c/sk_shader.h
include/c/sk_stream.h [moved from include/c/xamarin/sk_x_stream.h with 97% similarity]
include/c/sk_string.h [moved from include/c/xamarin/sk_x_string.h with 92% similarity]
include/c/sk_surface.h
include/c/sk_typeface.h [moved from include/c/xamarin/sk_x_typeface.h with 94% similarity]
include/c/sk_types.h
include/c/xamarin/sk_x_canvas.h [deleted file]
include/c/xamarin/sk_x_data.h [deleted file]
include/c/xamarin/sk_x_image.h [deleted file]
include/c/xamarin/sk_x_maskfilter.h [deleted file]
include/c/xamarin/sk_x_matrix.h [deleted file]
include/c/xamarin/sk_x_paint.h [deleted file]
include/c/xamarin/sk_x_path.h [deleted file]
include/c/xamarin/sk_x_shader.h [deleted file]
include/c/xamarin/sk_x_types.h [deleted file]
src/c/sk_bitmap.cpp [moved from src/c/xamarin/sk_x_bitmap.cpp with 98% similarity]
src/c/sk_c_from_to.h [deleted file]
src/c/sk_canvas.cpp [moved from src/c/xamarin/sk_x_canvas.cpp with 55% similarity]
src/c/sk_codec.cpp [moved from src/c/xamarin/sk_x_codec.cpp with 95% similarity]
src/c/sk_colorfilter.cpp [moved from src/c/xamarin/sk_x_colorfilter.cpp with 95% similarity]
src/c/sk_data.cpp [new file with mode: 0644]
src/c/sk_document.cpp [moved from src/c/xamarin/sk_x_document.cpp with 93% similarity]
src/c/sk_enums.cpp [moved from src/c/xamarin/sk_x_enums.cpp with 95% similarity]
src/c/sk_image.cpp [new file with mode: 0644]
src/c/sk_imagefilter.cpp [moved from src/c/xamarin/sk_x_imagefilter.cpp with 99% similarity]
src/c/sk_maskfilter.cpp [moved from src/c/xamarin/sk_x_maskfilter.cpp with 67% similarity]
src/c/sk_matrix.cpp [moved from src/c/xamarin/sk_x_matrix.cpp with 96% similarity]
src/c/sk_paint.cpp
src/c/sk_path.cpp [moved from src/c/xamarin/sk_x_path.cpp with 74% similarity]
src/c/sk_patheffect.cpp [moved from src/c/xamarin/sk_x_patheffect.cpp with 95% similarity]
src/c/sk_picture.cpp [new file with mode: 0644]
src/c/sk_shader.cpp [new file with mode: 0644]
src/c/sk_stream.cpp [moved from src/c/xamarin/sk_x_stream.cpp with 98% similarity]
src/c/sk_string.cpp [moved from src/c/xamarin/sk_x_string.cpp with 87% similarity]
src/c/sk_surface.cpp
src/c/sk_typeface.cpp [moved from src/c/xamarin/sk_x_typeface.cpp with 96% similarity]
src/c/sk_types_priv.h
src/c/xamarin/sk_x_data.cpp [deleted file]
src/c/xamarin/sk_x_image.cpp [deleted file]
src/c/xamarin/sk_x_paint.cpp [deleted file]
src/c/xamarin/sk_x_shader.cpp [deleted file]
src/c/xamarin/sk_x_types_priv.h [deleted file]

index be6fc49..0beaa1b 100644 (file)
 #
 {
     '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',
similarity index 95%
rename from include/c/xamarin/sk_x_bitmap.h
rename to include/c/sk_bitmap.h
index 318803f..48d27a7 100644 (file)
@@ -8,11 +8,10 @@
 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
 // DO NOT USE -- FOR INTERNAL TESTING ONLY
 
-#ifndef sk_x_bitmap_DEFINED
-#define sk_x_bitmap_DEFINED
+#ifndef sk_bitmap_DEFINED
+#define sk_bitmap_DEFINED
 
 #include "sk_types.h"
-#include "xamarin/sk_x_types.h"
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
index 2f8830b..d101aa5 100644 (file)
@@ -154,6 +154,121 @@ SK_API void sk_canvas_draw_image_rect(sk_canvas_t*, const sk_image_t*,
 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
similarity index 94%
rename from include/c/xamarin/sk_x_codec.h
rename to include/c/sk_codec.h
index 071235f..6ff1501 100644 (file)
@@ -8,11 +8,10 @@
 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
 // DO NOT USE -- FOR INTERNAL TESTING ONLY
 
-#ifndef sk_x_codec_DEFINED
-#define sk_x_codec_DEFINED
+#ifndef sk_codec_DEFINED
+#define sk_codec_DEFINED
 
 #include "sk_types.h"
-#include "xamarin/sk_x_types.h"
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
similarity index 92%
rename from include/c/xamarin/sk_x_colorfilter.h
rename to include/c/sk_colorfilter.h
index 90b15ca..3fd9397 100644 (file)
@@ -8,11 +8,10 @@
 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
 // DO NOT USE -- FOR INTERNAL TESTING ONLY
 
-#ifndef sk_x_colorfilter_DEFINED
-#define sk_x_colorfilter_DEFINED
+#ifndef sk_colorfilter_DEFINED
+#define sk_colorfilter_DEFINED
 
 #include "sk_types.h"
-#include "xamarin/sk_x_types.h"
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
index 90333bb..0de2a94 100644 (file)
@@ -65,6 +65,10 @@ SK_API size_t sk_data_get_size(const sk_data_t*);
  */
 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
similarity index 92%
rename from include/c/xamarin/sk_x_document.h
rename to include/c/sk_document.h
index 28bf546..4e652aa 100644 (file)
@@ -8,11 +8,10 @@
 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
 // DO NOT USE -- FOR INTERNAL TESTING ONLY
 
-#ifndef sk_x_document_DEFINED
-#define sk_x_document_DEFINED
+#ifndef sk_document_DEFINED
+#define sk_document_DEFINED
 
 #include "sk_types.h"
-#include "xamarin/sk_x_types.h"
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
index e90649d..f5c8ef9 100644 (file)
@@ -66,6 +66,18 @@ SK_API int sk_image_get_height(const sk_image_t*);
  */
 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
similarity index 98%
rename from include/c/xamarin/sk_x_imagefilter.h
rename to include/c/sk_imagefilter.h
index fe2e188..cba5427 100644 (file)
@@ -8,11 +8,10 @@
 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
 // DO NOT USE -- FOR INTERNAL TESTING ONLY
 
-#ifndef sk_x_imagefilter_DEFINED
-#define sk_x_imagefilter_DEFINED
+#ifndef sk_imagefilter_DEFINED
+#define sk_imagefilter_DEFINED
 
 #include "sk_types.h"
-#include "xamarin/sk_x_types.h"
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
index ad72b52..39f13a2 100644 (file)
 
 #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
 
 /**
@@ -42,6 +35,19 @@ SK_API void sk_maskfilter_unref(sk_maskfilter_t*);
 */
 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
index e0886ad..6b31119 100644 (file)
@@ -89,12 +89,6 @@ SK_API float sk_paint_get_stroke_miter(const sk_paint_t*);
 */
 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.
@@ -106,12 +100,6 @@ SK_API sk_stroke_cap_t sk_paint_get_stroke_cap(const sk_paint_t*);
 */
 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
@@ -140,6 +128,114 @@ SK_API void sk_paint_set_maskfilter(sk_paint_t*, sk_maskfilter_t*);
  */
 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
index 6b4e83d..9922f68 100644 (file)
 
 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. */
@@ -79,6 +74,119 @@ SK_API void sk_path_add_oval(sk_path_t*, const sk_rect_t*, sk_path_direction_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
similarity index 92%
rename from include/c/xamarin/sk_x_patheffect.h
rename to include/c/sk_patheffect.h
index 12c75d7..47057be 100644 (file)
@@ -8,11 +8,10 @@
 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
 // DO NOT USE -- FOR INTERNAL TESTING ONLY
 
-#ifndef sk_x_patheffect_DEFINED
-#define sk_x_patheffect_DEFINED
+#ifndef sk_patheffect_DEFINED
+#define sk_patheffect_DEFINED
 
 #include "sk_types.h"
-#include "xamarin/sk_x_types.h"
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
index 41403d5..e7d41f2 100644 (file)
@@ -18,12 +18,6 @@ SK_C_PLUS_PLUS_BEGIN_GUARD
 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.
@@ -138,6 +132,65 @@ SK_API sk_shader_t* sk_shader_new_two_point_conical_gradient(
         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
similarity index 97%
rename from include/c/xamarin/sk_x_stream.h
rename to include/c/sk_stream.h
index 93600f6..f23ecff 100644 (file)
@@ -8,11 +8,10 @@
 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
 // DO NOT USE -- FOR INTERNAL TESTING ONLY
 
-#ifndef sk_x_stream_DEFINED
-#define sk_x_stream_DEFINED
+#ifndef sk_stream_DEFINED
+#define sk_stream_DEFINED
 
 #include "sk_types.h"
-#include "xamarin/sk_x_types.h"
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
similarity index 92%
rename from include/c/xamarin/sk_x_string.h
rename to include/c/sk_string.h
index 8011813..bb15fab 100644 (file)
@@ -8,11 +8,10 @@
 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
 // DO NOT USE -- FOR INTERNAL TESTING ONLY
 
-#ifndef sk_x_string_DEFINED
-#define sk_x_string_DEFINED
+#ifndef sk_string_DEFINED
+#define sk_string_DEFINED
 
 #include "sk_types.h"
-#include "xamarin/sk_x_types.h"
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
index d634185..3d6034a 100644 (file)
 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
     request is not a supported configuration, NULL will be returned.
similarity index 94%
rename from include/c/xamarin/sk_x_typeface.h
rename to include/c/sk_typeface.h
index 0d41b9f..5d0b60c 100644 (file)
@@ -8,11 +8,10 @@
 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
 // DO NOT USE -- FOR INTERNAL TESTING ONLY
 
-#ifndef sk_x_typeface_DEFINED
-#define sk_x_typeface_DEFINED
+#ifndef sk_typeface_DEFINED
+#define sk_typeface_DEFINED
 
 #include "sk_types.h"
-#include "xamarin/sk_x_types.h"
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
index d2813cb..69c5e18 100644 (file)
@@ -72,11 +72,6 @@ typedef enum {
     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 {
@@ -209,6 +204,302 @@ typedef enum {
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
+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
diff --git a/include/c/xamarin/sk_x_canvas.h b/include/c/xamarin/sk_x_canvas.h
deleted file mode 100644 (file)
index 1ba80e7..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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
diff --git a/include/c/xamarin/sk_x_data.h b/include/c/xamarin/sk_x_data.h
deleted file mode 100644 (file)
index 21e9589..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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
diff --git a/include/c/xamarin/sk_x_image.h b/include/c/xamarin/sk_x_image.h
deleted file mode 100644 (file)
index 29c3064..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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
diff --git a/include/c/xamarin/sk_x_maskfilter.h b/include/c/xamarin/sk_x_maskfilter.h
deleted file mode 100644 (file)
index c995949..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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
diff --git a/include/c/xamarin/sk_x_matrix.h b/include/c/xamarin/sk_x_matrix.h
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/include/c/xamarin/sk_x_paint.h b/include/c/xamarin/sk_x_paint.h
deleted file mode 100644 (file)
index b3663ec..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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
diff --git a/include/c/xamarin/sk_x_path.h b/include/c/xamarin/sk_x_path.h
deleted file mode 100644 (file)
index 16cd3a7..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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
diff --git a/include/c/xamarin/sk_x_shader.h b/include/c/xamarin/sk_x_shader.h
deleted file mode 100644 (file)
index 405644b..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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
diff --git a/include/c/xamarin/sk_x_types.h b/include/c/xamarin/sk_x_types.h
deleted file mode 100644 (file)
index c7ef863..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * 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
similarity index 98%
rename from src/c/xamarin/sk_x_bitmap.cpp
rename to src/c/sk_bitmap.cpp
index 99e67b4..1ebdb8c 100644 (file)
 #include "SkImageInfo.h"
 #include "SkUnPreMultiply.h"
 
-#include "xamarin/sk_x_bitmap.h"
+#include "sk_bitmap.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 static inline void copyAlpha8ToColor(size_t size, const uint8_t* pixels, sk_color_t* colors)
 {
diff --git a/src/c/sk_c_from_to.h b/src/c/sk_c_from_to.h
deleted file mode 100644 (file)
index 19fda37..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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
similarity index 55%
rename from src/c/xamarin/sk_x_canvas.cpp
rename to src/c/sk_canvas.cpp
index f7569c2..fc8d442 100644 (file)
@@ -7,10 +7,9 @@
 
 #include "SkCanvas.h"
 
-#include "xamarin/sk_x_canvas.h"
+#include "sk_canvas.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 void sk_canvas_clear(sk_canvas_t* ccanvas, sk_color_t color) {
     AsCanvas(ccanvas)->clear(color);
@@ -128,3 +127,101 @@ 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));
+}
similarity index 95%
rename from src/c/xamarin/sk_x_codec.cpp
rename to src/c/sk_codec.cpp
index b6ebea7..487b079 100644 (file)
@@ -7,10 +7,9 @@
 
 #include "SkCodec.h"
 
-#include "xamarin/sk_x_codec.h"
+#include "sk_codec.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 size_t sk_codec_min_buffered_bytes_needed()
 {
similarity index 95%
rename from src/c/xamarin/sk_x_colorfilter.cpp
rename to src/c/sk_colorfilter.cpp
index 6f73340..c185dd2 100644 (file)
 #include "SkLumaColorFilter.h"
 #include "SkTableColorFilter.h"
 
-#include "xamarin/sk_x_colorfilter.h"
+#include "sk_colorfilter.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 void sk_colorfilter_unref(sk_colorfilter_t* filter) {
     SkSafeUnref(AsColorFilter(filter));
diff --git a/src/c/sk_data.cpp b/src/c/sk_data.cpp
new file mode 100644 (file)
index 0000000..551f618
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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();
+}
similarity index 93%
rename from src/c/xamarin/sk_x_document.cpp
rename to src/c/sk_document.cpp
index fc69f91..3d51567 100644 (file)
@@ -7,10 +7,9 @@
 
 #include "SkDocument.h"
 
-#include "xamarin/sk_x_document.h"
+#include "sk_document.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 void sk_document_unref(sk_document_t* document) {
     AsDocument(document)->unref();
similarity index 95%
rename from src/c/xamarin/sk_x_enums.cpp
rename to src/c/sk_enums.cpp
index 28d6a8c..6106bda 100644 (file)
@@ -8,7 +8,7 @@
 #include "SkTypeface.h"
 #include "SkFontStyle.h"
 
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 #if __cplusplus >= 199711L
 
@@ -33,17 +33,17 @@ static_assert ((int)SkFontStyle::Slant::kItalic_Slant    == (int)ITALIC_SK_FONT_
 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));
+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_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));
+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));
diff --git a/src/c/sk_image.cpp b/src/c/sk_image.cpp
new file mode 100644 (file)
index 0000000..8eb4f22
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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();
+}
similarity index 99%
rename from src/c/xamarin/sk_x_imagefilter.cpp
rename to src/c/sk_imagefilter.cpp
index 0e94676..7948dd0 100644 (file)
 #include "SkTileImageFilter.h"
 #include "SkXfermodeImageFilter.h"
 
-#include "xamarin/sk_x_imagefilter.h"
+#include "sk_imagefilter.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 sk_imagefilter_croprect_t* sk_imagefilter_croprect_new() {
     return (sk_imagefilter_croprect_t*) new SkImageFilter::CropRect();
similarity index 67%
rename from src/c/xamarin/sk_x_maskfilter.cpp
rename to src/c/sk_maskfilter.cpp
index 0d322a6..f177268 100644 (file)
@@ -8,10 +8,9 @@
 #include "SkBlurMaskFilter.h"
 #include "SkTableMaskFilter.h"
 
-#include "xamarin/sk_x_maskfilter.h"
+#include "sk_maskfilter.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 sk_maskfilter_t* sk_maskfilter_new_emboss(
     float blurSigma, 
@@ -32,3 +31,15 @@ sk_maskfilter_t* sk_maskfilter_new_gamma(float 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());
+}
similarity index 96%
rename from src/c/xamarin/sk_x_matrix.cpp
rename to src/c/sk_matrix.cpp
index 85c05f5..a039dbd 100644 (file)
@@ -7,10 +7,9 @@
 
 #include "SkStream.h"
 
-#include "xamarin/sk_x_matrix.h"
+#include "sk_matrix.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 int sk_matrix_try_invert (sk_matrix_t *matrix, sk_matrix_t *result)
 {
index 6272d0f..306c243 100644 (file)
@@ -5,13 +5,15 @@
  * 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"
 
 //////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -87,3 +89,150 @@ void sk_paint_set_xfermode_mode(sk_paint_t* paint, sk_xfermode_mode_t mode) {
     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)));
+}
similarity index 74%
rename from src/c/xamarin/sk_x_path.cpp
rename to src/c/sk_path.cpp
index 2e56d4b..6d42dcb 100644 (file)
@@ -7,10 +7,9 @@
 
 #include "SkPath.h"
 
-#include "xamarin/sk_x_path.h"
+#include "sk_path.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 void sk_path_rmove_to(sk_path_t* cpath, float dx, float dy) {
     AsPath(cpath)->rMoveTo(dx, dy);
@@ -156,3 +155,55 @@ 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;
+}
similarity index 95%
rename from src/c/xamarin/sk_x_patheffect.cpp
rename to src/c/sk_patheffect.cpp
index 4c102d3..cef86c1 100644 (file)
 #include "SkDashPathEffect.h"
 #include "SkPath.h"
 
-#include "xamarin/sk_x_patheffect.h"
+#include "sk_patheffect.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 void sk_path_effect_unref(sk_path_effect_t* effect)
 {
diff --git a/src/c/sk_picture.cpp b/src/c/sk_picture.cpp
new file mode 100644 (file)
index 0000000..c0db922
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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());
+}
diff --git a/src/c/sk_shader.cpp b/src/c/sk_shader.cpp
new file mode 100644 (file)
index 0000000..812f8bb
--- /dev/null
@@ -0,0 +1,226 @@
+/*
+ * 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();
+}
similarity index 98%
rename from src/c/xamarin/sk_x_stream.cpp
rename to src/c/sk_stream.cpp
index cdba312..9192c68 100644 (file)
@@ -7,10 +7,9 @@
 
 #include "SkStream.h"
 
-#include "xamarin/sk_x_stream.h"
+#include "sk_stream.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 void sk_stream_asset_destroy(sk_stream_asset_t* cstream)
 {
similarity index 87%
rename from src/c/xamarin/sk_x_string.cpp
rename to src/c/sk_string.cpp
index 5caa911..a87da1e 100644 (file)
@@ -7,10 +7,9 @@
 
 #include "SkString.h"
 
-#include "xamarin/sk_x_string.h"
+#include "sk_string.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 sk_string_t* sk_string_new_empty() {
     return ToString(new SkString());
index 0c13ca4..0ced6ac 100644 (file)
 #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);
@@ -253,184 +57,3 @@ sk_image_t* sk_surface_new_image_snapshot(sk_surface_t* csurf) {
     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();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////
similarity index 96%
rename from src/c/xamarin/sk_x_typeface.cpp
rename to src/c/sk_typeface.cpp
index c144585..88242c1 100644 (file)
@@ -7,10 +7,9 @@
 
 #include "SkTypeface.h"
 
-#include "xamarin/sk_x_typeface.h"
+#include "sk_typeface.h"
 
-#include "../sk_types_priv.h"
-#include "sk_x_types_priv.h"
+#include "sk_types_priv.h"
 
 void sk_typeface_unref(sk_typeface_t* tf)
 {
index 92089d7..c159424 100644 (file)
@@ -8,6 +8,28 @@
 #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;
@@ -38,4 +60,394 @@ static inline SkShader* AsShader(sk_shader_t* cshader) {
     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
diff --git a/src/c/xamarin/sk_x_data.cpp b/src/c/xamarin/sk_x_data.cpp
deleted file mode 100644 (file)
index d8c7200..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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();
-}
diff --git a/src/c/xamarin/sk_x_image.cpp b/src/c/xamarin/sk_x_image.cpp
deleted file mode 100644 (file)
index c5859bc..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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());
-}
diff --git a/src/c/xamarin/sk_x_paint.cpp b/src/c/xamarin/sk_x_paint.cpp
deleted file mode 100644 (file)
index 10a8f3f..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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)));
-}
diff --git a/src/c/xamarin/sk_x_shader.cpp b/src/c/xamarin/sk_x_shader.cpp
deleted file mode 100644 (file)
index 46001fd..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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());
-}
diff --git a/src/c/xamarin/sk_x_types_priv.h b/src/c/xamarin/sk_x_types_priv.h
deleted file mode 100644 (file)
index c749ec3..0000000
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
- * 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