[go: up one dir, main page]

gdk4/auto/
functions.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// DO NOT EDIT
4
5use crate::{ffi, Texture};
6use glib::{prelude::*, translate::*};
7
8#[doc(alias = "gdk_intern_mime_type")]
9pub fn intern_mime_type(string: &str) -> Option<glib::GString> {
10    assert_initialized_main_thread!();
11    unsafe { from_glib_none(ffi::gdk_intern_mime_type(string.to_glib_none().0)) }
12}
13
14#[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
15#[allow(deprecated)]
16#[doc(alias = "gdk_pixbuf_get_from_surface")]
17pub fn pixbuf_get_from_surface(
18    surface: &cairo::Surface,
19    src_x: i32,
20    src_y: i32,
21    width: i32,
22    height: i32,
23) -> Option<gdk_pixbuf::Pixbuf> {
24    assert_initialized_main_thread!();
25    unsafe {
26        from_glib_full(ffi::gdk_pixbuf_get_from_surface(
27            mut_override(surface.to_glib_none().0),
28            src_x,
29            src_y,
30            width,
31            height,
32        ))
33    }
34}
35
36#[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
37#[allow(deprecated)]
38#[doc(alias = "gdk_pixbuf_get_from_texture")]
39pub fn pixbuf_get_from_texture(texture: &impl IsA<Texture>) -> Option<gdk_pixbuf::Pixbuf> {
40    skip_assert_initialized!();
41    unsafe {
42        from_glib_full(ffi::gdk_pixbuf_get_from_texture(
43            texture.as_ref().to_glib_none().0,
44        ))
45    }
46}
47
48#[doc(alias = "gdk_set_allowed_backends")]
49pub fn set_allowed_backends(backends: &str) {
50    skip_assert_initialized!();
51    unsafe {
52        ffi::gdk_set_allowed_backends(backends.to_glib_none().0);
53    }
54}
55
56#[doc(alias = "gdk_unicode_to_keyval")]
57pub fn unicode_to_keyval(wc: u32) -> u32 {
58    assert_initialized_main_thread!();
59    unsafe { ffi::gdk_unicode_to_keyval(wc) }
60}