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
use std::sync::*;
use std::io::Read;
use futures::stream::*;
#[derive(Clone)]
pub enum Image {
Png(Arc<ImageData>),
Svg(Arc<ImageData>)
}
pub trait ImageData : Send+Sync {
fn read(&self) -> Box<Read+Send>;
fn read_future(&self) -> Box<Stream<Item=u8, Error=()>>;
}
impl Image {
pub fn png_from_rgba_data(rgba: &[u8], width: u32, height: u32) -> Image {
Image::Png(Arc::new(png::png_data_for_rgba(rgba, width, height)))
}
}
mod inmemory;
mod static_data;
mod shortcuts;
mod png;
pub use self::inmemory::*;
pub use self::static_data::*;
pub use self::shortcuts::*;