summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 0802061af5231732d38d46bafc4585852df9946c (plain)
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
extern crate libc;
extern crate glib;
use std::ffi::CString;
use std::ptr;
use glib::prelude::*;
use glib::translate::*;
use glib::{TypedValue, Value};

#[link(name="gegl-0.3")]
extern {
    fn gegl_init(argc: *mut i32, argv: *mut *mut libc::c_char);
    fn gegl_node_new() -> *mut libc::c_void;
    fn gegl_node_create_child(parent: *mut libc::c_void,
                              operation: *const libc::c_char)
                              -> *mut libc::c_void;
    fn gegl_node_set_property(node: *mut libc::c_void,
                              property_name: *const libc::c_char,
                              value: *const libc::c_void);
}

fn main() {
    unsafe {
        let mut argc : i32 = 0;
        gegl_init(&mut argc as *mut i32, ptr::null_mut());
        let graph = gegl_node_new();
        let src = gegl_node_create_child(
            graph, CString::new("gegl:load").unwrap().as_ptr());
        println!("{:?}", src);
        println!("Hello");
        gegl_node_set_property(
            src,
            CString::new("path").unwrap().as_ptr(),
            // ptr::null_mut()
            Value::from("/tmp/test.jpg").to_glib_none().0
                as *const libc::c_void);
        println!("Hello");
    }
}