| OLD | NEW |
| 1 Skia's Stable C API | 1 Skia's Stable C API |
| 2 =================== | 2 =================== |
| 3 | 3 |
| 4 <div style="text-align:center"> | 4 <div style="text-align:center"> |
| 5 <strong>EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL<br> | 5 <strong>EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL<br> |
| 6 DO NOT USE — FOR INTERNAL TESTING ONLY</strong> | 6 DO NOT USE — FOR INTERNAL TESTING ONLY</strong> |
| 7 </div> | 7 </div> |
| 8 | 8 |
| 9 Several issues hinder the development of a stable ABI (application | 9 Several issues hinder the development of a stable ABI (application |
| 10 binary interface) for Skia: | 10 binary interface) for Skia: |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 sk_surface_t* surface = make_surface(640, 480); | 96 sk_surface_t* surface = make_surface(640, 480); |
| 97 sk_canvas_t* canvas = sk_surface_get_canvas(surface); | 97 sk_canvas_t* canvas = sk_surface_get_canvas(surface); |
| 98 draw(canvas); | 98 draw(canvas); |
| 99 emit_png("skia-c-example.png", surface); | 99 emit_png("skia-c-example.png", surface); |
| 100 sk_surface_unref(surface); | 100 sk_surface_unref(surface); |
| 101 return 0; | 101 return 0; |
| 102 } | 102 } |
| 103 | 103 |
| 104 <a href="https://fiddle.skia.org/c/6c6c01438d9c3d80e9c22e606359432e"><img src="h
ttps://fiddle.skia.org/i/6c6c01438d9c3d80e9c22e606359432e_raster.png" alt=""></a
> | 104 <a href="https://fiddle.skia.org/c/6c6c01438d9c3d80e9c22e606359432e"><img src="h
ttps://fiddle.skia.org/i/6c6c01438d9c3d80e9c22e606359432e_raster.png" alt=""></a
> |
| 105 | 105 |
| 106 <!-- | |
| 107 | |
| 108 Gyp+Linux example | |
| 109 ----------------- | |
| 110 | |
| 111 The following proof-of-concept workflow currently works on Ubuntu 14.04: | |
| 112 | |
| 113 1. Aquire Skia and install dependencies (you may have already done this): | |
| 114 | |
| 115 <!--?prettify lang=sh?--> | |
| 116 | |
| 117 git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.
git' | |
| 118 export PATH="$PWD/depot_tools:$PATH" | |
| 119 git clone 'https://skia.googlesource.com/skia' | |
| 120 skia/tools/install_dependencies.sh | |
| 121 SKIA_DIR="$PWD/skia" | |
| 122 | |
| 123 2. Compile Skia as a shared library: | |
| 124 | |
| 125 <!--?prettify lang=sh?--> | |
| 126 | |
| 127 GYP_DEFINES=skia_shared_lib=1 "$SKIA_DIR"/bin/sync-and-gyp | |
| 128 ninja -C "$SKIA_DIR/out/Release" skia_lib | |
| 129 | |
| 130 3. Compile, link, and run the example program: | |
| 131 | |
| 132 <!--?prettify lang=sh?--> | |
| 133 | |
| 134 cd [Wherever you want the example] | |
| 135 cp "$SKIA_DIR/experimental/c-api-example/skia-c-example.c" . | |
| 136 cc -c -I "$SKIA_DIR/include/c" skia-c-example.c -o skia-c-example.o | |
| 137 cc skia-c-example.o -L "$SKIA_DIR/out/Release/lib" -lskia -o skia-c-exam
ple | |
| 138 LD_LIBRARY_PATH="$SKIA_DIR/out/Release/lib" ./skia-c-example | |
| 139 xdg-open skia-c-example.png | |
| 140 --> | |
| 141 | |
| 142 Cmake example | 106 Cmake example |
| 143 ------------- | 107 ------------- |
| 144 | 108 |
| 145 The following proof-of-concept workflow currently works on MacOS and Ubuntu | 109 The following proof-of-concept workflow currently works on MacOS and Ubuntu |
| 146 | 110 |
| 147 1. Aquire Skia (you may have already done this): | 111 1. Aquire Skia (you may have already done this): |
| 148 | 112 |
| 149 <!--?prettify lang=sh?--> | 113 <!--?prettify lang=sh?--> |
| 150 | 114 |
| 151 cd [Wherever you want skia src code] | 115 cd [Wherever you want skia src code] |
| (...skipping 18 matching lines...) Expand all Loading... |
| 170 mkdir skia_c_example | 134 mkdir skia_c_example |
| 171 cd skia_c_example | 135 cd skia_c_example |
| 172 cp "$SKIA_DIR/experimental/c-api-example/skia-c-example.c" . | 136 cp "$SKIA_DIR/experimental/c-api-example/skia-c-example.c" . |
| 173 cc -c -I "$SKIA_DIR/include/c" skia-c-example.c -o skia-c-example.o | 137 cc -c -I "$SKIA_DIR/include/c" skia-c-example.c -o skia-c-example.o |
| 174 c++ skia-c-example.o \ | 138 c++ skia-c-example.o \ |
| 175 "$SKIA_BUILD"/libskia.* -Wl,-rpath -Wl,"$SKIA_BUILD" \ | 139 "$SKIA_BUILD"/libskia.* -Wl,-rpath -Wl,"$SKIA_BUILD" \ |
| 176 -o skia-c-example | 140 -o skia-c-example |
| 177 ./skia-c-example | 141 ./skia-c-example |
| 178 [ $(uname) = Darwin ] && open skia-c-example.png | 142 [ $(uname) = Darwin ] && open skia-c-example.png |
| 179 [ $(uname) = Linux ] && xdg-open skia-c-example.png | 143 [ $(uname) = Linux ] && xdg-open skia-c-example.png |
| OLD | NEW |