mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Implement CanvasRenderingContext2D.getTransform()
This commit is contained in:
parent
6b2079e5b3
commit
588c09b580
16 changed files with 42 additions and 22 deletions
|
@ -16,6 +16,7 @@ use crate::dom::bindings::root::{Dom, DomRoot};
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle};
|
||||
use crate::dom::canvaspattern::CanvasPattern;
|
||||
use crate::dom::dommatrix::DOMMatrix;
|
||||
use crate::dom::element::cors_setting_for_element;
|
||||
use crate::dom::element::Element;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
|
@ -1415,6 +1416,15 @@ impl CanvasState {
|
|||
self.update_transform()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-gettransform
|
||||
pub fn get_transform(&self, global: &GlobalScope) -> DomRoot<DOMMatrix> {
|
||||
let (sender, receiver) = ipc::channel::<Transform2D<f32>>().unwrap();
|
||||
self.send_canvas_2d_msg(Canvas2dMsg::GetTransform(sender));
|
||||
let transform = receiver.recv().unwrap();
|
||||
|
||||
DOMMatrix::new(global, true, transform.cast::<f64>().to_3d())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-settransform
|
||||
pub fn set_transform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) {
|
||||
if !(a.is_finite() &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue