mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
examples: Change cairo-compositor example to use ParamSpec builders
This commit is contained in:
parent
8d982d8b51
commit
099ffdc4b4
1 changed files with 40 additions and 54 deletions
|
@ -62,15 +62,11 @@ mod cairo_compositor {
|
||||||
// composition.
|
// composition.
|
||||||
fn properties() -> &'static [glib::ParamSpec] {
|
fn properties() -> &'static [glib::ParamSpec] {
|
||||||
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
||||||
vec![glib::ParamSpecUInt::new(
|
vec![glib::ParamSpecUInt::builder("background-color")
|
||||||
"background-color",
|
.nick("Background Color")
|
||||||
"Background Color",
|
.blurb("Background color as 0xRRGGBB")
|
||||||
"Background color as 0xRRGGBB",
|
.default_value(Settings::default().background_color)
|
||||||
0,
|
.build()]
|
||||||
u32::MAX,
|
|
||||||
Settings::default().background_color,
|
|
||||||
glib::ParamFlags::READWRITE,
|
|
||||||
)]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
&*PROPERTIES
|
&*PROPERTIES
|
||||||
|
@ -484,51 +480,41 @@ mod cairo_compositor {
|
||||||
fn properties() -> &'static [glib::ParamSpec] {
|
fn properties() -> &'static [glib::ParamSpec] {
|
||||||
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
||||||
vec![
|
vec![
|
||||||
glib::ParamSpecDouble::new(
|
glib::ParamSpecDouble::builder("alpha")
|
||||||
"alpha",
|
.nick("Alpha")
|
||||||
"Alpha",
|
.blurb("Alpha value of the input")
|
||||||
"Alpha value of the input",
|
.minimum(0.0)
|
||||||
0.0,
|
.maximum(1.0)
|
||||||
1.0,
|
.default_value(Settings::default().alpha)
|
||||||
Settings::default().alpha,
|
.build(),
|
||||||
glib::ParamFlags::READWRITE,
|
glib::ParamSpecDouble::builder("scale")
|
||||||
),
|
.nick("Scale")
|
||||||
glib::ParamSpecDouble::new(
|
.blurb("Scale factor of the input")
|
||||||
"scale",
|
.minimum(0.0)
|
||||||
"Scale",
|
.maximum(f64::MAX)
|
||||||
"Scale factor of the input",
|
.default_value(Settings::default().scale)
|
||||||
0.0,
|
.build(),
|
||||||
f64::MAX,
|
glib::ParamSpecDouble::builder("rotate")
|
||||||
Settings::default().scale,
|
.nick("Rotate")
|
||||||
glib::ParamFlags::READWRITE,
|
.blurb("Rotation of the input")
|
||||||
),
|
.minimum(0.0)
|
||||||
glib::ParamSpecDouble::new(
|
.maximum(360.0)
|
||||||
"rotate",
|
.default_value(Settings::default().rotate)
|
||||||
"Rotate",
|
.build(),
|
||||||
"Rotation of the input",
|
glib::ParamSpecDouble::builder("xpos")
|
||||||
0.0,
|
.nick("X Position")
|
||||||
360.0,
|
.blurb("Horizontal position of the input")
|
||||||
Settings::default().rotate,
|
.minimum(0.0)
|
||||||
glib::ParamFlags::READWRITE,
|
.maximum(f64::MAX)
|
||||||
),
|
.default_value(Settings::default().xpos)
|
||||||
glib::ParamSpecDouble::new(
|
.build(),
|
||||||
"xpos",
|
glib::ParamSpecDouble::builder("ypos")
|
||||||
"X Position",
|
.nick("Y Position")
|
||||||
"Horizontal position of the input",
|
.blurb("Vertical position of the input")
|
||||||
0.0,
|
.minimum(0.0)
|
||||||
f64::MAX,
|
.maximum(f64::MAX)
|
||||||
Settings::default().xpos,
|
.default_value(Settings::default().ypos)
|
||||||
glib::ParamFlags::READWRITE,
|
.build(),
|
||||||
),
|
|
||||||
glib::ParamSpecDouble::new(
|
|
||||||
"ypos",
|
|
||||||
"Y Position",
|
|
||||||
"Vertical position of the input",
|
|
||||||
0.0,
|
|
||||||
f64::MAX,
|
|
||||||
Settings::default().ypos,
|
|
||||||
glib::ParamFlags::READWRITE,
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue