C API: Add SK_API, also documentation of an example.

SK_API = __declspec(dllexport) / __attribute__((visibility("default")))

Also, add documentation in experimental/c-api-example/c.md

Review URL: https://codereview.chromium.org/1307183006
diff --git a/experimental/c-api-example/c.md b/experimental/c-api-example/c.md
new file mode 100644
index 0000000..1647a6f
--- /dev/null
+++ b/experimental/c-api-example/c.md
@@ -0,0 +1,174 @@
+Skia's Stable C API
+===================
+
+<div style="text-align:center">
+<strong>EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL<br>
+DO NOT USE &mdash; FOR INTERNAL TESTING ONLY</strong>
+</div>
+
+Several issues hinder the development of a stable ABI (application
+binary interface) for Skia:
+
+1.  Skia's C++ API changes a lot from version to version.  Skia's two
+    largest clients, Android and Chrome, are kept up to date by the
+    Skia team, but that can not happen for every client.
+2.  Skia's headers will only match the compiled skia libraries if
+    configured identically.
+
+To mitigate these two issues, Skia is experimenting with the
+introduction of a C API.  This will change more slowly than the C++
+interface and, once API version 1.0.0 is announced,
+backwards-incompatable changes will be avoided whenever possible.
+
+Here is an example program that uses the C api.  To try it out, get the file
+[`skia-c-example.c`](./skia-c-example.c).
+
+<!--?prettify lang=c?-->
+
+    #include <stdio.h>
+
+    #include "sk_data.h"
+    #include "sk_image.h"
+    #include "sk_canvas.h"
+    #include "sk_surface.h"
+    #include "sk_paint.h"
+    #include "sk_path.h"
+
+    static sk_surface_t* make_surface(int32_t w, int32_t h) {
+        sk_imageinfo_t info;
+        info.width = w;
+        info.height = h;
+        info.colorType = sk_colortype_get_default_8888();
+        info.alphaType = PREMUL_SK_ALPHATYPE;
+        return sk_surface_new_raster(&info, NULL);
+    }
+
+    static void emit_png(const char* path, sk_surface_t* surface) {
+        sk_image_t* image = sk_surface_new_image_snapshot(surface);
+        sk_data_t* data = sk_image_encode(image);
+        sk_image_unref(image);
+        FILE* f = fopen(path, "wb");
+        fwrite(sk_data_get_data(data), sk_data_get_size(data), 1, f);
+        fclose(f);
+        sk_data_unref(data);
+    }
+
+    void draw(sk_canvas_t* canvas) {
+        sk_paint_t* fill = sk_paint_new();
+        sk_paint_set_color(fill, sk_color_set_argb(0xFF, 0x00, 0x00, 0xFF));
+        sk_canvas_draw_paint(canvas, fill);
+
+        sk_paint_set_color(fill, sk_color_set_argb(0xFF, 0x00, 0xFF, 0xFF));
+        sk_rect_t rect;
+        rect.left = 100.0f;
+        rect.top = 100.0f;
+        rect.right = 540.0f;
+        rect.bottom = 380.0f;
+        sk_canvas_draw_rect(canvas, &rect, fill);
+
+        sk_paint_t* stroke = sk_paint_new();
+        sk_paint_set_color(stroke, sk_color_set_argb(0xFF, 0xFF, 0x00, 0x00));
+        sk_paint_set_antialias(stroke, true);
+        sk_paint_set_stroke(stroke, true);
+        sk_paint_set_stroke_width(stroke, 5.0f);
+        sk_path_t* path = sk_path_new();
+
+        sk_path_move_to(path, 50.0f, 50.0f);
+        sk_path_line_to(path, 590.0f, 50.0f);
+        sk_path_cubic_to(path, -490.0f, 50.0f, 1130.0f, 430.0f, 50.0f, 430.0f);
+        sk_path_line_to(path, 590.0f, 430.0f);
+        sk_canvas_draw_path(canvas, path, stroke);
+
+        sk_paint_set_color(fill, sk_color_set_argb(0x80, 0x00, 0xFF, 0x00));
+        sk_rect_t rect2;
+        rect2.left = 120.0f;
+        rect2.top = 120.0f;
+        rect2.right = 520.0f;
+        rect2.bottom = 360.0f;
+        sk_canvas_draw_oval(canvas, &rect2, fill);
+
+        sk_path_delete(path);
+        sk_paint_delete(stroke);
+        sk_paint_delete(fill);
+    }
+
+    int main() {
+        sk_surface_t* surface = make_surface(640, 480);
+        sk_canvas_t* canvas = sk_surface_get_canvas(surface);
+        draw(canvas);
+        emit_png("skia-c-example.png", surface);
+        sk_surface_unref(surface);
+        return 0;
+    }
+
+<a href="https://fiddle.skia.org/c/6c6c01438d9c3d80e9c22e606359432e"><img src="https://fiddle.skia.org/i/6c6c01438d9c3d8
+0e9c22e606359432e_raster.png" alt=""></a>
+
+Gyp+Linux example
+-----------------
+
+The following proof-of-concept workflow currently works on Ubuntu 14.04:
+
+1.  Aquire Skia and install dependencies (you may have already done this):
+
+    <!--?prettify lang=sh?-->
+
+        git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git'
+        export PATH="$PWD/depot_tools:$PATH"
+        git clone 'https://skia.googlesource.com/skia'
+        skia/tools/install_dependencies.sh
+        SKIA_DIR="$PWD/skia"
+
+2.  Compile Skia as a shared library:
+
+    <!--?prettify lang=sh?-->
+
+        GYP_DEFINES=skia_shared_lib=1 "$SKIA_DIR"/bin/sync-and-gyp
+        ninja -C "$SKIA_DIR/out/Release" skia_lib
+
+3.  Compile, link, and run the example program:
+
+    <!--?prettify lang=sh?-->
+
+        cd [Wherever you want the example]
+        cp "$SKIA_DIR/experimental/c-api-example/skia-c-example.c" .
+        cc -c -I "$SKIA_DIR/include/c" skia-c-example.c -o skia-c-example.o
+        cc skia-c-example.o -L "$SKIA_DIR/out/Release/lib" -lskia -o skia-c-example
+        LD_LIBRARY_PATH="$SKIA_DIR/out/Release/lib" ./skia-c-example
+        xdg-open skia-c-example.png
+
+Cmake+MacOS example
+-------------------
+
+The following proof-of-concept workflow currently works on MacOS
+
+1.  Aquire Skia and install dependencies (you may have already done this):
+
+    <!--?prettify lang=sh?-->
+
+        cd [Wherever you want skia src code]
+        git clone 'https://skia.googlesource.com/skia'
+        SKIA_DIR="$PWD/skia"
+
+2.  Compile Skia as a shared library:
+
+    <!--?prettify lang=sh?-->
+
+        cd [Wherever you want skia build files]
+        mkdir build_skia
+        cd build_skia
+        SKIA_BUILD="$PWD"
+        cmake "$SKIA_DIR/cmake" -G Ninja && ninja
+
+3.  Compile, link, and run the example program:
+
+    <!--?prettify lang=sh?-->
+
+        cd [Wherever you want the example]
+        cp "$SKIA_DIR/experimental/c-api-example/skia-c-example.c" .
+        cc -c -I "$SKIA_DIR/include/c" skia-c-example.c -o skia-c-example.o
+        c++ skia-c-example.o \
+            "$SKIA_BUILD"/libskia.* -Wl,-rpath -Wl,"$SKIA_BUILD" \
+            -o skia-c-example
+        ./skia-c-example
+        open skia-c-example.png
diff --git a/experimental/c-api-example/skia-c-example.c b/experimental/c-api-example/skia-c-example.c
new file mode 100644
index 0000000..66b17fc
--- /dev/null
+++ b/experimental/c-api-example/skia-c-example.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include <stdio.h>
+
+#include "sk_data.h"
+#include "sk_image.h"
+#include "sk_canvas.h"
+#include "sk_surface.h"
+#include "sk_paint.h"
+#include "sk_path.h"
+
+static sk_surface_t* make_surface(int32_t w, int32_t h) {
+    sk_imageinfo_t info;
+    info.width = w;
+    info.height = h;
+    info.colorType = sk_colortype_get_default_8888();
+    info.alphaType = PREMUL_SK_ALPHATYPE;
+    return sk_surface_new_raster(&info, NULL);
+}
+
+static void emit_png(const char* path, sk_surface_t* surface) {
+    sk_image_t* image = sk_surface_new_image_snapshot(surface);
+    sk_data_t* data = sk_image_encode(image);
+    sk_image_unref(image);
+    FILE* f = fopen(path, "wb");
+    fwrite(sk_data_get_data(data), sk_data_get_size(data), 1, f);
+    fclose(f);
+    sk_data_unref(data);
+}
+
+void draw(sk_canvas_t* canvas) {
+    sk_paint_t* fill = sk_paint_new();
+    sk_paint_set_color(fill, sk_color_set_argb(0xFF, 0x00, 0x00, 0xFF));
+    sk_canvas_draw_paint(canvas, fill);
+
+    sk_paint_set_color(fill, sk_color_set_argb(0xFF, 0x00, 0xFF, 0xFF));
+    sk_rect_t rect;
+    rect.left = 100.0f;
+    rect.top = 100.0f;
+    rect.right = 540.0f;
+    rect.bottom = 380.0f;
+    sk_canvas_draw_rect(canvas, &rect, fill);
+
+    sk_paint_t* stroke = sk_paint_new();
+    sk_paint_set_color(stroke, sk_color_set_argb(0xFF, 0xFF, 0x00, 0x00));
+    sk_paint_set_antialias(stroke, true);
+    sk_paint_set_stroke(stroke, true);
+    sk_paint_set_stroke_width(stroke, 5.0f);
+    sk_path_t* path = sk_path_new();
+
+    sk_path_move_to(path, 50.0f, 50.0f);
+    sk_path_line_to(path, 590.0f, 50.0f);
+    sk_path_cubic_to(path, -490.0f, 50.0f, 1130.0f, 430.0f, 50.0f, 430.0f);
+    sk_path_line_to(path, 590.0f, 430.0f);
+    sk_canvas_draw_path(canvas, path, stroke);
+
+    sk_paint_set_color(fill, sk_color_set_argb(0x80, 0x00, 0xFF, 0x00));
+    sk_rect_t rect2;
+    rect2.left = 120.0f;
+    rect2.top = 120.0f;
+    rect2.right = 520.0f;
+    rect2.bottom = 360.0f;
+    sk_canvas_draw_oval(canvas, &rect2, fill);
+
+    sk_path_delete(path);
+    sk_paint_delete(stroke);
+    sk_paint_delete(fill);
+}
+
+int main() {
+    sk_surface_t* surface = make_surface(640, 480);
+    sk_canvas_t* canvas = sk_surface_get_canvas(surface);
+    draw(canvas);
+    emit_png("skia-c-example.png", surface);
+    sk_surface_unref(surface);
+    return 0;
+}
diff --git a/include/c/sk_canvas.h b/include/c/sk_canvas.h
index 9eb21f3..f65d3aa 100644
--- a/include/c/sk_canvas.h
+++ b/include/c/sk_canvas.h
@@ -15,28 +15,31 @@
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
-void sk_canvas_save(sk_canvas_t*);
-void sk_canvas_save_layer(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
-void sk_canvas_restore(sk_canvas_t*);
+SK_API void sk_canvas_save(sk_canvas_t*);
+SK_API void sk_canvas_save_layer(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
+SK_API void sk_canvas_restore(sk_canvas_t*);
 
-void sk_canvas_translate(sk_canvas_t*, float dx, float dy);
-void sk_canvas_scale(sk_canvas_t*, float sx, float sy);
-void sk_canvas_rotate_degrees(sk_canvas_t*, float degrees);
-void sk_canvas_rotate_radians(sk_canvas_t*, float radians);
-void sk_canvas_skew(sk_canvas_t*, float sx, float sy);
-void sk_canvas_concat(sk_canvas_t*, const sk_matrix_t*);
+SK_API void sk_canvas_translate(sk_canvas_t*, float dx, float dy);
+SK_API void sk_canvas_scale(sk_canvas_t*, float sx, float sy);
+SK_API void sk_canvas_rotate_degrees(sk_canvas_t*, float degrees);
+SK_API void sk_canvas_rotate_radians(sk_canvas_t*, float radians);
+SK_API void sk_canvas_skew(sk_canvas_t*, float sx, float sy);
+SK_API void sk_canvas_concat(sk_canvas_t*, const sk_matrix_t*);
 
-void sk_canvas_clip_rect(sk_canvas_t*, const sk_rect_t*);
-void sk_canvas_clip_path(sk_canvas_t*, const sk_path_t*);
+SK_API void sk_canvas_clip_rect(sk_canvas_t*, const sk_rect_t*);
+SK_API void sk_canvas_clip_path(sk_canvas_t*, const sk_path_t*);
 
-void sk_canvas_draw_paint(sk_canvas_t*, const sk_paint_t*);
-void sk_canvas_draw_rect(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
-void sk_canvas_draw_oval(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
-void sk_canvas_draw_path(sk_canvas_t*, const sk_path_t*, const sk_paint_t*);
-void sk_canvas_draw_image(sk_canvas_t*, const sk_image_t*, float x, float y, const sk_paint_t*);
-void sk_canvas_draw_image_rect(sk_canvas_t*, const sk_image_t*, const sk_rect_t* src,
-                               const sk_rect_t* dst, const sk_paint_t*);
-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_draw_paint(sk_canvas_t*, const sk_paint_t*);
+SK_API void sk_canvas_draw_rect(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
+SK_API void sk_canvas_draw_oval(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*);
+SK_API void sk_canvas_draw_path(sk_canvas_t*, const sk_path_t*, const sk_paint_t*);
+SK_API void sk_canvas_draw_image(sk_canvas_t*, const sk_image_t*,
+                                 float x, float y, const sk_paint_t*);
+SK_API void sk_canvas_draw_image_rect(sk_canvas_t*, const sk_image_t*,
+                                      const sk_rect_t* src,
+                                      const sk_rect_t* dst, const sk_paint_t*);
+SK_API void sk_canvas_draw_picture(sk_canvas_t*, const sk_picture_t*,
+                                   const sk_matrix_t*, const sk_paint_t*);
 
 SK_C_PLUS_PLUS_END_GUARD
 
diff --git a/include/c/sk_data.h b/include/c/sk_data.h
index 90863ee..95b7f5e 100644
--- a/include/c/sk_data.h
+++ b/include/c/sk_data.h
@@ -15,16 +15,16 @@
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
-sk_data_t* sk_data_new_empty();
-sk_data_t* sk_data_new_with_copy(const void* src, size_t length);
-sk_data_t* sk_data_new_from_malloc(const void* memory, size_t length);
-sk_data_t* sk_data_new_subset(const sk_data_t* src, size_t offset, size_t length);
+SK_API sk_data_t* sk_data_new_empty();
+SK_API sk_data_t* sk_data_new_with_copy(const void* src, size_t length);
+SK_API sk_data_t* sk_data_new_from_malloc(const void* memory, size_t length);
+SK_API sk_data_t* sk_data_new_subset(const sk_data_t* src, size_t offset, size_t length);
 
-void sk_data_ref(const sk_data_t*);
-void sk_data_unref(const sk_data_t*);
+SK_API void sk_data_ref(const sk_data_t*);
+SK_API void sk_data_unref(const sk_data_t*);
 
-size_t sk_data_get_size(const sk_data_t*);
-const void* sk_data_get_data(const sk_data_t*);
+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_C_PLUS_PLUS_END_GUARD
 
diff --git a/include/c/sk_image.h b/include/c/sk_image.h
index c9973ac..e6f49b7 100644
--- a/include/c/sk_image.h
+++ b/include/c/sk_image.h
@@ -19,7 +19,7 @@
  *  Return a new image that has made a copy of the provided pixels, or NULL on failure.
  *  Balance with a call to sk_image_unref().
  */
-sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t*, const void* pixels, size_t rowBytes);
+SK_API sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t*, const void* pixels, size_t rowBytes);
 
 /**
  *  If the specified data can be interpreted as a compressed image (e.g. PNG or JPEG) then this
@@ -28,15 +28,15 @@
  *  On success, the encoded data may be processed immediately, or it may be ref()'d for later
  *  use.
  */
-sk_image_t* sk_image_new_from_encoded(const sk_data_t* encoded, const sk_irect_t* subset);
+SK_API sk_image_t* sk_image_new_from_encoded(const sk_data_t* encoded, const sk_irect_t* subset);
 
-sk_data_t* sk_image_encode(const sk_image_t*);
+SK_API sk_data_t* sk_image_encode(const sk_image_t*);
 
-void sk_image_ref(const sk_image_t*);
-void sk_image_unref(const sk_image_t*);
-int sk_image_get_width(const sk_image_t*);
-int sk_image_get_height(const sk_image_t*);
-uint32_t sk_image_get_unique_id(const sk_image_t*);
+SK_API void sk_image_ref(const sk_image_t*);
+SK_API void sk_image_unref(const sk_image_t*);
+SK_API int sk_image_get_width(const sk_image_t*);
+SK_API int sk_image_get_height(const sk_image_t*);
+SK_API uint32_t sk_image_get_unique_id(const sk_image_t*);
 
 SK_C_PLUS_PLUS_END_GUARD
 
diff --git a/include/c/sk_paint.h b/include/c/sk_paint.h
index 3824380..6699fb4 100644
--- a/include/c/sk_paint.h
+++ b/include/c/sk_paint.h
@@ -15,25 +15,25 @@
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
-sk_paint_t* sk_paint_new();
-void sk_paint_delete(sk_paint_t*);
+SK_API sk_paint_t* sk_paint_new();
+SK_API void sk_paint_delete(sk_paint_t*);
 
-bool sk_paint_is_antialias(const sk_paint_t*);
-void sk_paint_set_antialias(sk_paint_t*, bool);
+SK_API bool sk_paint_is_antialias(const sk_paint_t*);
+SK_API void sk_paint_set_antialias(sk_paint_t*, bool);
 
-sk_color_t sk_paint_get_color(const sk_paint_t*);
-void sk_paint_set_color(sk_paint_t*, sk_color_t);
+SK_API sk_color_t sk_paint_get_color(const sk_paint_t*);
+SK_API void sk_paint_set_color(sk_paint_t*, sk_color_t);
 
 /* stroke settings */
 
-bool sk_paint_is_stroke(const sk_paint_t*);
-void sk_paint_set_stroke(sk_paint_t*, bool);
+SK_API bool sk_paint_is_stroke(const sk_paint_t*);
+SK_API void sk_paint_set_stroke(sk_paint_t*, bool);
 
-float sk_paint_get_stroke_width(const sk_paint_t*);
-void sk_paint_set_stroke_width(sk_paint_t*, float width);
+SK_API float sk_paint_get_stroke_width(const sk_paint_t*);
+SK_API void sk_paint_set_stroke_width(sk_paint_t*, float width);
 
-float sk_paint_get_stroke_miter(const sk_paint_t*);
-void sk_paint_set_stroke_miter(sk_paint_t*, float miter);
+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,
@@ -41,8 +41,8 @@
     SQUARE_SK_STROKE_CAP
 } sk_stroke_cap_t;
 
-sk_stroke_cap_t sk_paint_get_stroke_cap(const sk_paint_t*);
-void sk_paint_set_stroke_cap(sk_paint_t*, sk_stroke_cap_t);
+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,
@@ -50,25 +50,25 @@
     BEVEL_SK_STROKE_JOIN
 } sk_stroke_join_t;
 
-sk_stroke_join_t sk_paint_get_stroke_join(const sk_paint_t*);
-void sk_paint_set_stroke_join(sk_paint_t*, sk_stroke_join_t);
+SK_API sk_stroke_join_t sk_paint_get_stroke_join(const sk_paint_t*);
+SK_API void sk_paint_set_stroke_join(sk_paint_t*, sk_stroke_join_t);
 
 /**
  *  Set the paint's shader to the specified parameter. This will automatically call unref() on
  *  any previous value, and call ref() on the new value.
  */
-void sk_paint_set_shader(sk_paint_t*, sk_shader_t*);
+SK_API void sk_paint_set_shader(sk_paint_t*, sk_shader_t*);
 
 /**
  *  Set the paint's maskfilter to the specified parameter. This will automatically call unref() on
  *  any previous value, and call ref() on the new value.
  */
-void sk_paint_set_maskfilter(sk_paint_t*, sk_maskfilter_t*);
+SK_API void sk_paint_set_maskfilter(sk_paint_t*, sk_maskfilter_t*);
 
 /**
  *  Set the paint's xfermode to the specified parameter.
  */
-void sk_paint_set_xfermode_mode(sk_paint_t*, sk_xfermode_mode_t);
+SK_API void sk_paint_set_xfermode_mode(sk_paint_t*, sk_xfermode_mode_t);
 
 SK_C_PLUS_PLUS_END_GUARD
 
diff --git a/include/c/sk_path.h b/include/c/sk_path.h
index 801e148..d13a112 100644
--- a/include/c/sk_path.h
+++ b/include/c/sk_path.h
@@ -20,25 +20,28 @@
     CCW_SK_PATH_DIRECTION,
 } sk_path_direction_t;
 
-sk_path_t* sk_path_new();
-void sk_path_delete(sk_path_t*);
+SK_API sk_path_t* sk_path_new();
+SK_API void sk_path_delete(sk_path_t*);
 
-void sk_path_move_to(sk_path_t*, float x, float y);
-void sk_path_line_to(sk_path_t*, float x, float y);
-void sk_path_quad_to(sk_path_t*, float x0, float y0, float x1, float y1);
-void sk_path_conic_to(sk_path_t*, float x0, float y0, float x1, float y1, float w);
-void sk_path_cubic_to(sk_path_t*, float x0, float y0, float x1, float y1, float x2, float y2);
-void sk_path_close(sk_path_t*);
+SK_API void sk_path_move_to(sk_path_t*, float x, float y);
+SK_API void sk_path_line_to(sk_path_t*, float x, float y);
+SK_API void sk_path_quad_to(sk_path_t*, float x0, float y0, float x1, float y1);
+SK_API void sk_path_conic_to(sk_path_t*, float x0, float y0, float x1, float y1, float w);
+SK_API void sk_path_cubic_to(sk_path_t*,
+                             float x0, float y0,
+                             float x1, float y1,
+                             float x2, float y2);
+SK_API void sk_path_close(sk_path_t*);
 
-void sk_path_add_rect(sk_path_t*, const sk_rect_t*, sk_path_direction_t);
-void sk_path_add_oval(sk_path_t*, const sk_rect_t*, sk_path_direction_t);
+SK_API void sk_path_add_rect(sk_path_t*, const sk_rect_t*, sk_path_direction_t);
+SK_API void sk_path_add_oval(sk_path_t*, const sk_rect_t*, sk_path_direction_t);
 
 /**
  *  If the path is empty, return false and set the rect parameter to [0, 0, 0, 0].
  *  else return true and set the rect parameter to the bounds of the control-points
  *  of the path.
  */
-bool sk_path_get_bounds(const sk_path_t*, sk_rect_t*);
+SK_API bool sk_path_get_bounds(const sk_path_t*, sk_rect_t*);
 
 SK_C_PLUS_PLUS_END_GUARD
 
diff --git a/include/c/sk_surface.h b/include/c/sk_surface.h
index 397dc83..f3c17d0 100644
--- a/include/c/sk_surface.h
+++ b/include/c/sk_surface.h
@@ -15,21 +15,22 @@
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
 
-sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t*, const sk_surfaceprops_t*);
-sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t*, void* pixels, size_t rowBytes,
-                                           const sk_surfaceprops_t* props);
-void sk_surface_unref(sk_surface_t*);
+SK_API sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t*, const sk_surfaceprops_t*);
+SK_API sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t*,
+                                                  void* pixels, size_t rowBytes,
+                                                  const sk_surfaceprops_t* props);
+SK_API void sk_surface_unref(sk_surface_t*);
 
 /**
  *  Return the canvas associated with this surface. Note: the canvas is owned by the surface,
  *  so the returned object is only valid while the owning surface is valid.
  */
-sk_canvas_t* sk_surface_get_canvas(sk_surface_t*);
+SK_API sk_canvas_t* sk_surface_get_canvas(sk_surface_t*);
 
 /**
  *  Call sk_image_unref() when the returned image is no longer used.
  */
-sk_image_t* sk_surface_new_image_snapshot(sk_surface_t*);
+SK_API sk_image_t* sk_surface_new_image_snapshot(sk_surface_t*);
 
 SK_C_PLUS_PLUS_END_GUARD
 
diff --git a/include/c/sk_types.h b/include/c/sk_types.h
index 87cc055..f6d73df 100644
--- a/include/c/sk_types.h
+++ b/include/c/sk_types.h
@@ -23,6 +23,10 @@
     #define SK_C_PLUS_PLUS_END_GUARD
 #endif
 
+#ifndef SK_API
+#define SK_API
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////////////
 
 SK_C_PLUS_PLUS_BEGIN_GUARD
@@ -61,7 +65,7 @@
     BGR_V_SK_PIXELGEOMETRY,
 } sk_pixelgeometry_t;
 
-sk_colortype_t sk_colortype_get_default_8888();
+SK_API sk_colortype_t sk_colortype_get_default_8888();
 
 typedef struct {
     int32_t         width;
diff --git a/src/c/sk_paint.cpp b/src/c/sk_paint.cpp
index dcf2683..dd0733f 100644
--- a/src/c/sk_paint.cpp
+++ b/src/c/sk_paint.cpp
@@ -5,11 +5,11 @@
  * found in the LICENSE file.
  */
 
+#include "SkPaint.h"
+
 #include "sk_paint.h"
 #include "sk_types_priv.h"
 
-#include "SkPaint.h"
-
 #define MAKE_FROM_TO_NAME(FROM)     g_ ## FROM ## _map
 
 const struct {
diff --git a/src/c/sk_surface.cpp b/src/c/sk_surface.cpp
index 722ca46..b8fbc63 100644
--- a/src/c/sk_surface.cpp
+++ b/src/c/sk_surface.cpp
@@ -5,14 +5,6 @@
  * found in the LICENSE file.
  */
 
-#include "sk_canvas.h"
-#include "sk_data.h"
-#include "sk_image.h"
-#include "sk_paint.h"
-#include "sk_path.h"
-#include "sk_surface.h"
-#include "sk_types_priv.h"
-
 #include "SkCanvas.h"
 #include "SkData.h"
 #include "SkImage.h"
@@ -23,6 +15,14 @@
 #include "SkPictureRecorder.h"
 #include "SkSurface.h"
 
+#include "sk_canvas.h"
+#include "sk_data.h"
+#include "sk_image.h"
+#include "sk_paint.h"
+#include "sk_path.h"
+#include "sk_surface.h"
+#include "sk_types_priv.h"
+
 const struct {
     sk_colortype_t  fC;
     SkColorType     fSK;
diff --git a/tests/CTest.cpp b/tests/CTest.cpp
index f6ff4f0..1f301ef 100644
--- a/tests/CTest.cpp
+++ b/tests/CTest.cpp
@@ -5,14 +5,13 @@
  * found in the LICENSE file.
  */
 
+#include "Test.h"
+
 #include "sk_canvas.h"
 #include "sk_paint.h"
 #include "sk_surface.h"
 #include "sk_shader.h"
 
-#include "Test.h"
-
-
 static void shader_test(skiatest::Reporter* reporter) {
     sk_imageinfo_t info =
         {64, 64, sk_colortype_get_default_8888(), PREMUL_SK_ALPHATYPE};