Skip to content

Commit 5ba4629

Browse files
A6GibKmbilelmoussaoui
authored andcommitted
Generate Copy, Paste and Composite node bindings
1 parent edf0e41 commit 5ba4629

File tree

9 files changed

+217
-0
lines changed

9 files changed

+217
-0
lines changed

gsk4/Gir.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ generate = [
2222
"Gsk.ColorNode",
2323
"Gsk.ComponentTransfer",
2424
"Gsk.ConicGradientNode",
25+
"Gsk.CopyNode",
2526
"Gsk.Corner",
2627
"Gsk.CrossFadeNode",
2728
"Gsk.DebugNode",
@@ -37,6 +38,7 @@ generate = [
3738
"Gsk.MaskNode",
3839
"Gsk.OpacityNode",
3940
"Gsk.OutsetShadowNode",
41+
"Gsk.PasteNode",
4042
"Gsk.PathDirection",
4143
"Gsk.PathForeachFlags",
4244
"Gsk.PathIntersection",
@@ -125,6 +127,12 @@ status = "generate"
125127
# See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/8880
126128
version = "4.20"
127129

130+
[[object]]
131+
status = "generate"
132+
name = "Gsk.CompositeNode"
133+
# See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/9197
134+
version = "4.22"
135+
128136
[[object]]
129137
name = "Gsk.ContainerNode"
130138
status = "generate"

gsk4/src/auto/composite_node.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// This file was generated by gir (https://github.com/gtk-rs/gir)
2+
// from gir-files (https://github.com/gtk-rs/gir-files)
3+
// DO NOT EDIT
4+
5+
use crate::{ffi, PorterDuff, RenderNode};
6+
use glib::{prelude::*, translate::*};
7+
8+
glib::wrapper! {
9+
#[doc(alias = "GskCompositeNode")]
10+
pub struct CompositeNode(Shared<ffi::GskCompositeNode>);
11+
12+
match fn {
13+
ref => |ptr| ffi::gsk_render_node_ref(ptr as *mut ffi::GskRenderNode),
14+
unref => |ptr| ffi::gsk_render_node_unref(ptr as *mut ffi::GskRenderNode),
15+
}
16+
}
17+
18+
impl StaticType for CompositeNode {
19+
fn static_type() -> glib::Type {
20+
unsafe { from_glib(ffi::gsk_composite_node_get_type()) }
21+
}
22+
}
23+
24+
impl CompositeNode {
25+
#[doc(alias = "gsk_composite_node_new")]
26+
pub fn new(
27+
child: impl AsRef<RenderNode>,
28+
mask: impl AsRef<RenderNode>,
29+
op: PorterDuff,
30+
) -> CompositeNode {
31+
skip_assert_initialized!();
32+
unsafe {
33+
from_glib_full(ffi::gsk_composite_node_new(
34+
child.as_ref().to_glib_none().0,
35+
mask.as_ref().to_glib_none().0,
36+
op.into_glib(),
37+
))
38+
}
39+
}
40+
41+
#[doc(alias = "gsk_composite_node_get_child")]
42+
#[doc(alias = "get_child")]
43+
pub fn child(&self) -> RenderNode {
44+
unsafe { from_glib_none(ffi::gsk_composite_node_get_child(self.to_glib_none().0)) }
45+
}
46+
47+
#[doc(alias = "gsk_composite_node_get_mask")]
48+
#[doc(alias = "get_mask")]
49+
pub fn mask(&self) -> RenderNode {
50+
unsafe { from_glib_none(ffi::gsk_composite_node_get_mask(self.to_glib_none().0)) }
51+
}
52+
53+
#[doc(alias = "gsk_composite_node_get_operator")]
54+
#[doc(alias = "get_operator")]
55+
pub fn operator(&self) -> PorterDuff {
56+
unsafe { from_glib(ffi::gsk_composite_node_get_operator(self.to_glib_none().0)) }
57+
}
58+
}

gsk4/src/auto/copy_node.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// This file was generated by gir (https://github.com/gtk-rs/gir)
2+
// from gir-files (https://github.com/gtk-rs/gir-files)
3+
// DO NOT EDIT
4+
5+
use crate::{ffi, RenderNode};
6+
use glib::{prelude::*, translate::*};
7+
8+
glib::wrapper! {
9+
#[doc(alias = "GskCopyNode")]
10+
pub struct CopyNode(Shared<ffi::GskCopyNode>);
11+
12+
match fn {
13+
ref => |ptr| ffi::gsk_render_node_ref(ptr as *mut ffi::GskRenderNode),
14+
unref => |ptr| ffi::gsk_render_node_unref(ptr as *mut ffi::GskRenderNode),
15+
}
16+
}
17+
18+
impl StaticType for CopyNode {
19+
fn static_type() -> glib::Type {
20+
unsafe { from_glib(ffi::gsk_copy_node_get_type()) }
21+
}
22+
}
23+
24+
impl CopyNode {
25+
#[doc(alias = "gsk_copy_node_new")]
26+
pub fn new(child: impl AsRef<RenderNode>) -> CopyNode {
27+
skip_assert_initialized!();
28+
unsafe { from_glib_full(ffi::gsk_copy_node_new(child.as_ref().to_glib_none().0)) }
29+
}
30+
31+
#[doc(alias = "gsk_copy_node_get_child")]
32+
#[doc(alias = "get_child")]
33+
pub fn child(&self) -> RenderNode {
34+
unsafe { from_glib_none(ffi::gsk_copy_node_get_child(self.to_glib_none().0)) }
35+
}
36+
}

gsk4/src/auto/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,26 @@ mod component_transfer_node;
4040
#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
4141
pub use self::component_transfer_node::ComponentTransferNode;
4242

43+
#[cfg(feature = "v4_22")]
44+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
45+
mod composite_node;
46+
#[cfg(feature = "v4_22")]
47+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
48+
pub use self::composite_node::CompositeNode;
49+
4350
mod conic_gradient_node;
4451
pub use self::conic_gradient_node::ConicGradientNode;
4552

4653
mod container_node;
4754
pub use self::container_node::ContainerNode;
4855

56+
#[cfg(feature = "v4_22")]
57+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
58+
mod copy_node;
59+
#[cfg(feature = "v4_22")]
60+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
61+
pub use self::copy_node::CopyNode;
62+
4963
mod cross_fade_node;
5064
pub use self::cross_fade_node::CrossFadeNode;
5165

@@ -93,6 +107,13 @@ pub use self::opacity_node::OpacityNode;
93107
mod outset_shadow_node;
94108
pub use self::outset_shadow_node::OutsetShadowNode;
95109

110+
#[cfg(feature = "v4_22")]
111+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
112+
mod paste_node;
113+
#[cfg(feature = "v4_22")]
114+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
115+
pub use self::paste_node::PasteNode;
116+
96117
mod radial_gradient_node;
97118
pub use self::radial_gradient_node::RadialGradientNode;
98119

gsk4/src/auto/paste_node.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// This file was generated by gir (https://github.com/gtk-rs/gir)
2+
// from gir-files (https://github.com/gtk-rs/gir-files)
3+
// DO NOT EDIT
4+
5+
use crate::ffi;
6+
use glib::{prelude::*, translate::*};
7+
8+
glib::wrapper! {
9+
#[doc(alias = "GskPasteNode")]
10+
pub struct PasteNode(Shared<ffi::GskPasteNode>);
11+
12+
match fn {
13+
ref => |ptr| ffi::gsk_render_node_ref(ptr as *mut ffi::GskRenderNode),
14+
unref => |ptr| ffi::gsk_render_node_unref(ptr as *mut ffi::GskRenderNode),
15+
}
16+
}
17+
18+
impl StaticType for PasteNode {
19+
fn static_type() -> glib::Type {
20+
unsafe { from_glib(ffi::gsk_paste_node_get_type()) }
21+
}
22+
}
23+
24+
impl PasteNode {
25+
#[doc(alias = "gsk_paste_node_new")]
26+
pub fn new(bounds: &graphene::Rect, depth: usize) -> PasteNode {
27+
assert_initialized_main_thread!();
28+
unsafe { from_glib_full(ffi::gsk_paste_node_new(bounds.to_glib_none().0, depth)) }
29+
}
30+
31+
#[doc(alias = "gsk_paste_node_get_depth")]
32+
#[doc(alias = "get_depth")]
33+
pub fn depth(&self) -> usize {
34+
unsafe { ffi::gsk_paste_node_get_depth(self.to_glib_none().0) }
35+
}
36+
}

gsk4/src/composite_node.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Take a look at the license at the top of the repository in the LICENSE file.
2+
3+
use crate::{CompositeNode, RenderNodeType};
4+
5+
define_render_node!(
6+
CompositeNode,
7+
crate::ffi::GskCompositeNode,
8+
RenderNodeType::CompositeNode
9+
);
10+
11+
impl std::fmt::Debug for CompositeNode {
12+
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
13+
f.debug_struct("CompositeNode")
14+
.field("child", &self.child())
15+
.field("mask", &self.mask())
16+
.field("operator", &self.operator())
17+
.finish()
18+
}
19+
}

gsk4/src/copy_node.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Take a look at the license at the top of the repository in the LICENSE file.
2+
3+
use crate::{CopyNode, RenderNodeType};
4+
5+
define_render_node!(CopyNode, crate::ffi::GskCopyNode, RenderNodeType::CopyNode);
6+
7+
impl std::fmt::Debug for CopyNode {
8+
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
9+
f.debug_struct("CopyNode")
10+
.field("child", &self.child())
11+
.finish()
12+
}
13+
}

gsk4/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,14 @@ mod clip_node;
4545
mod color_matrix_node;
4646
mod color_node;
4747
mod color_stop;
48+
#[cfg(feature = "v4_22")]
49+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
50+
mod composite_node;
4851
mod conic_gradient_node;
4952
mod container_node;
53+
#[cfg(feature = "v4_22")]
54+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
55+
mod copy_node;
5056
mod cross_fade_node;
5157
mod debug_node;
5258
#[cfg(feature = "v4_14")]
@@ -65,6 +71,9 @@ mod ngl_renderer;
6571
mod opacity_node;
6672
mod outset_shadow_node;
6773
mod parse_location;
74+
#[cfg(feature = "v4_22")]
75+
#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
76+
mod paste_node;
6877
#[cfg(feature = "v4_14")]
6978
#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
7079
mod path;

gsk4/src/paste_node.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Take a look at the license at the top of the repository in the LICENSE file.
2+
3+
use crate::{PasteNode, RenderNodeType};
4+
5+
define_render_node!(
6+
PasteNode,
7+
crate::ffi::GskPasteNode,
8+
RenderNodeType::PasteNode
9+
);
10+
11+
impl std::fmt::Debug for PasteNode {
12+
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
13+
f.debug_struct("PasteNode")
14+
.field("depth", &self.depth())
15+
.finish()
16+
}
17+
}

0 commit comments

Comments
 (0)