rsvg_sys/
lib.rs

1// This file was generated by gir (d50d839) from gir-files (ec4c204)
2// DO NOT EDIT
3
4#![allow(non_camel_case_types, non_upper_case_globals)]
5
6extern crate libc;
7#[macro_use] extern crate bitflags;
8extern crate glib_sys as glib;
9extern crate gobject_sys as gobject;
10extern crate gio_sys as gio;
11extern crate gdk_pixbuf_sys as gdk_pixbuf;
12extern crate cairo_sys as cairo;
13
14#[allow(unused_imports)]
15use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,
16    c_short, c_ushort, c_long, c_ulong,
17    c_void, size_t, ssize_t, intptr_t, uintptr_t, time_t, FILE};
18
19#[allow(unused_imports)]
20use glib::{gboolean, gconstpointer, gpointer, GType, Volatile};
21
22// Enums
23pub type Error = c_int;
24pub const RSVG_ERROR_FAILED: Error = 0;
25pub type RsvgError = Error;
26
27// Constants
28pub const LIBRSVG_MAJOR_VERSION: c_int = 2;
29pub const LIBRSVG_MICRO_VERSION: c_int = 16;
30pub const LIBRSVG_MINOR_VERSION: c_int = 40;
31pub const LIBRSVG_VERSION: *const c_char = b"2.40.16\0" as *const u8 as *const c_char;
32
33// Flags
34bitflags! {
35    #[repr(C)]
36    pub struct RsvgHandleFlags: c_uint {
37        const FLAGS_NONE = 0;
38        const FLAG_UNLIMITED = 1;
39        const FLAG_KEEP_IMAGE_DATA = 2;
40    }
41}
42pub const RSVG_HANDLE_FLAGS_NONE: RsvgHandleFlags = RsvgHandleFlags::FLAGS_NONE;
43pub const RSVG_HANDLE_FLAG_UNLIMITED: RsvgHandleFlags = RsvgHandleFlags::FLAG_UNLIMITED;
44pub const RSVG_HANDLE_FLAG_KEEP_IMAGE_DATA: RsvgHandleFlags = RsvgHandleFlags::FLAG_KEEP_IMAGE_DATA;
45
46// Records
47#[repr(C)]
48pub struct RsvgDimensionData {
49    pub width: c_int,
50    pub height: c_int,
51    pub em: c_double,
52    pub ex: c_double,
53}
54
55impl ::std::fmt::Debug for RsvgDimensionData {
56    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
57        write!(f, "RsvgDimensionData @ {:?}", self as *const _)
58    }
59}
60
61#[repr(C)]
62pub struct RsvgHandleClass {
63    pub parent: gobject::GObjectClass,
64    pub _abi_padding: [gpointer; 15],
65}
66
67impl ::std::fmt::Debug for RsvgHandleClass {
68    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
69        write!(f, "RsvgHandleClass @ {:?}", self as *const _)
70    }
71}
72
73#[repr(C)]
74pub struct RsvgHandlePrivate(c_void);
75
76impl ::std::fmt::Debug for RsvgHandlePrivate {
77    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
78        write!(f, "RsvgHandlePrivate @ {:?}", self as *const _)
79    }
80}
81
82#[repr(C)]
83pub struct RsvgPositionData {
84    pub x: c_int,
85    pub y: c_int,
86}
87
88impl ::std::fmt::Debug for RsvgPositionData {
89    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
90        write!(f, "RsvgPositionData @ {:?}", self as *const _)
91    }
92}
93
94// Classes
95#[repr(C)]
96pub struct RsvgHandle {
97    pub parent: gobject::GObject,
98    pub priv_: *mut RsvgHandlePrivate,
99    pub _abi_padding: [gpointer; 15],
100}
101
102impl ::std::fmt::Debug for RsvgHandle {
103    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
104        f.debug_struct(&format!("RsvgHandle @ {:?}", self as *const _))
105         .field("parent", &self.parent)
106         .field("priv_", &self.priv_)
107         .field("_abi_padding", &self._abi_padding)
108         .finish()
109    }
110}
111
112extern "C" {
113
114    //=========================================================================
115    // RsvgError
116    //=========================================================================
117    pub fn rsvg_error_get_type() -> GType;
118    pub fn rsvg_error_quark() -> glib::GQuark;
119
120    //=========================================================================
121    // RsvgHandleFlags
122    //=========================================================================
123    pub fn rsvg_handle_flags_get_type() -> GType;
124
125    //=========================================================================
126    // RsvgHandle
127    //=========================================================================
128    pub fn rsvg_handle_get_type() -> GType;
129    pub fn rsvg_handle_new() -> *mut RsvgHandle;
130    pub fn rsvg_handle_new_from_data(data: *mut u8, data_len: size_t, error: *mut *mut glib::GError) -> *mut RsvgHandle;
131    pub fn rsvg_handle_new_from_file(file_name: *const c_char, error: *mut *mut glib::GError) -> *mut RsvgHandle;
132    pub fn rsvg_handle_new_from_gfile_sync(file: *mut gio::GFile, flags: RsvgHandleFlags, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError) -> *mut RsvgHandle;
133    pub fn rsvg_handle_new_from_stream_sync(input_stream: *mut gio::GInputStream, base_file: *mut gio::GFile, flags: RsvgHandleFlags, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError) -> *mut RsvgHandle;
134    pub fn rsvg_handle_new_with_flags(flags: RsvgHandleFlags) -> *mut RsvgHandle;
135    pub fn rsvg_handle_close(handle: *mut RsvgHandle, error: *mut *mut glib::GError) -> gboolean;
136    pub fn rsvg_handle_get_base_uri(handle: *mut RsvgHandle) -> *const c_char;
137    pub fn rsvg_handle_get_dimensions(handle: *mut RsvgHandle, dimension_data: *mut RsvgDimensionData);
138    pub fn rsvg_handle_get_dimensions_sub(handle: *mut RsvgHandle, dimension_data: *mut RsvgDimensionData, id: *const c_char) -> gboolean;
139    pub fn rsvg_handle_get_pixbuf(handle: *mut RsvgHandle) -> *mut gdk_pixbuf::GdkPixbuf;
140    pub fn rsvg_handle_get_pixbuf_sub(handle: *mut RsvgHandle, id: *const c_char) -> *mut gdk_pixbuf::GdkPixbuf;
141    pub fn rsvg_handle_get_position_sub(handle: *mut RsvgHandle, position_data: *mut RsvgPositionData, id: *const c_char) -> gboolean;
142    pub fn rsvg_handle_has_sub(handle: *mut RsvgHandle, id: *const c_char) -> gboolean;
143    pub fn rsvg_handle_read_stream_sync(handle: *mut RsvgHandle, stream: *mut gio::GInputStream, cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError) -> gboolean;
144    pub fn rsvg_handle_render_cairo(handle: *mut RsvgHandle, cr: *mut cairo::cairo_t) -> gboolean;
145    pub fn rsvg_handle_render_cairo_sub(handle: *mut RsvgHandle, cr: *mut cairo::cairo_t, id: *const c_char) -> gboolean;
146    pub fn rsvg_handle_set_base_gfile(handle: *mut RsvgHandle, base_file: *mut gio::GFile);
147    pub fn rsvg_handle_set_base_uri(handle: *mut RsvgHandle, base_uri: *const c_char);
148    pub fn rsvg_handle_set_dpi(handle: *mut RsvgHandle, dpi: c_double);
149    pub fn rsvg_handle_set_dpi_x_y(handle: *mut RsvgHandle, dpi_x: c_double, dpi_y: c_double);
150    pub fn rsvg_handle_write(handle: *mut RsvgHandle, buf: *mut u8, count: size_t, error: *mut *mut glib::GError) -> gboolean;
151
152    //=========================================================================
153    // Other functions
154    //=========================================================================
155    pub fn rsvg_cleanup();
156    pub fn rsvg_set_default_dpi(dpi: c_double);
157    pub fn rsvg_set_default_dpi_x_y(dpi_x: c_double, dpi_y: c_double);
158
159}