gstreamer_editing_services/auto/
text_overlay.rs

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// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{
8    ffi, Extractable, MetaContainer, Operation, TextHAlign, TextVAlign, TimelineElement,
9    TrackElement,
10};
11use glib::{prelude::*, translate::*};
12
13glib::wrapper! {
14    ///
15    ///
16    /// # Implements
17    ///
18    /// [`TextOverlayExt`][trait@crate::prelude::TextOverlayExt], [`OperationExt`][trait@crate::prelude::OperationExt], [`TrackElementExt`][trait@crate::prelude::TrackElementExt], [`TimelineElementExt`][trait@crate::prelude::TimelineElementExt], [`trait@glib::ObjectExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt], [`TimelineElementExtManual`][trait@crate::prelude::TimelineElementExtManual]
19    #[doc(alias = "GESTextOverlay")]
20    pub struct TextOverlay(Object<ffi::GESTextOverlay, ffi::GESTextOverlayClass>) @extends Operation, TrackElement, TimelineElement, @implements Extractable, MetaContainer;
21
22    match fn {
23        type_ => || ffi::ges_text_overlay_get_type(),
24    }
25}
26
27impl TextOverlay {
28    pub const NONE: Option<&'static TextOverlay> = None;
29
30    /// Creates a new [`TextOverlay`][crate::TextOverlay].
31    ///
32    /// # Deprecated since 1.18
33    ///
34    /// This should never be called by applications as this will
35    /// be created by clips.
36    ///
37    /// # Returns
38    ///
39    /// The newly created [`TextOverlay`][crate::TextOverlay] or
40    /// [`None`] if something went wrong.
41    #[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")]
42    #[allow(deprecated)]
43    #[doc(alias = "ges_text_overlay_new")]
44    pub fn new() -> Option<TextOverlay> {
45        assert_initialized_main_thread!();
46        unsafe { from_glib_none(ffi::ges_text_overlay_new()) }
47    }
48}
49
50mod sealed {
51    pub trait Sealed {}
52    impl<T: super::IsA<super::TextOverlay>> Sealed for T {}
53}
54
55/// Trait containing all [`struct@TextOverlay`] methods.
56///
57/// # Implementors
58///
59/// [`TextOverlay`][struct@crate::TextOverlay]
60pub trait TextOverlayExt: IsA<TextOverlay> + sealed::Sealed + 'static {
61    /// Get the color used by `source`.
62    ///
63    /// # Returns
64    ///
65    /// The color used by `source`.
66    #[doc(alias = "ges_text_overlay_get_color")]
67    #[doc(alias = "get_color")]
68    fn color(&self) -> u32 {
69        unsafe { ffi::ges_text_overlay_get_color(self.as_ref().to_glib_none().0) }
70    }
71
72    /// Get the pango font description currently set on `source`.
73    ///
74    /// # Returns
75    ///
76    /// The pango font description currently set on `source`.
77    #[doc(alias = "ges_text_overlay_get_font_desc")]
78    #[doc(alias = "get_font_desc")]
79    fn font_desc(&self) -> Option<glib::GString> {
80        unsafe {
81            from_glib_none(ffi::ges_text_overlay_get_font_desc(
82                self.as_ref().to_glib_none().0,
83            ))
84        }
85    }
86
87    /// Get the horizontal aligment used by `source`.
88    ///
89    /// # Returns
90    ///
91    /// The horizontal aligment used by `source`.
92    #[doc(alias = "ges_text_overlay_get_halignment")]
93    #[doc(alias = "get_halignment")]
94    fn halignment(&self) -> TextHAlign {
95        unsafe {
96            from_glib(ffi::ges_text_overlay_get_halignment(
97                self.as_ref().to_glib_none().0,
98            ))
99        }
100    }
101
102    /// Get the text currently set on `source`.
103    ///
104    /// # Returns
105    ///
106    /// The text currently set on `source`.
107    #[doc(alias = "ges_text_overlay_get_text")]
108    #[doc(alias = "get_text")]
109    fn text(&self) -> Option<glib::GString> {
110        unsafe {
111            from_glib_none(ffi::ges_text_overlay_get_text(
112                self.as_ref().to_glib_none().0,
113            ))
114        }
115    }
116
117    /// Get the vertical aligment used by `source`.
118    ///
119    /// # Returns
120    ///
121    /// The vertical aligment used by `source`.
122    #[doc(alias = "ges_text_overlay_get_valignment")]
123    #[doc(alias = "get_valignment")]
124    fn valignment(&self) -> TextVAlign {
125        unsafe {
126            from_glib(ffi::ges_text_overlay_get_valignment(
127                self.as_ref().to_glib_none().0,
128            ))
129        }
130    }
131
132    /// Get the horizontal position used by `source`.
133    ///
134    /// # Returns
135    ///
136    /// The horizontal position used by `source`.
137    #[doc(alias = "ges_text_overlay_get_xpos")]
138    #[doc(alias = "get_xpos")]
139    fn xpos(&self) -> f64 {
140        unsafe { ffi::ges_text_overlay_get_xpos(self.as_ref().to_glib_none().0) }
141    }
142
143    /// Get the vertical position used by `source`.
144    ///
145    /// # Returns
146    ///
147    /// The vertical position used by `source`.
148    #[doc(alias = "ges_text_overlay_get_ypos")]
149    #[doc(alias = "get_ypos")]
150    fn ypos(&self) -> f64 {
151        unsafe { ffi::ges_text_overlay_get_ypos(self.as_ref().to_glib_none().0) }
152    }
153
154    /// Sets the color of the text.
155    /// ## `color`
156    /// The color `self` is being set to
157    #[doc(alias = "ges_text_overlay_set_color")]
158    fn set_color(&self, color: u32) {
159        unsafe {
160            ffi::ges_text_overlay_set_color(self.as_ref().to_glib_none().0, color);
161        }
162    }
163
164    /// Sets the pango font description of the text this track element
165    /// will render.
166    /// ## `font_desc`
167    /// the pango font description
168    #[doc(alias = "ges_text_overlay_set_font_desc")]
169    fn set_font_desc(&self, font_desc: Option<&str>) {
170        unsafe {
171            ffi::ges_text_overlay_set_font_desc(
172                self.as_ref().to_glib_none().0,
173                font_desc.to_glib_none().0,
174            );
175        }
176    }
177
178    /// Sets the horizontal aligment of the text.
179    /// ## `halign`
180    /// The [`TextHAlign`][crate::TextHAlign] defining the horizontal alignment
181    /// of the text render by `self`.
182    #[doc(alias = "ges_text_overlay_set_halignment")]
183    fn set_halignment(&self, halign: TextHAlign) {
184        unsafe {
185            ffi::ges_text_overlay_set_halignment(
186                self.as_ref().to_glib_none().0,
187                halign.into_glib(),
188            );
189        }
190    }
191
192    /// Sets the text this track element will render.
193    /// ## `text`
194    /// the text to render. an internal copy of this text will be
195    /// made.
196    #[doc(alias = "ges_text_overlay_set_text")]
197    fn set_text(&self, text: Option<&str>) {
198        unsafe {
199            ffi::ges_text_overlay_set_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
200        }
201    }
202
203    /// Sets the vertical aligment of the text.
204    /// ## `valign`
205    /// The [`TextVAlign`][crate::TextVAlign] defining the vertical alignment
206    /// of the text render by `self`.
207    #[doc(alias = "ges_text_overlay_set_valignment")]
208    fn set_valignment(&self, valign: TextVAlign) {
209        unsafe {
210            ffi::ges_text_overlay_set_valignment(
211                self.as_ref().to_glib_none().0,
212                valign.into_glib(),
213            );
214        }
215    }
216
217    /// Sets the horizontal position of the text.
218    /// ## `position`
219    /// The horizontal position `self` is being set to
220    #[doc(alias = "ges_text_overlay_set_xpos")]
221    fn set_xpos(&self, position: f64) {
222        unsafe {
223            ffi::ges_text_overlay_set_xpos(self.as_ref().to_glib_none().0, position);
224        }
225    }
226
227    /// Sets the vertical position of the text.
228    /// ## `position`
229    /// The vertical position `self` is being set to
230    #[doc(alias = "ges_text_overlay_set_ypos")]
231    fn set_ypos(&self, position: f64) {
232        unsafe {
233            ffi::ges_text_overlay_set_ypos(self.as_ref().to_glib_none().0, position);
234        }
235    }
236}
237
238impl<O: IsA<TextOverlay>> TextOverlayExt for O {}