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 5 use crate::Color; 6 use crate::Font; 7 use crate::Glyph; 8 use crate::GlyphItem; 9 use crate::GlyphString; 10 use crate::Layout; 11 use crate::LayoutLine; 12 use crate::Matrix; 13 use crate::RenderPart; 14 use glib::object::IsA; 15 use glib::translate::*; 16 use std::fmt; 17 18 glib::wrapper! { 19 #[doc(alias = "PangoRenderer")] 20 pub struct Renderer(Object<ffi::PangoRenderer, ffi::PangoRendererClass>); 21 22 match fn { 23 type_ => || ffi::pango_renderer_get_type(), 24 } 25 } 26 27 pub const NONE_RENDERER: Option<&Renderer> = None; 28 29 pub trait RendererExt: 'static { 30 #[doc(alias = "pango_renderer_activate")] activate(&self)31 fn activate(&self); 32 33 #[doc(alias = "pango_renderer_deactivate")] deactivate(&self)34 fn deactivate(&self); 35 36 #[doc(alias = "pango_renderer_draw_error_underline")] draw_error_underline(&self, x: i32, y: i32, width: i32, height: i32)37 fn draw_error_underline(&self, x: i32, y: i32, width: i32, height: i32); 38 39 #[doc(alias = "pango_renderer_draw_glyph")] draw_glyph<P: IsA<Font>>(&self, font: &P, glyph: Glyph, x: f64, y: f64)40 fn draw_glyph<P: IsA<Font>>(&self, font: &P, glyph: Glyph, x: f64, y: f64); 41 42 #[doc(alias = "pango_renderer_draw_glyph_item")] draw_glyph_item(&self, text: Option<&str>, glyph_item: &mut GlyphItem, x: i32, y: i32)43 fn draw_glyph_item(&self, text: Option<&str>, glyph_item: &mut GlyphItem, x: i32, y: i32); 44 45 #[doc(alias = "pango_renderer_draw_glyphs")] draw_glyphs<P: IsA<Font>>(&self, font: &P, glyphs: &mut GlyphString, x: i32, y: i32)46 fn draw_glyphs<P: IsA<Font>>(&self, font: &P, glyphs: &mut GlyphString, x: i32, y: i32); 47 48 #[doc(alias = "pango_renderer_draw_layout")] draw_layout(&self, layout: &Layout, x: i32, y: i32)49 fn draw_layout(&self, layout: &Layout, x: i32, y: i32); 50 51 #[doc(alias = "pango_renderer_draw_layout_line")] draw_layout_line(&self, line: &LayoutLine, x: i32, y: i32)52 fn draw_layout_line(&self, line: &LayoutLine, x: i32, y: i32); 53 54 #[doc(alias = "pango_renderer_draw_rectangle")] draw_rectangle(&self, part: RenderPart, x: i32, y: i32, width: i32, height: i32)55 fn draw_rectangle(&self, part: RenderPart, x: i32, y: i32, width: i32, height: i32); 56 57 #[doc(alias = "pango_renderer_draw_trapezoid")] draw_trapezoid( &self, part: RenderPart, y1_: f64, x11: f64, x21: f64, y2: f64, x12: f64, x22: f64, )58 fn draw_trapezoid( 59 &self, 60 part: RenderPart, 61 y1_: f64, 62 x11: f64, 63 x21: f64, 64 y2: f64, 65 x12: f64, 66 x22: f64, 67 ); 68 69 #[doc(alias = "pango_renderer_get_alpha")] 70 #[doc(alias = "get_alpha")] alpha(&self, part: RenderPart) -> u1671 fn alpha(&self, part: RenderPart) -> u16; 72 73 #[doc(alias = "pango_renderer_get_color")] 74 #[doc(alias = "get_color")] color(&self, part: RenderPart) -> Option<Color>75 fn color(&self, part: RenderPart) -> Option<Color>; 76 77 #[doc(alias = "pango_renderer_get_layout")] 78 #[doc(alias = "get_layout")] layout(&self) -> Option<Layout>79 fn layout(&self) -> Option<Layout>; 80 81 #[doc(alias = "pango_renderer_get_layout_line")] 82 #[doc(alias = "get_layout_line")] layout_line(&self) -> Option<LayoutLine>83 fn layout_line(&self) -> Option<LayoutLine>; 84 85 #[doc(alias = "pango_renderer_get_matrix")] 86 #[doc(alias = "get_matrix")] matrix(&self) -> Option<Matrix>87 fn matrix(&self) -> Option<Matrix>; 88 89 #[doc(alias = "pango_renderer_part_changed")] part_changed(&self, part: RenderPart)90 fn part_changed(&self, part: RenderPart); 91 92 #[doc(alias = "pango_renderer_set_alpha")] set_alpha(&self, part: RenderPart, alpha: u16)93 fn set_alpha(&self, part: RenderPart, alpha: u16); 94 95 #[doc(alias = "pango_renderer_set_color")] set_color(&self, part: RenderPart, color: Option<&Color>)96 fn set_color(&self, part: RenderPart, color: Option<&Color>); 97 98 #[doc(alias = "pango_renderer_set_matrix")] set_matrix(&self, matrix: Option<&Matrix>)99 fn set_matrix(&self, matrix: Option<&Matrix>); 100 } 101 102 impl<O: IsA<Renderer>> RendererExt for O { activate(&self)103 fn activate(&self) { 104 unsafe { 105 ffi::pango_renderer_activate(self.as_ref().to_glib_none().0); 106 } 107 } 108 deactivate(&self)109 fn deactivate(&self) { 110 unsafe { 111 ffi::pango_renderer_deactivate(self.as_ref().to_glib_none().0); 112 } 113 } 114 draw_error_underline(&self, x: i32, y: i32, width: i32, height: i32)115 fn draw_error_underline(&self, x: i32, y: i32, width: i32, height: i32) { 116 unsafe { 117 ffi::pango_renderer_draw_error_underline( 118 self.as_ref().to_glib_none().0, 119 x, 120 y, 121 width, 122 height, 123 ); 124 } 125 } 126 draw_glyph<P: IsA<Font>>(&self, font: &P, glyph: Glyph, x: f64, y: f64)127 fn draw_glyph<P: IsA<Font>>(&self, font: &P, glyph: Glyph, x: f64, y: f64) { 128 unsafe { 129 ffi::pango_renderer_draw_glyph( 130 self.as_ref().to_glib_none().0, 131 font.as_ref().to_glib_none().0, 132 glyph, 133 x, 134 y, 135 ); 136 } 137 } 138 draw_glyph_item(&self, text: Option<&str>, glyph_item: &mut GlyphItem, x: i32, y: i32)139 fn draw_glyph_item(&self, text: Option<&str>, glyph_item: &mut GlyphItem, x: i32, y: i32) { 140 unsafe { 141 ffi::pango_renderer_draw_glyph_item( 142 self.as_ref().to_glib_none().0, 143 text.to_glib_none().0, 144 glyph_item.to_glib_none_mut().0, 145 x, 146 y, 147 ); 148 } 149 } 150 draw_glyphs<P: IsA<Font>>(&self, font: &P, glyphs: &mut GlyphString, x: i32, y: i32)151 fn draw_glyphs<P: IsA<Font>>(&self, font: &P, glyphs: &mut GlyphString, x: i32, y: i32) { 152 unsafe { 153 ffi::pango_renderer_draw_glyphs( 154 self.as_ref().to_glib_none().0, 155 font.as_ref().to_glib_none().0, 156 glyphs.to_glib_none_mut().0, 157 x, 158 y, 159 ); 160 } 161 } 162 draw_layout(&self, layout: &Layout, x: i32, y: i32)163 fn draw_layout(&self, layout: &Layout, x: i32, y: i32) { 164 unsafe { 165 ffi::pango_renderer_draw_layout( 166 self.as_ref().to_glib_none().0, 167 layout.to_glib_none().0, 168 x, 169 y, 170 ); 171 } 172 } 173 draw_layout_line(&self, line: &LayoutLine, x: i32, y: i32)174 fn draw_layout_line(&self, line: &LayoutLine, x: i32, y: i32) { 175 unsafe { 176 ffi::pango_renderer_draw_layout_line( 177 self.as_ref().to_glib_none().0, 178 line.to_glib_none().0, 179 x, 180 y, 181 ); 182 } 183 } 184 draw_rectangle(&self, part: RenderPart, x: i32, y: i32, width: i32, height: i32)185 fn draw_rectangle(&self, part: RenderPart, x: i32, y: i32, width: i32, height: i32) { 186 unsafe { 187 ffi::pango_renderer_draw_rectangle( 188 self.as_ref().to_glib_none().0, 189 part.into_glib(), 190 x, 191 y, 192 width, 193 height, 194 ); 195 } 196 } 197 draw_trapezoid( &self, part: RenderPart, y1_: f64, x11: f64, x21: f64, y2: f64, x12: f64, x22: f64, )198 fn draw_trapezoid( 199 &self, 200 part: RenderPart, 201 y1_: f64, 202 x11: f64, 203 x21: f64, 204 y2: f64, 205 x12: f64, 206 x22: f64, 207 ) { 208 unsafe { 209 ffi::pango_renderer_draw_trapezoid( 210 self.as_ref().to_glib_none().0, 211 part.into_glib(), 212 y1_, 213 x11, 214 x21, 215 y2, 216 x12, 217 x22, 218 ); 219 } 220 } 221 alpha(&self, part: RenderPart) -> u16222 fn alpha(&self, part: RenderPart) -> u16 { 223 unsafe { ffi::pango_renderer_get_alpha(self.as_ref().to_glib_none().0, part.into_glib()) } 224 } 225 color(&self, part: RenderPart) -> Option<Color>226 fn color(&self, part: RenderPart) -> Option<Color> { 227 unsafe { 228 from_glib_none(ffi::pango_renderer_get_color( 229 self.as_ref().to_glib_none().0, 230 part.into_glib(), 231 )) 232 } 233 } 234 layout(&self) -> Option<Layout>235 fn layout(&self) -> Option<Layout> { 236 unsafe { 237 from_glib_none(ffi::pango_renderer_get_layout( 238 self.as_ref().to_glib_none().0, 239 )) 240 } 241 } 242 layout_line(&self) -> Option<LayoutLine>243 fn layout_line(&self) -> Option<LayoutLine> { 244 unsafe { 245 from_glib_none(ffi::pango_renderer_get_layout_line( 246 self.as_ref().to_glib_none().0, 247 )) 248 } 249 } 250 matrix(&self) -> Option<Matrix>251 fn matrix(&self) -> Option<Matrix> { 252 unsafe { 253 from_glib_none(ffi::pango_renderer_get_matrix( 254 self.as_ref().to_glib_none().0, 255 )) 256 } 257 } 258 part_changed(&self, part: RenderPart)259 fn part_changed(&self, part: RenderPart) { 260 unsafe { 261 ffi::pango_renderer_part_changed(self.as_ref().to_glib_none().0, part.into_glib()); 262 } 263 } 264 set_alpha(&self, part: RenderPart, alpha: u16)265 fn set_alpha(&self, part: RenderPart, alpha: u16) { 266 unsafe { 267 ffi::pango_renderer_set_alpha(self.as_ref().to_glib_none().0, part.into_glib(), alpha); 268 } 269 } 270 set_color(&self, part: RenderPart, color: Option<&Color>)271 fn set_color(&self, part: RenderPart, color: Option<&Color>) { 272 unsafe { 273 ffi::pango_renderer_set_color( 274 self.as_ref().to_glib_none().0, 275 part.into_glib(), 276 color.to_glib_none().0, 277 ); 278 } 279 } 280 set_matrix(&self, matrix: Option<&Matrix>)281 fn set_matrix(&self, matrix: Option<&Matrix>) { 282 unsafe { 283 ffi::pango_renderer_set_matrix(self.as_ref().to_glib_none().0, matrix.to_glib_none().0); 284 } 285 } 286 } 287 288 impl fmt::Display for Renderer { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result289 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 290 f.write_str("Renderer") 291 } 292 } 293