Skip to content

Commit

Permalink
Add bindings for CanvasTransform.setTransform(DOMMatrix2DInit) (#3580)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda authored Aug 29, 2023
1 parent 99983c8 commit 7e4f73e
Show file tree
Hide file tree
Showing 11 changed files with 601 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
* Add unstable bindings for the Prioritized Task Scheduling API.
[#3566](https://github.com/rustwasm/wasm-bindgen/pull/3566)

* Add bindings for `CanvasTransform.setTransform(DOMMatrix2DInit)`.
[#3580](https://github.com/rustwasm/wasm-bindgen/pull/3580)

### Changed

* Updated the WebGPU WebIDL.
Expand Down
2 changes: 2 additions & 0 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ DomError = []
DomException = []
DomImplementation = []
DomMatrix = ["DomMatrixReadOnly"]
DomMatrix2dInit = []
DomMatrixInit = []
DomMatrixReadOnly = []
DomParser = []
DomPoint = ["DomPointReadOnly"]
Expand Down
2 changes: 1 addition & 1 deletion crates/web-sys/src/features/gen_CanvasPattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ extern "C" {
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern/setTransform)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `SvgMatrix`*"]
pub fn set_transform(this: &CanvasPattern, matrix: &SvgMatrix);
pub fn set_transform_with_default_dom_matrix_2d_init(this: &CanvasPattern, matrix: &SvgMatrix);
}
20 changes: 20 additions & 0 deletions crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,26 @@ extern "C" {
e: f64,
f: f64,
) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = setTransform)]
#[doc = "The `setTransform()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setTransform)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"]
pub fn set_transform_with_default_dom_matrix_2d_init(
this: &CanvasRenderingContext2d,
) -> Result<(), JsValue>;
#[cfg(feature = "DomMatrix2dInit")]
# [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = setTransform)]
#[doc = "The `setTransform()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setTransform)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `DomMatrix2dInit`*"]
pub fn set_transform_with_dom_matrix_2d_init(
this: &CanvasRenderingContext2d,
transform: &DomMatrix2dInit,
) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = transform)]
#[doc = "The `transform()` method."]
#[doc = ""]
Expand Down
184 changes: 184 additions & 0 deletions crates/web-sys/src/features/gen_DomMatrix2dInit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
#![allow(unused_imports)]
#![allow(clippy::all)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = DOMMatrix2DInit)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `DomMatrix2dInit` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub type DomMatrix2dInit;
}
impl DomMatrix2dInit {
#[doc = "Construct a new `DomMatrix2dInit`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn new() -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret
}
#[doc = "Change the `a` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn a(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("a"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `b` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn b(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("b"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `c` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn c(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("c"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `d` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn d(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("d"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `e` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn e(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("e"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `f` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn f(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("f"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `m11` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn m11(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m11"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `m12` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn m12(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m12"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `m21` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn m21(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m21"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `m22` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn m22(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m22"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `m41` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn m41(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m41"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `m42` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"]
pub fn m42(&mut self, val: f64) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m42"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
}
impl Default for DomMatrix2dInit {
fn default() -> Self {
Self::new()
}
}
Loading

0 comments on commit 7e4f73e

Please sign in to comment.