87 lines
1.6 KiB
Rust
87 lines
1.6 KiB
Rust
use std::os::raw::{c_char, c_int, c_uchar, c_ulong};
|
|
|
|
#[repr(C)]
|
|
pub enum RImageFormat {
|
|
RGBAFormat = 0,
|
|
RRGBAFormat = 1,
|
|
}
|
|
|
|
#[repr(C)]
|
|
pub struct RImage {
|
|
data: *mut c_uchar,
|
|
width: c_int,
|
|
height: c_int,
|
|
format: RImageFormat,
|
|
ref_count: c_int,
|
|
}
|
|
|
|
#[repr(C)]
|
|
pub struct RContext {
|
|
// display: *mut Display,
|
|
display: usize,
|
|
screen_number: c_int,
|
|
// cmap: Colormap,
|
|
|
|
// attribs: *mut RContextAttributes,
|
|
attribs: usize,
|
|
|
|
// copy_gc: GC,
|
|
|
|
// visual: *mut Visual,
|
|
visual: usize,
|
|
depth: c_int,
|
|
// drawable: Window,
|
|
vclass: c_int,
|
|
|
|
black: c_ulong,
|
|
white: c_ulong,
|
|
|
|
red_offset: c_int,
|
|
green_offset: c_int,
|
|
blue_offset: c_int,
|
|
|
|
std_rgb_map: usize,
|
|
std_gray_map: usize,
|
|
// std_rgb_map: *mut XStandardColorMap,
|
|
// std_gray_map: *mut XStandardColorMap,
|
|
|
|
ncolors: c_int,
|
|
colors: usize,
|
|
// colors: *mut XColor,
|
|
pixels: *mut c_ulong,
|
|
|
|
flags: u8,
|
|
}
|
|
|
|
#[repr(C)]
|
|
pub enum RScalingFilter {
|
|
RBoxFilter,
|
|
RTriangleFilter,
|
|
RBellFilter,
|
|
RBSplineFilter,
|
|
RLanczos3Filter,
|
|
RMitchellFilter,
|
|
}
|
|
|
|
extern "C" {
|
|
pub fn r_destroy_conversion_tables() -> ();
|
|
|
|
pub fn RLoadPPM(file: *const c_char) -> *mut RImage;
|
|
|
|
pub fn RLoadXPM(context: *mut RContext, file: *const c_char) -> *mut RImage;
|
|
|
|
pub fn RReleaseCache() -> ();
|
|
|
|
pub fn wraster_rotate_image_180(source: *const RImage) -> *mut RImage;
|
|
|
|
pub fn wraster_change_filter(ty: RScalingFilter) -> ();
|
|
|
|
pub fn RShutdown() -> ();
|
|
|
|
#[must_use]
|
|
pub fn RSupportedFileFormats() -> *mut *const c_char;
|
|
|
|
#[must_use]
|
|
pub fn RGetImageFileFormat(file: *const c_char) -> *mut c_char;
|
|
}
|