1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use crate::Renderer;
use glib::object::Cast;
use glib::translate::*;
use std::fmt;
glib::wrapper! {
/// A GSK renderer that is using cairo.
///
/// Since it is using cairo, this renderer cannot support
/// 3D transformations.
///
/// # Implements
///
/// [`GskRendererExt`][trait@crate::prelude::GskRendererExt]
#[doc(alias = "GskCairoRenderer")]
pub struct CairoRenderer(Object<ffi::GskCairoRenderer, ffi::GskCairoRendererClass>) @extends Renderer;
match fn {
type_ => || ffi::gsk_cairo_renderer_get_type(),
}
}
impl CairoRenderer {
/// Creates a new Cairo renderer.
///
/// The Cairo renderer is the fallback renderer drawing in ways similar
/// to how GTK 3 drew its content. Its primary use is as comparison tool.
///
/// The Cairo renderer is incomplete. It cannot render 3D transformed
/// content and will instead render an error marker. Its usage should be
/// avoided.
///
/// # Returns
///
/// a new Cairo renderer.
#[doc(alias = "gsk_cairo_renderer_new")]
pub fn new() -> CairoRenderer {
assert_initialized_main_thread!();
unsafe { Renderer::from_glib_full(ffi::gsk_cairo_renderer_new()).unsafe_cast() }
}
}
impl Default for CairoRenderer {
fn default() -> Self {
Self::new()
}
}
impl fmt::Display for CairoRenderer {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("CairoRenderer")
}
}