| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL |
| 9 // DO NOT USE -- FOR INTERNAL TESTING ONLY |
| 10 |
| 8 #ifndef sk_types_DEFINED | 11 #ifndef sk_types_DEFINED |
| 9 #define sk_types_DEFINED | 12 #define sk_types_DEFINED |
| 10 | 13 |
| 11 #include <stdint.h> | 14 #include <stdint.h> |
| 12 #include <stddef.h> | 15 #include <stddef.h> |
| 13 | 16 |
| 14 #ifdef __cplusplus | 17 #ifdef __cplusplus |
| 15 extern "C" { | 18 extern "C" { |
| 16 #endif | 19 #endif |
| 17 | 20 |
| 18 typedef uint32_t sk_color_t; | 21 typedef uint32_t sk_color_t; |
| 19 | 22 |
| 20 #define sk_color_set_argb(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8)
| (b)) | 23 #define sk_color_set_argb(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8)
| (b)) |
| 21 #define sk_color_get_a(c) (((c) >> 24) & 0xFF) | 24 #define sk_color_get_a(c) (((c) >> 24) & 0xFF) |
| 22 #define sk_color_get_r(c) (((c) >> 16) & 0xFF) | 25 #define sk_color_get_r(c) (((c) >> 16) & 0xFF) |
| 23 #define sk_color_get_g(c) (((c) >> 8) & 0xFF) | 26 #define sk_color_get_g(c) (((c) >> 8) & 0xFF) |
| 24 #define sk_color_get_b(c) (((c) >> 0) & 0xFF) | 27 #define sk_color_get_b(c) (((c) >> 0) & 0xFF) |
| 25 | 28 |
| 26 typedef enum { | 29 typedef enum { |
| 27 UNKNOWN_SK_COLORTYPE, | 30 UNKNOWN_SK_COLORTYPE, |
| 28 RGBA_8888_SK_COLORTYPE, | 31 RGBA_8888_SK_COLORTYPE, |
| 29 BGRA_8888_SK_COLORTYPE, | 32 BGRA_8888_SK_COLORTYPE, |
| 30 ALPHA_8_SK_COLORTYPE, | 33 ALPHA_8_SK_COLORTYPE, |
| 31 } sk_colortype_t; | 34 } sk_colortype_t; |
| 32 | 35 |
| 33 typedef enum { | 36 typedef enum { |
| 37 OPAQUE_SK_ALPHATYPE, |
| 34 PREMUL_SK_ALPHATYPE, | 38 PREMUL_SK_ALPHATYPE, |
| 35 UNPREMUL_SK_ALPHATYPE, | 39 UNPREMUL_SK_ALPHATYPE, |
| 36 } sk_alphatype_t; | 40 } sk_alphatype_t; |
| 37 | 41 |
| 42 sk_colortype_t sk_colortype_get_default_8888(); |
| 43 |
| 38 typedef struct { | 44 typedef struct { |
| 39 int32_t width; | 45 int32_t width; |
| 40 int32_t height; | 46 int32_t height; |
| 41 sk_colortype_t colorType; | 47 sk_colortype_t colorType; |
| 42 sk_alphatype_t alphaType; | 48 sk_alphatype_t alphaType; |
| 43 } sk_imageinfo_t; | 49 } sk_imageinfo_t; |
| 44 | 50 |
| 45 typedef struct { | 51 typedef struct { |
| 46 float left; | 52 float left; |
| 47 float top; | 53 float top; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 76 | 82 |
| 77 void sk_canvas_translate(sk_canvas_t*, float dx, float dy); | 83 void sk_canvas_translate(sk_canvas_t*, float dx, float dy); |
| 78 void sk_canvas_scale(sk_canvas_t*, float sx, float sy); | 84 void sk_canvas_scale(sk_canvas_t*, float sx, float sy); |
| 79 | 85 |
| 80 void sk_canvas_draw_paint(sk_canvas_t*, const sk_paint_t*); | 86 void sk_canvas_draw_paint(sk_canvas_t*, const sk_paint_t*); |
| 81 void sk_canvas_draw_rect(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*); | 87 void sk_canvas_draw_rect(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*); |
| 82 void sk_canvas_draw_oval(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*); | 88 void sk_canvas_draw_oval(sk_canvas_t*, const sk_rect_t*, const sk_paint_t*); |
| 83 void sk_canvas_draw_path(sk_canvas_t*, const sk_path_t*, const sk_paint_t*); | 89 void sk_canvas_draw_path(sk_canvas_t*, const sk_path_t*, const sk_paint_t*); |
| 84 void sk_canvas_draw_image(sk_canvas_t*, const sk_image_t*, float x, float y, con
st sk_paint_t*); | 90 void sk_canvas_draw_image(sk_canvas_t*, const sk_image_t*, float x, float y, con
st sk_paint_t*); |
| 85 | 91 |
| 92 /** |
| 93 * Return a new image that has made a copy of the provided pixels, or NULL on f
ailure. |
| 94 * Balance with a call to sk_image_unref(). |
| 95 */ |
| 86 sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t*, const void* pixels,
size_t rowBytes); | 96 sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t*, const void* pixels,
size_t rowBytes); |
| 87 void sk_image_ref(const sk_image_t*); | 97 void sk_image_ref(const sk_image_t*); |
| 88 void sk_image_unref(const sk_image_t*); | 98 void sk_image_unref(const sk_image_t*); |
| 89 int sk_image_get_width(const sk_image_t*); | 99 int sk_image_get_width(const sk_image_t*); |
| 90 int sk_image_get_height(const sk_image_t*); | 100 int sk_image_get_height(const sk_image_t*); |
| 91 uint32_t sk_image_get_unique_id(const sk_image_t*); | 101 uint32_t sk_image_get_unique_id(const sk_image_t*); |
| 92 | 102 |
| 93 typedef struct sk_surface_t sk_surface_t; | 103 typedef struct sk_surface_t sk_surface_t; |
| 94 | 104 |
| 95 sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t*); | 105 sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t*); |
| 96 sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t*, void* pixels,
size_t rowBytes); | 106 sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t*, void* pixels,
size_t rowBytes); |
| 97 void sk_surface_delete(sk_surface_t*); | 107 void sk_surface_delete(sk_surface_t*); |
| 108 |
| 109 /** |
| 110 * Return the canvas associated with this surface. Note: the canvas is owned by
the surface, |
| 111 * so the returned object is only valid while the owning surface is valid. |
| 112 */ |
| 98 sk_canvas_t* sk_surface_get_canvas(sk_surface_t*); | 113 sk_canvas_t* sk_surface_get_canvas(sk_surface_t*); |
| 99 sk_image_t* sk_surface_new_image_snapshot(sk_surface_t*); | 114 sk_image_t* sk_surface_new_image_snapshot(sk_surface_t*); |
| 100 | 115 |
| 101 #ifdef __cplusplus | 116 #ifdef __cplusplus |
| 102 class SkCanvas; | 117 class SkCanvas; |
| 103 void sk_test_capi(SkCanvas*); | 118 void sk_test_capi(SkCanvas*); |
| 104 } | 119 } |
| 105 #endif | 120 #endif |
| 106 | 121 |
| 107 #endif | 122 #endif |
| OLD | NEW |