| 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 |
| 106 Gyp+Linux example | 108 Gyp+Linux example |
| 107 ----------------- | 109 ----------------- |
| 108 | 110 |
| 109 The following proof-of-concept workflow currently works on Ubuntu 14.04: | 111 The following proof-of-concept workflow currently works on Ubuntu 14.04: |
| 110 | 112 |
| 111 1. Aquire Skia and install dependencies (you may have already done this): | 113 1. Aquire Skia and install dependencies (you may have already done this): |
| 112 | 114 |
| 113 <!--?prettify lang=sh?--> | 115 <!--?prettify lang=sh?--> |
| 114 | 116 |
| 115 git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.
git' | 117 git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.
git' |
| (...skipping 12 matching lines...) Expand all Loading... |
| 128 3. Compile, link, and run the example program: | 130 3. Compile, link, and run the example program: |
| 129 | 131 |
| 130 <!--?prettify lang=sh?--> | 132 <!--?prettify lang=sh?--> |
| 131 | 133 |
| 132 cd [Wherever you want the example] | 134 cd [Wherever you want the example] |
| 133 cp "$SKIA_DIR/experimental/c-api-example/skia-c-example.c" . | 135 cp "$SKIA_DIR/experimental/c-api-example/skia-c-example.c" . |
| 134 cc -c -I "$SKIA_DIR/include/c" skia-c-example.c -o skia-c-example.o | 136 cc -c -I "$SKIA_DIR/include/c" skia-c-example.c -o skia-c-example.o |
| 135 cc skia-c-example.o -L "$SKIA_DIR/out/Release/lib" -lskia -o skia-c-exam
ple | 137 cc skia-c-example.o -L "$SKIA_DIR/out/Release/lib" -lskia -o skia-c-exam
ple |
| 136 LD_LIBRARY_PATH="$SKIA_DIR/out/Release/lib" ./skia-c-example | 138 LD_LIBRARY_PATH="$SKIA_DIR/out/Release/lib" ./skia-c-example |
| 137 xdg-open skia-c-example.png | 139 xdg-open skia-c-example.png |
| 140 --> |
| 138 | 141 |
| 139 Cmake+MacOS example | 142 Cmake example |
| 140 ------------------- | 143 ------------- |
| 141 | 144 |
| 142 The following proof-of-concept workflow currently works on MacOS | 145 The following proof-of-concept workflow currently works on MacOS and Ubuntu |
| 143 | 146 |
| 144 1. Aquire Skia and install dependencies (you may have already done this): | 147 1. Aquire Skia (you may have already done this): |
| 145 | 148 |
| 146 <!--?prettify lang=sh?--> | 149 <!--?prettify lang=sh?--> |
| 147 | 150 |
| 148 cd [Wherever you want skia src code] | 151 cd [Wherever you want skia src code] |
| 149 git clone 'https://skia.googlesource.com/skia' | 152 git clone 'https://skia.googlesource.com/skia' |
| 150 SKIA_DIR="$PWD/skia" | 153 SKIA_DIR="$PWD/skia" |
| 151 | 154 |
| 152 2. Compile Skia as a shared library: | 155 2. Compile Skia (outside of source) as a shared library: |
| 153 | 156 |
| 154 <!--?prettify lang=sh?--> | 157 <!--?prettify lang=sh?--> |
| 155 | 158 |
| 156 cd [Wherever you want skia build files] | 159 cd [Wherever you want skia build files] |
| 157 mkdir build_skia | 160 mkdir build_skia |
| 158 cd build_skia | 161 cd build_skia |
| 159 SKIA_BUILD="$PWD" | 162 SKIA_BUILD="$PWD" |
| 160 cmake "$SKIA_DIR/cmake" -G Ninja && ninja | 163 cmake "$SKIA_DIR/cmake" -G Ninja && ninja |
| 161 | 164 |
| 162 3. Compile, link, and run the example program: | 165 3. Compile, link, and run the example program: |
| 163 | 166 |
| 164 <!--?prettify lang=sh?--> | 167 <!--?prettify lang=sh?--> |
| 165 | 168 |
| 166 cd [Wherever you want the example] | 169 cd [Wherever you want the example] |
| 170 mkdir skia_c_example |
| 171 cd skia_c_example |
| 167 cp "$SKIA_DIR/experimental/c-api-example/skia-c-example.c" . | 172 cp "$SKIA_DIR/experimental/c-api-example/skia-c-example.c" . |
| 168 cc -c -I "$SKIA_DIR/include/c" skia-c-example.c -o skia-c-example.o | 173 cc -c -I "$SKIA_DIR/include/c" skia-c-example.c -o skia-c-example.o |
| 169 c++ skia-c-example.o \ | 174 c++ skia-c-example.o \ |
| 170 "$SKIA_BUILD"/libskia.* -Wl,-rpath -Wl,"$SKIA_BUILD" \ | 175 "$SKIA_BUILD"/libskia.* -Wl,-rpath -Wl,"$SKIA_BUILD" \ |
| 171 -o skia-c-example | 176 -o skia-c-example |
| 172 ./skia-c-example | 177 ./skia-c-example |
| 173 open skia-c-example.png | 178 [ $(uname) = Darwin ] && open skia-c-example.png |
| 179 [ $(uname) = Linux ] && xdg-open skia-c-example.png |
| OLD | NEW |