[librsvg/rustification] drawing_ctx.rs: Put the declaration of RsvgDrawingCtx here
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/rustification] drawing_ctx.rs: Put the declaration of RsvgDrawingCtx here
- Date: Thu, 17 Nov 2016 00:29:08 +0000 (UTC)
commit 4eca2e07b6419d32e8d45ff71cf60aa24b908217
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Nov 16 15:40:13 2016 -0600
drawing_ctx.rs: Put the declaration of RsvgDrawingCtx here
We'll use this file to declare the accessors to an RsvgDrawingCtx, which
are right now implemented in C.
rust/src/drawing_ctx.rs | 16 ++++++++++++++++
rust/src/lib.rs | 5 +++--
rust/src/marker.rs | 3 +--
3 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/rust/src/drawing_ctx.rs b/rust/src/drawing_ctx.rs
new file mode 100644
index 0000000..2a16d82
--- /dev/null
+++ b/rust/src/drawing_ctx.rs
@@ -0,0 +1,16 @@
+pub enum RsvgDrawingCtx {}
+
+extern "C" {
+ fn rsvg_drawing_ctx_get_view_box_size (draw_ctx: *const RsvgDrawingCtx,
+ out_x: *mut f64,
+ out_y: *mut f64);
+}
+
+pub fn get_view_box_size (draw_ctx: *const RsvgDrawingCtx) -> (f64, f64) {
+ let mut w: f64 = 0.0;
+ let mut h: f64 = 0.0;
+
+ unsafe { rsvg_drawing_ctx_get_view_box_size (draw_ctx, &mut w, &mut h); }
+
+ (w, h)
+}
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index 200f5d6..731d230 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -26,8 +26,9 @@ pub use length::{
rsvg_length_hand_normalize,
};
+mod drawing_ctx;
+mod length;
+mod marker;
mod path_builder;
mod path_parser;
-mod marker;
mod strtod;
-mod length;
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index 71b497c..c1d7de2 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -3,6 +3,7 @@ extern crate cairo;
extern crate cairo_sys;
use path_builder::*;
+use drawing_ctx::RsvgDrawingCtx;
#[derive(Debug, PartialEq)]
pub enum Segment {
@@ -291,8 +292,6 @@ fn angle_from_vector (vx: f64, vy: f64) -> f64 {
}
}
-pub enum RsvgDrawingCtx {}
-
extern "C" {
fn rsvg_marker_render (marker_name: *const libc::c_char,
xpos: f64,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]