/* 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, CompositionOrBlending}; 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, bool), ArcTo(Point2D, Point2D, f32), DrawImage(Vec, Size2D, Rect, Rect, bool), DrawImageSelf(Size2D, Rect, Rect, bool), BeginPath, BezierCurveTo(Point2D, Point2D, Point2D), ClearRect(Rect), Clip, ClosePath, Fill, FillRect(Rect), GetImageData(Rect, Size2D, Sender>), LineTo(Point2D), MoveTo(Point2D), PutImageData(Vec, Rect, Option>), QuadraticCurveTo(Point2D, Point2D), Rect(Rect), RestoreContext, SaveContext, StrokeRect(Rect), Stroke, SetFillStyle(FillOrStrokeStyle), SetStrokeStyle(FillOrStrokeStyle), SetLineWidth(f32), SetLineCap(LineCapStyle), SetLineJoin(LineJoinStyle), SetMiterLimit(f32), SetGlobalAlpha(f32), SetGlobalComposition(CompositionOrBlending), SetTransform(Matrix2D), } #[derive(Clone)] pub enum CanvasWebGLMsg { AttachShader(u32, u32), BindBuffer(u32, u32), BufferData(u32, Vec, u32), Clear(u32), ClearColor(f32, f32, f32, f32), CompileShader(u32), CreateBuffer(Sender), CreateProgram(Sender), CreateShader(u32, Sender), DrawArrays(u32, i32, i32), EnableVertexAttribArray(u32), GetAttribLocation(u32, String, Sender), GetShaderInfoLog(u32, Sender), GetShaderParameter(u32, u32, Sender), GetUniformLocation(u32, String, Sender), LinkProgram(u32), ShaderSource(u32, Vec), Uniform4fv(u32, Vec), UseProgram(u32), VertexAttribPointer2f(u32, i32, bool, i32, i64), Viewport(i32, i32, i32, i32), } #[derive(Clone)] pub enum CanvasCommonMsg { Close, Recreate(Size2D), SendPixelContents(Sender>), }