1use libc::{c_char, c_int, c_ushort, c_uchar};
14
15#[cfg(windows)]
17use std::os::raw::c_ushort as wchar_t;
18
19pub enum libraw_data_t {}
22
23#[repr(C)] pub struct libraw_processed_image_t {
27 pub image_type: c_int,
29 pub height: c_ushort,
31 pub width: c_ushort,
33 pub colors: c_ushort,
35 pub bits: c_ushort,
37 pub data_size: u32,
39 pub data: [c_uchar; 1],
42}
43
44#[cfg_attr(all(target_os = "windows", target_env = "msvc"), link(name = "libraw_static", kind = "static"))]
47#[cfg_attr(not(all(target_os = "windows", target_env = "msvc")), link(name = "raw", kind = "static"))]
49extern "C" {
50 pub fn libraw_version() -> *const c_char;
53
54 pub fn libraw_versionNumber() -> c_int;
56
57 pub fn libraw_init(flags: c_int) -> *mut libraw_data_t;
62
63 pub fn libraw_close(data: *mut libraw_data_t);
65
66 pub fn libraw_open_file(data: *mut libraw_data_t, filename: *const c_char) -> c_int;
72
73 #[cfg(windows)]
75 pub fn libraw_open_wfile(data: *mut libraw_data_t, filename: *const wchar_t) -> c_int;
76
77 pub fn libraw_unpack(data: *mut libraw_data_t) -> c_int;
79
80 pub fn libraw_dcraw_process(data: *mut libraw_data_t) -> c_int;
82
83 pub fn libraw_unpack_thumb(data: *mut libraw_data_t) -> c_int;
86
87 pub fn libraw_dcraw_make_mem_thumb(data: *mut libraw_data_t, errc: *mut c_int) -> *mut libraw_processed_image_t;
91
92 pub fn libraw_dcraw_clear_mem(img: *mut libraw_processed_image_t);
94
95 pub fn libraw_strerror(error_code: c_int) -> *const c_char;
98
99 pub fn libraw_recycle(data: *mut libraw_data_t);
103}
104
105pub const LIBRAW_OPTIONS_NONE: c_int = 0;
108
109pub const LIBRAW_OPIONS_NO_MEMERR_CALLBACK: c_int = 1;
111
112pub const LIBRAW_OPIONS_NO_DATAERR_CALLBACK: c_int = 1 << 1;
114
115pub const LIBRAW_SUCCESS: c_int = 0;
118
119pub const LIBRAW_UNSPECIFIED_ERROR: c_int = -1;
121
122pub const LIBRAW_FILE_UNSUPPORTED: c_int = -2;
124
125pub const LIBRAW_REQUEST_FOR_NONEXISTENT_IMAGE: c_int = -3;
127
128pub const LIBRAW_OUT_OF_ORDER_CALL: c_int = -4;
130
131pub const LIBRAW_NO_THUMBNAIL: c_int = -5;
133
134pub const LIBRAW_UNSUPPORTED_THUMBNAIL: c_int = -6;
136
137pub const LIBRAW_INPUT_CLOSED: c_int = -7;
139
140pub const LIBRAW_INSUFFICIENT_MEMORY: c_int = -100;
142
143pub const LIBRAW_DATA_ERROR: c_int = -101;
145
146pub const LIBRAW_IO_ERROR: c_int = -102;
148
149pub const LIBRAW_CANCELLED_BY_CALLBACK: c_int = -103;
151
152pub const LIBRAW_BAD_CROP: c_int = -104;
154
155pub const LIBRAW_TOO_BIG: c_int = -105;
157
158pub const LIBRAW_MEMPOOL_OVERFLOW: c_int = -106;
160
161pub const LIBRAW_IMAGE_JPEG: c_int = 1;
164
165pub const LIBRAW_IMAGE_BITMAP: c_int = 2;