aboutsummaryrefslogtreecommitdiffstats
path: root/components/canvas/canvas_msg.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/canvas/canvas_msg.rs')
-rw-r--r--components/canvas/canvas_msg.rs62
1 files changed, 62 insertions, 0 deletions
diff --git a/components/canvas/canvas_msg.rs b/components/canvas/canvas_msg.rs
new file mode 100644
index 00000000000..86e1dcc6f81
--- /dev/null
+++ b/components/canvas/canvas_msg.rs
@@ -0,0 +1,62 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use canvas_paint_task::{FillOrStrokeStyle, LineCapStyle, LineJoinStyle};
+use geom::matrix2d::Matrix2D;
+use geom::point::Point2D;
+use geom::rect::Rect;
+use geom::size::Size2D;
+use std::sync::mpsc::{Sender};
+
+#[derive(Clone)]
+pub enum CanvasMsg {
+ Canvas2d(Canvas2dMsg),
+ Common(CanvasCommonMsg),
+ WebGL(CanvasWebGLMsg),
+}
+
+#[derive(Clone)]
+pub enum Canvas2dMsg {
+ Arc(Point2D<f32>, f32, f32, f32, bool),
+ ArcTo(Point2D<f32>, Point2D<f32>, f32),
+ DrawImage(Vec<u8>, Size2D<f64>, Rect<f64>, Rect<f64>, bool),
+ DrawImageSelf(Size2D<f64>, Rect<f64>, Rect<f64>, bool),
+ BeginPath,
+ BezierCurveTo(Point2D<f32>, Point2D<f32>, Point2D<f32>),
+ ClosePath,
+ ClearRect(Rect<f32>),
+ Fill,
+ FillRect(Rect<f32>),
+ GetImageData(Rect<f64>, Size2D<f64>, Sender<Vec<u8>>),
+ LineTo(Point2D<f32>),
+ MoveTo(Point2D<f32>),
+ PutImageData(Vec<u8>, Rect<f64>, Option<Rect<f64>>),
+ QuadraticCurveTo(Point2D<f32>, Point2D<f32>),
+ Rect(Rect<f32>),
+ RestoreContext,
+ SaveContext,
+ StrokeRect(Rect<f32>),
+ Stroke,
+ SetFillStyle(FillOrStrokeStyle),
+ SetStrokeStyle(FillOrStrokeStyle),
+ SetLineWidth(f32),
+ SetLineCap(LineCapStyle),
+ SetLineJoin(LineJoinStyle),
+ SetMiterLimit(f32),
+ SetGlobalAlpha(f32),
+ SetTransform(Matrix2D<f32>),
+}
+
+#[derive(Clone)]
+pub enum CanvasWebGLMsg {
+ Clear(u32),
+ ClearColor(f32, f32, f32, f32),
+}
+
+#[derive(Clone)]
+pub enum CanvasCommonMsg {
+ Close,
+ Recreate(Size2D<i32>),
+ SendPixelContents(Sender<Vec<u8>>),
+}