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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
extern crate freeimage;
use rin_util::{Result, Error};
pub use self::freeimage::Bitmap as Image;
pub use self::freeimage::Type;
pub use self::freeimage::Filter;
pub use self::freeimage::ColorChannel;
use std::path::Path;
pub fn load<P: AsRef<Path>>(path: P) -> Result<Image>{
Image::load(path.as_ref())
.map_err(|err| Error::with_cause(&format!("Error loading image from {:?}", path.as_ref()), err))
}
pub fn load_from_memory(buffer: &[u8]) -> Result<Image>{
Image::load_from_memory(buffer)
.map_err(|err| Error::with_cause(&format!("Error loading image from memory"), err))
}
pub fn supports(_: Format) -> bool{
true
}
pub enum Format{
Bmp,
Cut,
Dds,
Exr,
G3,
Gif,
Hdr,
Ico,
Iff,
JBig,
Jng,
Jpeg,
Jpeg2000,
JpegXR,
Koala,
Kodak,
Mng,
Pcx,
Pbm,
Pgm,
Ppm,
Pfm,
Png,
Pict,
Psd,
Raw,
Ras,
Sgi,
Targa,
Tiff,
WBMP,
WebP,
Xbm,
Xpm,
}