Chromium Code Reviews| Index: experimental/mojo/Skia.mojom |
| diff --git a/experimental/mojo/Skia.mojom b/experimental/mojo/Skia.mojom |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a74ab37493cd4c56dc2a296e53cf8355bb2bff5c |
| --- /dev/null |
| +++ b/experimental/mojo/Skia.mojom |
| @@ -0,0 +1,474 @@ |
| +// skia.mojom |
| + |
| +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
|
| + |
| +struct Picture { |
| + array<uint8> data; |
| + // array<CanvasCommand> commands; |
| +}; |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| + |
| +struct Paint { |
| + PathEffect path_effect; |
| + Shader shader; |
| + Xfermode xfermode; |
| + MaskFilter mask_filter; |
| + ColorFilter color_filter; |
| + Rasterizer rasterizer; |
| + DrawLooper looper; |
| + ImageFilter image_filter; |
| + uint32 color; |
| + float stroke_width; |
| + float stroke_miter_limit; |
| + uint32 flags; |
| +}; |
| + |
| +enum FillType { |
| + WINDING, |
| + EVEN_ODD, |
| + INVERSE_WINDING, |
| + INVERSE_EVEN_ODD, |
| +}; |
| + |
| +struct MovePathVerb { |
| + float end_x; |
| + float end_y; |
| +}; |
| + |
| +struct LinePathVerb { |
| + float end_x; |
| + float end_y; |
| +}; |
| + |
| +struct QuadPathVerb { |
| + float control_x; |
| + float control_y; |
| + float end_x; |
| + float end_y; |
| +}; |
| + |
| +struct ConicPathVerb { |
| + float control_x; |
| + float control_y; |
| + float end_x; |
| + float end_y; |
| + float weight; |
| +}; |
| + |
| +struct CubicPathVerb { |
| + float control_1_x; |
| + float control_1_y; |
| + float control_2_x; |
| + float control_2_y; |
| + float end_x; |
| + float end_y; |
| +}; |
| + |
| +struct ClosePathVerb {}; |
| + |
| +union PathVerb { |
| + MovePathVerb move; |
| + LinePathVerb line; |
| + QuadPathVerb quad; |
| + ConicPathVerb conic; |
| + CubicPathVerb cubic; |
| + ClosePathVerb close; |
| +}; |
| + |
| +struct Path { |
| + array<PathVerb> verbs; |
| +}; |
| + |
| +struct TextRun { |
| + float text_size; |
| + float text_scale_x; |
| + float text_skew_x; |
| + uint32 typeface; |
| + uint32 flags; |
| + float offset_x; |
| + float offset_y; |
| + |
| + array<uint16> glyphs; |
| + array<float> positions; |
| +}; |
| + |
| +struct TextBlob { |
| + array<TextRun> runs; |
| +}; |
| + |
| + |
| +struct PathEffect { string name; array<uint8> data; }; |
| +struct Shader { string name; array<uint8> data; }; |
| +struct Xfermode { string name; array<uint8> data; }; |
| +struct MaskFilter { string name; array<uint8> data; }; |
| +struct ColorFilter { string name; array<uint8> data; }; |
| +struct Rasterizer { string name; array<uint8> data; }; |
| +struct DrawLooper { string name; array<uint8> data; }; |
| +struct ImageFilter { string name; array<uint8> data; }; |
| + |
| +enum XfermodeMode { |
| + CLEAR, |
| + SRC, |
| + DST, |
| + SRC_OVER, |
| + DST_OVER, |
| + SRC_IN, |
| + DST_IN, |
| + SRC_OUT, |
| + DST_OUT, |
| + SRC_ATOP, |
| + DST_ATOP, |
| + XOR, |
| + PLUS, |
| + MODULATE, |
| + SCREEN, |
| + OVERLAY, |
| + DARKEN, |
| + LIGHTEN, |
| + COLOR_DODGE, |
| + COLOR_BURN, |
| + HARD_LIGHT, |
| + SOFT_LIGHT, |
| + DIFFERENCE, |
| + EXCLUSION, |
| + MULTIPLY, |
| + HUE, |
| + SATURATION, |
| + COLOR, |
| + LUMINOSITY, |
| +}; |
| + |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| + |
| +struct SaveCommand {}; |
| + |
| +struct RestoreCommand {}; |
| + |
| +struct SaveLayerCommand { |
| + float bounds_rect_left; |
| + float bounds_rect_top; |
| + float bounds_rect_right; |
| + float bounds_rect_bottom; |
| + Paint paint; |
| + ImageFilter backdrop; |
| + uint32 save_layer_flags; |
| +}; |
| + |
| +struct SetMatrixCommand { |
| + float matrix_scale_x; |
| + float matrix_skew_x; |
| + float matrix_trans_x; |
| + float matrix_skew_y; |
| + float matrix_scale_y; |
| + float matrix_trans_y; |
| + float matrix_persp_0; |
| + float matrix_persp_1; |
| + float matrix_persp_2; |
| +}; |
| + |
| +struct DrawOvalCommand { |
| + float oval_rect_left; |
| + float oval_rect_top; |
| + float oval_rect_right; |
| + float oval_rect_bottom; |
| + Paint paint; |
| +}; |
| + |
| +struct DrawRectCommand { |
| + float rect_left; |
| + float rect_top; |
| + float rect_right; |
| + float rect_bottom; |
| + Paint paint; |
| +}; |
| + |
| +struct DrawRoundRectCommand { |
| + 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
|
| + float round_rect_top; |
| + float round_rect_right; |
| + float round_rect_bottom; |
| + float round_rect_upper_left_x; |
| + float round_rect_upper_left_y; |
| + float round_rect_upper_right_x; |
| + float round_rect_upper_right_y; |
| + float round_rect_lower_right_x; |
| + float round_rect_lower_right_y; |
| + float round_rect_lower_left_x; |
| + float round_rect_lower_left_y; |
| + Paint paint; |
| +}; |
| + |
| +struct DrawPathCommand { |
| + uint32 path; |
| + Paint paint; |
| +}; |
| + |
| +struct DrawPaintCommand { |
| + Paint paint; |
| +}; |
| + |
| +enum PointMode { |
| + POINTS, |
| + LINES, |
| + POLYGON, |
| +}; |
| + |
| +struct DrawPointsCommand { |
| + PointMode point_mode; |
| + array<float> points; // x, y pairs |
| + Paint paint; |
| +}; |
| + |
| +struct DrawDrawableCommand { |
| + uint32 drawable; // fixme |
| + 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
|
| + float matrix_skew_x; |
| + float matrix_trans_x; |
| + float matrix_skew_y; |
| + float matrix_scale_y; |
| + float matrix_trans_y; |
| + float matrix_persp_0; |
| + float matrix_persp_1; |
| + float matrix_persp_2; |
| +}; |
| + |
| +struct DrawPictureCommand { |
| + uint32 picture; |
| + float matrix_scale_x; |
| + float matrix_skew_x; |
| + float matrix_trans_x; |
| + float matrix_skew_y; |
| + float matrix_scale_y; |
| + float matrix_trans_y; |
| + float matrix_persp_0; |
| + float matrix_persp_1; |
| + float matrix_persp_2; |
| + Paint paint; |
| +}; |
| + |
| +enum VertexMode { |
| + TRIANGLES, |
| + TRIANGLE_STRIP, |
| + TRIANGLE_FAN |
| +}; |
| + |
| +struct DrawVerticesCommand { |
| + VertexMode vertex_mode; |
| + array<float> vertices; |
| + array<float> texs; |
| + array<uint32> colors; |
| + Xfermode xfermode; |
| + array<uint16> indices; |
| + Paint paint; |
| +}; |
| + |
| +struct DrawPatchCommand { |
| + 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
|
| + float cubic_0_y; |
| + float cubic_1_x; |
| + float cubic_1_y; |
| + float cubic_2_x; |
| + float cubic_2_y; |
| + float cubic_3_x; |
| + float cubic_3_y; |
| + float cubic_4_x; |
| + float cubic_4_y; |
| + float cubic_5_x; |
| + float cubic_5_y; |
| + float cubic_6_x; |
| + float cubic_6_y; |
| + float cubic_7_x; |
| + float cubic_7_y; |
| + float cubic_8_x; |
| + float cubic_8_y; |
| + float cubic_9_x; |
| + float cubic_9_y; |
| + float cubic_10_x; |
| + float cubic_10_y; |
| + float cubic_11_x; |
| + float cubic_11_y; |
| + uint32 color_0; |
| + uint32 color_1; |
| + uint32 color_2; |
| + uint32 color_3; |
| + float tex_coords_0_x; |
| + float tex_coords_0_y; |
| + float tex_coords_1_x; |
| + float tex_coords_1_y; |
| + float tex_coords_2_x; |
| + float tex_coords_2_y; |
| + float tex_coords_3_x; |
| + float tex_coords_3_y; |
| + Xfermode xfermode; |
| + Paint paint; |
| +}; |
| + |
| +struct DrawAtlasCommand { |
| + uint32 image; |
| + array<float> rotation_and_scale_transforms; |
| + array<float> rects; |
| + array<uint32> colors; |
| + XfermodeMode mode; |
| + float cull_rect_left; |
| + float cull_rect_top; |
| + float cull_rect_right; |
| + float cull_rect_bottom; |
| + Paint paint; |
| +}; |
| + |
| +struct DrawImageCommand { |
| + uint32 image; |
| + float left; |
| + float top; |
| + Paint paint; |
| +}; |
| + |
| +enum SrcRectConstraint { |
| + STRICT, |
| + FAST, |
| +}; |
| + |
| +struct DrawImageRectCommand { |
| + uint32 image; |
| + float src_rect_left; |
| + float src_rect_top; |
| + float src_rect_right; |
| + float src_rect_bottom; |
| + float dst_rect_left; |
| + float dst_rect_top; |
| + float dst_rect_right; |
| + float dst_rect_bottom; |
| + Paint paint; |
| + SrcRectConstraint constraint; |
| +}; |
| +struct DrawImageNineCommand { |
| + uint32 image; |
| + int32 center_rect_left; |
| + int32 center_rect_top; |
| + int32 center_rect_right; |
| + int32 center_rect_bottom; |
| + float dst_rect_left; |
| + float dst_rect_top; |
| + float dst_rect_right; |
| + float dst_rect_bottom; |
| + Paint paint; |
| +}; |
| +struct DrawTextBlobCommand { |
| + uint32 text_blob; |
| + float x; |
| + float y; |
| + Paint paint; |
| +}; |
| + |
| +enum ClipEdgeStyle { |
| + HARD, |
| + SOFT |
| +}; |
| + |
| +enum RegionOp { |
| + DIFFERENCE, |
| + INTERSECT, |
| + UNION, |
| + XOR, |
| + REVERSE_DIFFERENCE, |
| + REPLACE, |
| +}; |
| + |
| +struct ClipRectCommand { |
| + float clip_rect_left; |
| + float clip_rect_top; |
| + float clip_rect_right; |
| + float clip_rect_bottom; |
| + RegionOp op; |
| + ClipEdgeStyle edge_style; |
| +}; |
| +struct ClipRoundRectCommand { |
| + float round_rect_left; |
| + float round_rect_top; |
| + float round_rect_right; |
| + float round_rect_bottom; |
| + float round_rect_upper_left_x; |
| + float round_rect_upper_left_y; |
| + float round_rect_upper_right_x; |
| + float round_rect_upper_right_y; |
| + float round_rect_lower_right_x; |
| + float round_rect_lower_right_y; |
| + float round_rect_lower_left_x; |
| + float round_rect_lower_left_y; |
| + RegionOp op; |
| + ClipEdgeStyle edge_style; |
| +}; |
| +struct ClipPathCommand { |
| + uint32 path; |
| + RegionOp op; |
| + ClipEdgeStyle edge_style; |
| +}; |
| +struct ClipRegionCommand { |
| + array<uint8> region; |
| + RegionOp op; |
| + ClipEdgeStyle edge_style; |
| +}; |
| + |
| +///////////////////// |
| + |
| +struct DefineTypeface { |
| + uint32 n; |
| + array<uint8> typeface_data; |
| +}; |
| + |
| +struct DefineImage { |
| + uint32 n; |
| + array<uint8> image_data; |
| +}; |
| + |
| +struct DefineTextBlob { |
| + uint32 n; |
| + TextBlob b; |
| +}; |
| + |
| +struct DefinePicture { |
| + uint32 n; |
| + Picture p; |
| +}; |
| + |
| +struct DefinePath { |
| + uint32 n; |
| + Path p; |
| +}; |
| + |
| +///////////////////// |
| +union CanvasCommand { |
| + 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
|
| + DefinePath define_path; |
| + DefinePicture define_picture; |
| + DefineTextBlob define_text_blob; |
| + DefineTypeface define_typeface; |
| + |
| + SaveCommand save; |
| + RestoreCommand restore; |
| + SaveLayerCommand save_layer; |
| + SetMatrixCommand set_matrix; |
| + |
| + ClipRectCommand clip_rect; |
| + ClipRoundRectCommand clip_round_rect; |
| + ClipPathCommand clip_path; |
| + ClipRegionCommand clip_region; |
| + |
| + DrawOvalCommand draw_oval; |
| + DrawRectCommand draw_rect; |
| + DrawRoundRectCommand draw_round_rect; |
| + DrawPathCommand draw_path; |
| + DrawPaintCommand draw_paint; |
| + DrawPointsCommand draw_points; |
| + DrawDrawableCommand draw_drawable; |
| + DrawPictureCommand draw_picture; |
| + DrawVerticesCommand draw_vertices; |
| + DrawPatchCommand draw_patch; |
| + DrawAtlasCommand draw_atlas; |
| + DrawImageCommand draw_image; |
| + DrawImageRectCommand draw_image_rect; |
| + DrawImageNineCommand draw_image_nine; |
| + DrawTextBlobCommand draw_text_blob; |
| +}; |