wolfrpg_map_parser/command/
picture_command.rs

1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3use crate::command::picture_command::erase::Erase;
4use crate::command::picture_command::show::Show;
5
6pub mod show;
7pub mod options;
8pub mod display_type;
9pub mod blending_method;
10pub mod anchor;
11pub mod zoom;
12pub mod colors;
13pub mod erase;
14pub mod display_operation;
15
16#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
17#[derive(PartialEq, Clone)]
18pub enum PictureCommand {
19    Show(Show),
20    Erase(Erase),
21}
22
23impl PictureCommand {
24    pub(crate) fn parse_show_base(bytes: &[u8]) -> (usize, Self) {
25        let (bytes_read, command): (usize, Show) = Show::parse_base(bytes);
26
27        (bytes_read, Self::Show(command))
28    }
29
30    pub(crate) fn parse_show_colors(bytes: &[u8]) -> (usize, Self) {
31        let (bytes_read, command): (usize, Show) = Show::parse_colors(bytes);
32
33        (bytes_read, Self::Show(command))
34    }
35
36    pub(crate) fn parse_show_delay(bytes: &[u8]) -> (usize, Self) {
37        let (bytes_read, command): (usize, Show) = Show::parse_delay(bytes);
38
39        (bytes_read, Self::Show(command))
40    }
41
42    pub(crate) fn parse_show_range(bytes: &[u8]) -> (usize, Self) {
43        let (bytes_read, command): (usize, Show) = Show::parse_range(bytes);
44
45        (bytes_read, Self::Show(command))
46    }
47
48    pub(crate) fn parse_color_values(bytes: &[u8]) -> (usize, Self) {
49        let (bytes_read, command): (usize, Show) = Show::parse_color_values(bytes);
50
51        (bytes_read, Self::Show(command))
52    }
53
54    pub(crate) fn parse_show_zoom(bytes: &[u8]) -> (usize, Self) {
55        let (bytes_read, command): (usize, Show) = Show::parse_zoom(bytes);
56
57        (bytes_read, Self::Show(command))
58    }
59
60    pub(crate) fn parse_show_free_transform(bytes: &[u8]) -> (usize, Self) {
61        let (bytes_read, command): (usize, Show) = Show::parse_free_transform(bytes);
62
63        (bytes_read, Self::Show(command))
64    }
65
66    pub(crate) fn parse_erase_delay_reset(bytes: &[u8]) -> (usize, Self) {
67        let (bytes_read, command): (usize, Erase) = Erase::parse_delay_reset(bytes);
68
69        (bytes_read, Self::Erase(command))
70    }
71
72    pub(crate) fn parse_erase_base(bytes: &[u8]) -> (usize, Self) {
73        let (bytes_read, command): (usize, Erase) = Erase::parse_base(bytes);
74
75        (bytes_read, Self::Erase(command))
76    }
77
78    pub(crate) fn parse_erase_delay(bytes: &[u8]) -> (usize, Self) {
79        let (bytes_read, command): (usize, Erase) = Erase::parse_delay(bytes);
80
81        (bytes_read, Self::Erase(command))
82    }
83
84    pub(crate) fn parse_erase_range(bytes: &[u8]) -> (usize, Self) {
85        let (bytes_read, command): (usize, Erase) = Erase::parse_range(bytes);
86
87        (bytes_read, Self::Erase(command))
88    }
89}