gdk4/draw_context.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{prelude::*, DrawContext};
6
7// rustdoc-stripper-ignore-next
8/// Trait containing manually implemented methods of
9/// [`DrawContext`](crate::DrawContext).
10pub trait DrawContextExtManual: IsA<DrawContext> + 'static {
11 /// Retrieves the region that is currently being repainted.
12 ///
13 /// After a call to [`DrawContextExt::begin_frame()`][crate::prelude::DrawContextExt::begin_frame()] this function will
14 /// return a union of the region passed to that function and the area of the
15 /// surface that the @self determined needs to be repainted.
16 ///
17 /// If @self is not in between calls to [`DrawContextExt::begin_frame()`][crate::prelude::DrawContextExt::begin_frame()]
18 /// and [`DrawContextExt::end_frame()`][crate::prelude::DrawContextExt::end_frame()], [`None`] will be returned.
19 ///
20 /// # Deprecated since 4.16
21 ///
22 /// Drawing directly to the surface is no longer recommended.
23 /// Use `GskRenderNode` and `GskRenderer`.
24 ///
25 /// # Returns
26 ///
27 /// a Cairo region
28 #[doc(alias = "gdk_draw_context_get_frame_region")]
29 #[doc(alias = "get_frame_region")]
30 fn frame_region(&self) -> Option<cairo::Region> {
31 unsafe {
32 from_glib_none(crate::ffi::gdk_draw_context_get_frame_region(
33 self.as_ref().to_glib_none().0,
34 ) as *mut cairo::ffi::cairo_region_t)
35 }
36 }
37}
38
39impl<O: IsA<DrawContext>> DrawContextExtManual for O {}