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
#![allow(unused_variables)]
use imgref::ImgVec;
use rgb::RGBA8;
use crate::{ErrorKind, ImageInfo, ImageSource, ImageStore};
use super::{Command, Renderer, Vertex};
pub struct Void;
impl Renderer for Void {
type Image = VoidImage;
fn set_size(&mut self, width: u32, height: u32, dpi: f32) {}
fn render(&mut self, images: &ImageStore<VoidImage>, verts: &[Vertex], commands: &[Command]) {}
fn alloc_image(&mut self, info: ImageInfo) -> Result<Self::Image, ErrorKind> {
Ok(VoidImage { info })
}
fn update_image(
&mut self,
image: &mut Self::Image,
data: ImageSource,
x: usize,
y: usize,
) -> Result<(), ErrorKind> {
let size = data.dimensions();
if x + size.0 > image.info.width() {
return Err(ErrorKind::ImageUpdateOutOfBounds);
}
if y + size.1 > image.info.height() {
return Err(ErrorKind::ImageUpdateOutOfBounds);
}
Ok(())
}
fn delete_image(&mut self, image: Self::Image) {}
fn screenshot(&mut self) -> Result<ImgVec<RGBA8>, ErrorKind> {
Ok(ImgVec::new(Vec::new(), 0, 0))
}
}
pub struct VoidImage {
info: ImageInfo,
}