OLD | NEW |
---|---|
(Empty) | |
1 // skia.mojom | |
2 | |
3 module SkiaMojo; | |
mtklein
2016/01/29 01:07:38
SkMojo seems like it'll fit well in the rest of ou
hal.canary
2016/01/29 17:58:30
done
| |
4 | |
5 struct Picture { | |
6 array<uint8> data; | |
7 // array<CanvasCommand> commands; | |
8 }; | |
9 | |
10 //////////////////////////////////////////////////////////////////////////////// | |
11 | |
12 struct Paint { | |
13 PathEffect path_effect; | |
14 Shader shader; | |
15 Xfermode xfermode; | |
16 MaskFilter mask_filter; | |
17 ColorFilter color_filter; | |
18 Rasterizer rasterizer; | |
19 DrawLooper looper; | |
20 ImageFilter image_filter; | |
21 uint32 color; | |
22 float stroke_width; | |
23 float stroke_miter_limit; | |
24 uint32 flags; | |
25 }; | |
26 | |
27 enum FillType { | |
28 WINDING, | |
29 EVEN_ODD, | |
30 INVERSE_WINDING, | |
31 INVERSE_EVEN_ODD, | |
32 }; | |
33 | |
34 struct MovePathVerb { | |
35 float end_x; | |
36 float end_y; | |
37 }; | |
38 | |
39 struct LinePathVerb { | |
40 float end_x; | |
41 float end_y; | |
42 }; | |
43 | |
44 struct QuadPathVerb { | |
45 float control_x; | |
46 float control_y; | |
47 float end_x; | |
48 float end_y; | |
49 }; | |
50 | |
51 struct ConicPathVerb { | |
52 float control_x; | |
53 float control_y; | |
54 float end_x; | |
55 float end_y; | |
56 float weight; | |
57 }; | |
58 | |
59 struct CubicPathVerb { | |
60 float control_1_x; | |
61 float control_1_y; | |
62 float control_2_x; | |
63 float control_2_y; | |
64 float end_x; | |
65 float end_y; | |
66 }; | |
67 | |
68 struct ClosePathVerb {}; | |
69 | |
70 union PathVerb { | |
71 MovePathVerb move; | |
72 LinePathVerb line; | |
73 QuadPathVerb quad; | |
74 ConicPathVerb conic; | |
75 CubicPathVerb cubic; | |
76 ClosePathVerb close; | |
77 }; | |
78 | |
79 struct Path { | |
80 array<PathVerb> verbs; | |
81 }; | |
82 | |
83 struct TextRun { | |
84 float text_size; | |
85 float text_scale_x; | |
86 float text_skew_x; | |
87 uint32 typeface; | |
88 uint32 flags; | |
89 float offset_x; | |
90 float offset_y; | |
91 | |
92 array<uint16> glyphs; | |
93 array<float> positions; | |
94 }; | |
95 | |
96 struct TextBlob { | |
97 array<TextRun> runs; | |
98 }; | |
99 | |
100 | |
101 struct PathEffect { string name; array<uint8> data; }; | |
102 struct Shader { string name; array<uint8> data; }; | |
103 struct Xfermode { string name; array<uint8> data; }; | |
104 struct MaskFilter { string name; array<uint8> data; }; | |
105 struct ColorFilter { string name; array<uint8> data; }; | |
106 struct Rasterizer { string name; array<uint8> data; }; | |
107 struct DrawLooper { string name; array<uint8> data; }; | |
108 struct ImageFilter { string name; array<uint8> data; }; | |
109 | |
110 enum XfermodeMode { | |
111 CLEAR, | |
112 SRC, | |
113 DST, | |
114 SRC_OVER, | |
115 DST_OVER, | |
116 SRC_IN, | |
117 DST_IN, | |
118 SRC_OUT, | |
119 DST_OUT, | |
120 SRC_ATOP, | |
121 DST_ATOP, | |
122 XOR, | |
123 PLUS, | |
124 MODULATE, | |
125 SCREEN, | |
126 OVERLAY, | |
127 DARKEN, | |
128 LIGHTEN, | |
129 COLOR_DODGE, | |
130 COLOR_BURN, | |
131 HARD_LIGHT, | |
132 SOFT_LIGHT, | |
133 DIFFERENCE, | |
134 EXCLUSION, | |
135 MULTIPLY, | |
136 HUE, | |
137 SATURATION, | |
138 COLOR, | |
139 LUMINOSITY, | |
140 }; | |
141 | |
142 | |
143 //////////////////////////////////////////////////////////////////////////////// | |
144 | |
145 struct SaveCommand {}; | |
146 | |
147 struct RestoreCommand {}; | |
148 | |
149 struct SaveLayerCommand { | |
150 float bounds_rect_left; | |
151 float bounds_rect_top; | |
152 float bounds_rect_right; | |
153 float bounds_rect_bottom; | |
154 Paint paint; | |
155 ImageFilter backdrop; | |
156 uint32 save_layer_flags; | |
157 }; | |
158 | |
159 struct SetMatrixCommand { | |
160 float matrix_scale_x; | |
161 float matrix_skew_x; | |
162 float matrix_trans_x; | |
163 float matrix_skew_y; | |
164 float matrix_scale_y; | |
165 float matrix_trans_y; | |
166 float matrix_persp_0; | |
167 float matrix_persp_1; | |
168 float matrix_persp_2; | |
169 }; | |
170 | |
171 struct DrawOvalCommand { | |
172 float oval_rect_left; | |
173 float oval_rect_top; | |
174 float oval_rect_right; | |
175 float oval_rect_bottom; | |
176 Paint paint; | |
177 }; | |
178 | |
179 struct DrawRectCommand { | |
180 float rect_left; | |
181 float rect_top; | |
182 float rect_right; | |
183 float rect_bottom; | |
184 Paint paint; | |
185 }; | |
186 | |
187 struct DrawRoundRectCommand { | |
188 float round_rect_left; | |
mtklein
2016/01/29 01:07:38
It'd be nice to read
Rect rect;
Corner ul;
Corner
hal.canary
2016/01/29 17:58:30
code deleted for now. I'll add it as I can test i
| |
189 float round_rect_top; | |
190 float round_rect_right; | |
191 float round_rect_bottom; | |
192 float round_rect_upper_left_x; | |
193 float round_rect_upper_left_y; | |
194 float round_rect_upper_right_x; | |
195 float round_rect_upper_right_y; | |
196 float round_rect_lower_right_x; | |
197 float round_rect_lower_right_y; | |
198 float round_rect_lower_left_x; | |
199 float round_rect_lower_left_y; | |
200 Paint paint; | |
201 }; | |
202 | |
203 struct DrawPathCommand { | |
204 uint32 path; | |
205 Paint paint; | |
206 }; | |
207 | |
208 struct DrawPaintCommand { | |
209 Paint paint; | |
210 }; | |
211 | |
212 enum PointMode { | |
213 POINTS, | |
214 LINES, | |
215 POLYGON, | |
216 }; | |
217 | |
218 struct DrawPointsCommand { | |
219 PointMode point_mode; | |
220 array<float> points; // x, y pairs | |
221 Paint paint; | |
222 }; | |
223 | |
224 struct DrawDrawableCommand { | |
225 uint32 drawable; // fixme | |
226 float matrix_scale_x; | |
mtklein
2016/01/29 01:07:38
Yes let's definitely factor. At least Rect and Ma
hal.canary
2016/01/29 17:58:30
code deleted for now. I'll add it as I can test i
| |
227 float matrix_skew_x; | |
228 float matrix_trans_x; | |
229 float matrix_skew_y; | |
230 float matrix_scale_y; | |
231 float matrix_trans_y; | |
232 float matrix_persp_0; | |
233 float matrix_persp_1; | |
234 float matrix_persp_2; | |
235 }; | |
236 | |
237 struct DrawPictureCommand { | |
238 uint32 picture; | |
239 float matrix_scale_x; | |
240 float matrix_skew_x; | |
241 float matrix_trans_x; | |
242 float matrix_skew_y; | |
243 float matrix_scale_y; | |
244 float matrix_trans_y; | |
245 float matrix_persp_0; | |
246 float matrix_persp_1; | |
247 float matrix_persp_2; | |
248 Paint paint; | |
249 }; | |
250 | |
251 enum VertexMode { | |
252 TRIANGLES, | |
253 TRIANGLE_STRIP, | |
254 TRIANGLE_FAN | |
255 }; | |
256 | |
257 struct DrawVerticesCommand { | |
258 VertexMode vertex_mode; | |
259 array<float> vertices; | |
260 array<float> texs; | |
261 array<uint32> colors; | |
262 Xfermode xfermode; | |
263 array<uint16> indices; | |
264 Paint paint; | |
265 }; | |
266 | |
267 struct DrawPatchCommand { | |
268 float cubic_0_x; | |
mtklein
2016/01/29 01:07:38
Is this 3 coefficients for 4 cubics, no? Let's ma
hal.canary
2016/01/29 17:58:30
code deleted for now. I'll add it as I can test i
| |
269 float cubic_0_y; | |
270 float cubic_1_x; | |
271 float cubic_1_y; | |
272 float cubic_2_x; | |
273 float cubic_2_y; | |
274 float cubic_3_x; | |
275 float cubic_3_y; | |
276 float cubic_4_x; | |
277 float cubic_4_y; | |
278 float cubic_5_x; | |
279 float cubic_5_y; | |
280 float cubic_6_x; | |
281 float cubic_6_y; | |
282 float cubic_7_x; | |
283 float cubic_7_y; | |
284 float cubic_8_x; | |
285 float cubic_8_y; | |
286 float cubic_9_x; | |
287 float cubic_9_y; | |
288 float cubic_10_x; | |
289 float cubic_10_y; | |
290 float cubic_11_x; | |
291 float cubic_11_y; | |
292 uint32 color_0; | |
293 uint32 color_1; | |
294 uint32 color_2; | |
295 uint32 color_3; | |
296 float tex_coords_0_x; | |
297 float tex_coords_0_y; | |
298 float tex_coords_1_x; | |
299 float tex_coords_1_y; | |
300 float tex_coords_2_x; | |
301 float tex_coords_2_y; | |
302 float tex_coords_3_x; | |
303 float tex_coords_3_y; | |
304 Xfermode xfermode; | |
305 Paint paint; | |
306 }; | |
307 | |
308 struct DrawAtlasCommand { | |
309 uint32 image; | |
310 array<float> rotation_and_scale_transforms; | |
311 array<float> rects; | |
312 array<uint32> colors; | |
313 XfermodeMode mode; | |
314 float cull_rect_left; | |
315 float cull_rect_top; | |
316 float cull_rect_right; | |
317 float cull_rect_bottom; | |
318 Paint paint; | |
319 }; | |
320 | |
321 struct DrawImageCommand { | |
322 uint32 image; | |
323 float left; | |
324 float top; | |
325 Paint paint; | |
326 }; | |
327 | |
328 enum SrcRectConstraint { | |
329 STRICT, | |
330 FAST, | |
331 }; | |
332 | |
333 struct DrawImageRectCommand { | |
334 uint32 image; | |
335 float src_rect_left; | |
336 float src_rect_top; | |
337 float src_rect_right; | |
338 float src_rect_bottom; | |
339 float dst_rect_left; | |
340 float dst_rect_top; | |
341 float dst_rect_right; | |
342 float dst_rect_bottom; | |
343 Paint paint; | |
344 SrcRectConstraint constraint; | |
345 }; | |
346 struct DrawImageNineCommand { | |
347 uint32 image; | |
348 int32 center_rect_left; | |
349 int32 center_rect_top; | |
350 int32 center_rect_right; | |
351 int32 center_rect_bottom; | |
352 float dst_rect_left; | |
353 float dst_rect_top; | |
354 float dst_rect_right; | |
355 float dst_rect_bottom; | |
356 Paint paint; | |
357 }; | |
358 struct DrawTextBlobCommand { | |
359 uint32 text_blob; | |
360 float x; | |
361 float y; | |
362 Paint paint; | |
363 }; | |
364 | |
365 enum ClipEdgeStyle { | |
366 HARD, | |
367 SOFT | |
368 }; | |
369 | |
370 enum RegionOp { | |
371 DIFFERENCE, | |
372 INTERSECT, | |
373 UNION, | |
374 XOR, | |
375 REVERSE_DIFFERENCE, | |
376 REPLACE, | |
377 }; | |
378 | |
379 struct ClipRectCommand { | |
380 float clip_rect_left; | |
381 float clip_rect_top; | |
382 float clip_rect_right; | |
383 float clip_rect_bottom; | |
384 RegionOp op; | |
385 ClipEdgeStyle edge_style; | |
386 }; | |
387 struct ClipRoundRectCommand { | |
388 float round_rect_left; | |
389 float round_rect_top; | |
390 float round_rect_right; | |
391 float round_rect_bottom; | |
392 float round_rect_upper_left_x; | |
393 float round_rect_upper_left_y; | |
394 float round_rect_upper_right_x; | |
395 float round_rect_upper_right_y; | |
396 float round_rect_lower_right_x; | |
397 float round_rect_lower_right_y; | |
398 float round_rect_lower_left_x; | |
399 float round_rect_lower_left_y; | |
400 RegionOp op; | |
401 ClipEdgeStyle edge_style; | |
402 }; | |
403 struct ClipPathCommand { | |
404 uint32 path; | |
405 RegionOp op; | |
406 ClipEdgeStyle edge_style; | |
407 }; | |
408 struct ClipRegionCommand { | |
409 array<uint8> region; | |
410 RegionOp op; | |
411 ClipEdgeStyle edge_style; | |
412 }; | |
413 | |
414 ///////////////////// | |
415 | |
416 struct DefineTypeface { | |
417 uint32 n; | |
418 array<uint8> typeface_data; | |
419 }; | |
420 | |
421 struct DefineImage { | |
422 uint32 n; | |
423 array<uint8> image_data; | |
424 }; | |
425 | |
426 struct DefineTextBlob { | |
427 uint32 n; | |
428 TextBlob b; | |
429 }; | |
430 | |
431 struct DefinePicture { | |
432 uint32 n; | |
433 Picture p; | |
434 }; | |
435 | |
436 struct DefinePath { | |
437 uint32 n; | |
438 Path p; | |
439 }; | |
440 | |
441 ///////////////////// | |
442 union CanvasCommand { | |
443 DefineImage define_image; | |
mtklein
2016/01/29 01:07:38
Let's hold off on anything Canvas doesn't actually
hal.canary
2016/01/29 17:58:30
code deleted for now. I'll add it as I can test i
| |
444 DefinePath define_path; | |
445 DefinePicture define_picture; | |
446 DefineTextBlob define_text_blob; | |
447 DefineTypeface define_typeface; | |
448 | |
449 SaveCommand save; | |
450 RestoreCommand restore; | |
451 SaveLayerCommand save_layer; | |
452 SetMatrixCommand set_matrix; | |
453 | |
454 ClipRectCommand clip_rect; | |
455 ClipRoundRectCommand clip_round_rect; | |
456 ClipPathCommand clip_path; | |
457 ClipRegionCommand clip_region; | |
458 | |
459 DrawOvalCommand draw_oval; | |
460 DrawRectCommand draw_rect; | |
461 DrawRoundRectCommand draw_round_rect; | |
462 DrawPathCommand draw_path; | |
463 DrawPaintCommand draw_paint; | |
464 DrawPointsCommand draw_points; | |
465 DrawDrawableCommand draw_drawable; | |
466 DrawPictureCommand draw_picture; | |
467 DrawVerticesCommand draw_vertices; | |
468 DrawPatchCommand draw_patch; | |
469 DrawAtlasCommand draw_atlas; | |
470 DrawImageCommand draw_image; | |
471 DrawImageRectCommand draw_image_rect; | |
472 DrawImageNineCommand draw_image_nine; | |
473 DrawTextBlobCommand draw_text_blob; | |
474 }; | |
OLD | NEW |