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
use Format;
use framing::{AsBytes, Chunky};
use framing::Image as Frame;
use std::os::raw::c_int;
use std::ptr;
pub trait Image {
type Format: Format;
fn strides(&self) -> [c_int; 4];
fn planes(&self) -> [*const u8; 4];
}
impl<F, T> Image for Chunky<F, T>
where
T: AsRef<[u8]>,
F: AsBytes + Format
{
type Format = F;
fn strides(&self) -> [c_int; 4] {
[(F::width() * self.width()) as _, 0, 0, 0]
}
fn planes(&self) -> [*const u8; 4] {
[self.bytes().as_ref().as_ptr(), ptr::null(), ptr::null(), ptr::null()]
}
}