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 |
11 #ifndef sk_paint_DEFINED | 11 #ifndef sk_paint_DEFINED |
12 #define sk_paint_DEFINED | 12 #define sk_paint_DEFINED |
13 | 13 |
14 #include "sk_types.h" | 14 #include "sk_types.h" |
15 | 15 |
16 SK_C_PLUS_PLUS_BEGIN_GUARD | 16 SK_C_PLUS_PLUS_BEGIN_GUARD |
17 | 17 |
18 /** | |
19 Create a new paint with default settings: | |
20 antialias : false | |
21 stroke : false | |
22 stroke width : 0.0f (hairline) | |
23 stroke miter : configurable at build-time, (usually 4.0f). | |
reed1
2015/09/01 17:35:15
for the C api, this will always be 4.0
hal.canary
2015/09/01 17:39:53
Done.
| |
24 stroke cap : BUTT_SK_STROKE_CAP | |
25 stroke join : MITER_SK_STROKE_JOIN | |
26 color : opaque black | |
27 shader : NULL | |
28 maskfilter : NULL | |
29 xfermode_mode : SRCOVER_SK_XFERMODE_MODE | |
30 */ | |
18 SK_API sk_paint_t* sk_paint_new(); | 31 SK_API sk_paint_t* sk_paint_new(); |
32 /** | |
33 Release the memory storing the sk_paint_t and unref() all | |
34 associated objects. | |
35 */ | |
19 SK_API void sk_paint_delete(sk_paint_t*); | 36 SK_API void sk_paint_delete(sk_paint_t*); |
20 | 37 |
38 /** | |
39 Return true iff the paint has antialiasing enabled. | |
40 */ | |
21 SK_API bool sk_paint_is_antialias(const sk_paint_t*); | 41 SK_API bool sk_paint_is_antialias(const sk_paint_t*); |
42 /** | |
43 Set to true to enable antialiasing, false to disable it on this | |
44 sk_paint_t. | |
45 */ | |
22 SK_API void sk_paint_set_antialias(sk_paint_t*, bool); | 46 SK_API void sk_paint_set_antialias(sk_paint_t*, bool); |
23 | 47 |
48 /** | |
49 Return the paint's curent drawing color. | |
50 */ | |
24 SK_API sk_color_t sk_paint_get_color(const sk_paint_t*); | 51 SK_API sk_color_t sk_paint_get_color(const sk_paint_t*); |
52 /** | |
53 Set the paint's curent drawing color. | |
54 */ | |
25 SK_API void sk_paint_set_color(sk_paint_t*, sk_color_t); | 55 SK_API void sk_paint_set_color(sk_paint_t*, sk_color_t); |
26 | 56 |
27 /* stroke settings */ | 57 /* stroke settings */ |
28 | 58 |
59 /** | |
60 Return true iff stroking is enabled rather than filling on this | |
61 sk_paint_t. | |
62 */ | |
29 SK_API bool sk_paint_is_stroke(const sk_paint_t*); | 63 SK_API bool sk_paint_is_stroke(const sk_paint_t*); |
64 /** | |
65 Set to true to enable stroking rather than filling with this | |
66 sk_paint_t. | |
67 */ | |
30 SK_API void sk_paint_set_stroke(sk_paint_t*, bool); | 68 SK_API void sk_paint_set_stroke(sk_paint_t*, bool); |
31 | 69 |
70 /** | |
71 Return the width for stroking. A value of 0 strokes in hairline mode. | |
72 */ | |
32 SK_API float sk_paint_get_stroke_width(const sk_paint_t*); | 73 SK_API float sk_paint_get_stroke_width(const sk_paint_t*); |
74 /** | |
75 Set the width for stroking. A value of 0 strokes in hairline mode | |
76 (always draw 1-pixel wide, regardless of the matrix). | |
77 */ | |
33 SK_API void sk_paint_set_stroke_width(sk_paint_t*, float width); | 78 SK_API void sk_paint_set_stroke_width(sk_paint_t*, float width); |
34 | 79 |
80 /** | |
81 Return the paint's stroke miter value. This is used to control the | |
82 behavior of miter joins when the joins angle is sharp. | |
83 */ | |
35 SK_API float sk_paint_get_stroke_miter(const sk_paint_t*); | 84 SK_API float sk_paint_get_stroke_miter(const sk_paint_t*); |
85 /** | |
86 Set the paint's stroke miter value. This is used to control the | |
87 behavior of miter joins when the joins angle is sharp. This value | |
88 must be >= 0. | |
89 */ | |
36 SK_API void sk_paint_set_stroke_miter(sk_paint_t*, float miter); | 90 SK_API void sk_paint_set_stroke_miter(sk_paint_t*, float miter); |
37 | 91 |
38 typedef enum { | 92 typedef enum { |
39 BUTT_SK_STROKE_CAP, | 93 BUTT_SK_STROKE_CAP, |
40 ROUND_SK_STROKE_CAP, | 94 ROUND_SK_STROKE_CAP, |
41 SQUARE_SK_STROKE_CAP | 95 SQUARE_SK_STROKE_CAP |
42 } sk_stroke_cap_t; | 96 } sk_stroke_cap_t; |
43 | 97 |
98 /** | |
99 Return the paint's stroke cap type, controlling how the start and | |
100 end of stroked lines and paths are treated. | |
101 */ | |
44 SK_API sk_stroke_cap_t sk_paint_get_stroke_cap(const sk_paint_t*); | 102 SK_API sk_stroke_cap_t sk_paint_get_stroke_cap(const sk_paint_t*); |
103 /** | |
104 Set the paint's stroke cap type, controlling how the start and | |
105 end of stroked lines and paths are treated. | |
106 */ | |
45 SK_API void sk_paint_set_stroke_cap(sk_paint_t*, sk_stroke_cap_t); | 107 SK_API void sk_paint_set_stroke_cap(sk_paint_t*, sk_stroke_cap_t); |
46 | 108 |
47 typedef enum { | 109 typedef enum { |
48 MITER_SK_STROKE_JOIN, | 110 MITER_SK_STROKE_JOIN, |
49 ROUND_SK_STROKE_JOIN, | 111 ROUND_SK_STROKE_JOIN, |
50 BEVEL_SK_STROKE_JOIN | 112 BEVEL_SK_STROKE_JOIN |
51 } sk_stroke_join_t; | 113 } sk_stroke_join_t; |
52 | 114 |
115 /** | |
116 Return the paint's stroke join type, specifies the treatment that | |
117 is applied to corners in paths and rectangles | |
118 */ | |
53 SK_API sk_stroke_join_t sk_paint_get_stroke_join(const sk_paint_t*); | 119 SK_API sk_stroke_join_t sk_paint_get_stroke_join(const sk_paint_t*); |
120 /** | |
121 Set the paint's stroke join type, specifies the treatment that | |
122 is applied to corners in paths and rectangles | |
123 */ | |
54 SK_API void sk_paint_set_stroke_join(sk_paint_t*, sk_stroke_join_t); | 124 SK_API void sk_paint_set_stroke_join(sk_paint_t*, sk_stroke_join_t); |
55 | 125 |
56 /** | 126 /** |
57 * Set the paint's shader to the specified parameter. This will automatically c all unref() on | 127 * Set the paint's shader to the specified parameter. This will automatically c all unref() on |
58 * any previous value, and call ref() on the new value. | 128 * any previous value, and call ref() on the new value. |
59 */ | 129 */ |
60 SK_API void sk_paint_set_shader(sk_paint_t*, sk_shader_t*); | 130 SK_API void sk_paint_set_shader(sk_paint_t*, sk_shader_t*); |
61 | 131 |
62 /** | 132 /** |
63 * Set the paint's maskfilter to the specified parameter. This will automatical ly call unref() on | 133 * Set the paint's maskfilter to the specified parameter. This will automatical ly call unref() on |
64 * any previous value, and call ref() on the new value. | 134 * any previous value, and call ref() on the new value. |
65 */ | 135 */ |
66 SK_API void sk_paint_set_maskfilter(sk_paint_t*, sk_maskfilter_t*); | 136 SK_API void sk_paint_set_maskfilter(sk_paint_t*, sk_maskfilter_t*); |
67 | 137 |
68 /** | 138 /** |
69 * Set the paint's xfermode to the specified parameter. | 139 * Set the paint's xfermode to the specified parameter. |
70 */ | 140 */ |
71 SK_API void sk_paint_set_xfermode_mode(sk_paint_t*, sk_xfermode_mode_t); | 141 SK_API void sk_paint_set_xfermode_mode(sk_paint_t*, sk_xfermode_mode_t); |
72 | 142 |
73 SK_C_PLUS_PLUS_END_GUARD | 143 SK_C_PLUS_PLUS_END_GUARD |
74 | 144 |
75 #endif | 145 #endif |
OLD | NEW |