diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2016-08-05 08:35:13 -0400 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2016-08-05 08:35:13 -0400 |
commit | 1ad88bc7e346cde1dba925fcc7a3a9c836adfec6 (patch) | |
tree | 4f9fd63498d9b56889c0d11f33a145c46b22609e | |
parent | 81a59e29ff0290f9f148243345279c6642751045 (diff) |
Working image processing example in rust.
-rw-r--r-- | src/main.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 0802061..4f26cd2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,9 +2,8 @@ extern crate libc; extern crate glib; use std::ffi::CString; use std::ptr; -use glib::prelude::*; use glib::translate::*; -use glib::{TypedValue, Value}; +use glib::Value; #[link(name="gegl-0.3")] extern { @@ -16,6 +15,11 @@ extern { fn gegl_node_set_property(node: *mut libc::c_void, property_name: *const libc::c_char, value: *const libc::c_void); + fn gegl_node_link(source: *mut libc::c_void, + sink: *mut libc::c_void); + fn gegl_node_process(node: *mut libc::c_void); + fn g_object_unref(node: *mut libc::c_void); + fn gegl_exit(); } fn main() { @@ -33,6 +37,18 @@ fn main() { // ptr::null_mut() Value::from("/tmp/test.jpg").to_glib_none().0 as *const libc::c_void); + let sink = gegl_node_create_child( + graph, CString::new("gegl:save").unwrap().as_ptr()); + gegl_node_set_property( + sink, + CString::new("path").unwrap().as_ptr(), + Value::from("/tmp/test-output.jpg").to_glib_none().0 + as *const libc::c_void); + gegl_node_link(src, sink); println!("Hello"); + + gegl_node_process(sink); + g_object_unref(graph); + gegl_exit(); } } |