1use crate::{Area, Point};
2
3#[derive(Debug)]
4pub enum PixelabError {
5 PointOutOfBounds {
6 point: Point,
7 bound: Area,
8 },
9 BitmapOutOfBounds {
10 point: Point,
11 main_bound: Area,
12 sub_bound: Area,
13 },
14 BitmapFormatMismatch,
15 InsufficientPoints,
16 BitmapBufferNotCreated,
17 BitmapTypeIsNone,
18 EmptyEvent,
19}
20
21impl core::error::Error for PixelabError {}
22impl core::fmt::Display for PixelabError {
23 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
24 match self {
25 Self::PointOutOfBounds { point, bound } => {
26 write!(f, "PointOutOfBounds Point: {}, Bound: {}", point, bound)
27 }
28 Self::BitmapOutOfBounds {
29 point,
30 main_bound,
31 sub_bound,
32 } => {
33 write!(
34 f,
35 "BitmapOutOfBounds Point: {}, Main-Bound: {}, Sub-Bound: {}",
36 point, main_bound, sub_bound
37 )
38 }
39 Self::BitmapFormatMismatch => {
40 write!(f, "FormatMismatch")
41 }
42 Self::InsufficientPoints => {
43 write!(f, "InsufficientPoints")
44 }
45 Self::BitmapBufferNotCreated => {
46 write!(f, "BitMapBufferNotCreated")
47 }
48 Self::BitmapTypeIsNone => {
49 write!(f, "BitMapTypeIsNone")
50 }
51 Self::EmptyEvent => {
52 write!(f, "EmptyEvent")
53 }
54 }
55 }
56}