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 | 8 // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL |
9 // DO NOT USE -- FOR INTERNAL TESTING ONLY | 9 // DO NOT USE -- FOR INTERNAL TESTING ONLY |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #ifndef SK_API | 26 #ifndef SK_API |
27 #define SK_API | 27 #define SK_API |
28 #endif | 28 #endif |
29 | 29 |
30 ////////////////////////////////////////////////////////////////////////////////
/////// | 30 ////////////////////////////////////////////////////////////////////////////////
/////// |
31 | 31 |
32 SK_C_PLUS_PLUS_BEGIN_GUARD | 32 SK_C_PLUS_PLUS_BEGIN_GUARD |
33 | 33 |
34 typedef uint32_t sk_color_t; | 34 typedef uint32_t sk_color_t; |
35 | 35 |
| 36 /* This macro assumes all arguments are >=0 and <=255. */ |
36 #define sk_color_set_argb(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8)
| (b)) | 37 #define sk_color_set_argb(a, r, g, b) (((a) << 24) | ((r) << 16) | ((g) << 8)
| (b)) |
37 #define sk_color_get_a(c) (((c) >> 24) & 0xFF) | 38 #define sk_color_get_a(c) (((c) >> 24) & 0xFF) |
38 #define sk_color_get_r(c) (((c) >> 16) & 0xFF) | 39 #define sk_color_get_r(c) (((c) >> 16) & 0xFF) |
39 #define sk_color_get_g(c) (((c) >> 8) & 0xFF) | 40 #define sk_color_get_g(c) (((c) >> 8) & 0xFF) |
40 #define sk_color_get_b(c) (((c) >> 0) & 0xFF) | 41 #define sk_color_get_b(c) (((c) >> 0) & 0xFF) |
41 | 42 |
42 typedef enum { | 43 typedef enum { |
43 UNKNOWN_SK_COLORTYPE, | 44 UNKNOWN_SK_COLORTYPE, |
44 RGBA_8888_SK_COLORTYPE, | 45 RGBA_8888_SK_COLORTYPE, |
45 BGRA_8888_SK_COLORTYPE, | 46 BGRA_8888_SK_COLORTYPE, |
(...skipping 12 matching lines...) Expand all Loading... |
58 } sk_cliptype_t; | 59 } sk_cliptype_t; |
59 | 60 |
60 typedef enum { | 61 typedef enum { |
61 UNKNOWN_SK_PIXELGEOMETRY, | 62 UNKNOWN_SK_PIXELGEOMETRY, |
62 RGB_H_SK_PIXELGEOMETRY, | 63 RGB_H_SK_PIXELGEOMETRY, |
63 BGR_H_SK_PIXELGEOMETRY, | 64 BGR_H_SK_PIXELGEOMETRY, |
64 RGB_V_SK_PIXELGEOMETRY, | 65 RGB_V_SK_PIXELGEOMETRY, |
65 BGR_V_SK_PIXELGEOMETRY, | 66 BGR_V_SK_PIXELGEOMETRY, |
66 } sk_pixelgeometry_t; | 67 } sk_pixelgeometry_t; |
67 | 68 |
| 69 /** |
| 70 Return the default sk_colortype_t; this is operating-system dependent. |
| 71 */ |
68 SK_API sk_colortype_t sk_colortype_get_default_8888(); | 72 SK_API sk_colortype_t sk_colortype_get_default_8888(); |
69 | 73 |
70 typedef struct { | 74 typedef struct { |
71 int32_t width; | 75 int32_t width; |
72 int32_t height; | 76 int32_t height; |
73 sk_colortype_t colorType; | 77 sk_colortype_t colorType; |
74 sk_alphatype_t alphaType; | 78 sk_alphatype_t alphaType; |
75 } sk_imageinfo_t; | 79 } sk_imageinfo_t; |
76 | 80 |
77 typedef struct { | 81 typedef struct { |
(...skipping 16 matching lines...) Expand all Loading... |
94 float left; | 98 float left; |
95 float top; | 99 float top; |
96 float right; | 100 float right; |
97 float bottom; | 101 float bottom; |
98 } sk_rect_t; | 102 } sk_rect_t; |
99 | 103 |
100 typedef struct { | 104 typedef struct { |
101 float mat[9]; | 105 float mat[9]; |
102 } sk_matrix_t; | 106 } sk_matrix_t; |
103 | 107 |
| 108 /** |
| 109 A sk_canvas_t encapsulates all of the state about drawing into a |
| 110 destination This includes a reference to the destination itself, |
| 111 and a stack of matrix/clip values. |
| 112 */ |
104 typedef struct sk_canvas_t sk_canvas_t; | 113 typedef struct sk_canvas_t sk_canvas_t; |
| 114 /** |
| 115 A sk_data_ holds an immutable data buffer. |
| 116 */ |
105 typedef struct sk_data_t sk_data_t; | 117 typedef struct sk_data_t sk_data_t; |
| 118 /** |
| 119 A sk_image_t is an abstraction for drawing a rectagle of pixels. |
| 120 The content of the image is always immutable, though the actual |
| 121 storage may change, if for example that image can be re-created via |
| 122 encoded data or other means. |
| 123 */ |
106 typedef struct sk_image_t sk_image_t; | 124 typedef struct sk_image_t sk_image_t; |
| 125 /** |
| 126 A sk_maskfilter_t is an object that perform transformations on an |
| 127 alpha-channel mask before drawing it; it may be installed into a |
| 128 sk_paint_t. Each time a primitive is drawn, it is first |
| 129 scan-converted into a alpha mask, which os handed to the |
| 130 maskfilter, which may create a new mask is to render into the |
| 131 destination. |
| 132 */ |
107 typedef struct sk_maskfilter_t sk_maskfilter_t; | 133 typedef struct sk_maskfilter_t sk_maskfilter_t; |
| 134 /** |
| 135 A sk_paint_t holds the style and color information about how to |
| 136 draw geometries, text and bitmaps. |
| 137 */ |
108 typedef struct sk_paint_t sk_paint_t; | 138 typedef struct sk_paint_t sk_paint_t; |
| 139 /** |
| 140 A sk_path_t encapsulates compound (multiple contour) geometric |
| 141 paths consisting of straight line segments, quadratic curves, and |
| 142 cubic curves. |
| 143 */ |
109 typedef struct sk_path_t sk_path_t; | 144 typedef struct sk_path_t sk_path_t; |
| 145 /** |
| 146 A sk_picture_t holds recorded canvas drawing commands to be played |
| 147 back at a later time. |
| 148 */ |
110 typedef struct sk_picture_t sk_picture_t; | 149 typedef struct sk_picture_t sk_picture_t; |
| 150 /** |
| 151 A sk_picture_recorder_t holds a sk_canvas_t that records commands |
| 152 to create a sk_picture_t. |
| 153 */ |
111 typedef struct sk_picture_recorder_t sk_picture_recorder_t; | 154 typedef struct sk_picture_recorder_t sk_picture_recorder_t; |
| 155 /** |
| 156 A sk_shader_t specifies the source color(s) for what is being drawn. If a |
| 157 paint has no shader, then the paint's color is used. If the paint |
| 158 has a shader, then the shader's color(s) are use instead, but they |
| 159 are modulated by the paint's alpha. |
| 160 */ |
112 typedef struct sk_shader_t sk_shader_t; | 161 typedef struct sk_shader_t sk_shader_t; |
| 162 /** |
| 163 A sk_surface_t holds the destination for drawing to a canvas. For |
| 164 raster drawing, the destination is an array of pixels in memory. |
| 165 For GPU drawing, the destination is a texture or a framebuffer. |
| 166 */ |
113 typedef struct sk_surface_t sk_surface_t; | 167 typedef struct sk_surface_t sk_surface_t; |
114 | 168 |
115 typedef enum { | 169 typedef enum { |
116 CLEAR_SK_XFERMODE_MODE, | 170 CLEAR_SK_XFERMODE_MODE, |
117 SRC_SK_XFERMODE_MODE, | 171 SRC_SK_XFERMODE_MODE, |
118 DST_SK_XFERMODE_MODE, | 172 DST_SK_XFERMODE_MODE, |
119 SRCOVER_SK_XFERMODE_MODE, | 173 SRCOVER_SK_XFERMODE_MODE, |
120 DSTOVER_SK_XFERMODE_MODE, | 174 DSTOVER_SK_XFERMODE_MODE, |
121 SRCIN_SK_XFERMODE_MODE, | 175 SRCIN_SK_XFERMODE_MODE, |
122 DSTIN_SK_XFERMODE_MODE, | 176 DSTIN_SK_XFERMODE_MODE, |
(...skipping 19 matching lines...) Expand all Loading... |
142 SATURATION_SK_XFERMODE_MODE, | 196 SATURATION_SK_XFERMODE_MODE, |
143 COLOR_SK_XFERMODE_MODE, | 197 COLOR_SK_XFERMODE_MODE, |
144 LUMINOSITY_SK_XFERMODE_MODE, | 198 LUMINOSITY_SK_XFERMODE_MODE, |
145 } sk_xfermode_mode_t; | 199 } sk_xfermode_mode_t; |
146 | 200 |
147 ////////////////////////////////////////////////////////////////////////////////
////////// | 201 ////////////////////////////////////////////////////////////////////////////////
////////// |
148 | 202 |
149 SK_C_PLUS_PLUS_END_GUARD | 203 SK_C_PLUS_PLUS_END_GUARD |
150 | 204 |
151 #endif | 205 #endif |
OLD | NEW |