wolfrpg_map_parser/command/picture_command/show/
free_transform.rs

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
use crate::command::picture_command::colors::Colors;
use crate::command::picture_command::show::free_transform_fields::FreeTransformFields;
use crate::command::picture_command::show::parser::parse_fields;
#[cfg(feature = "serde")]
use serde::Serialize;

#[cfg_attr(feature = "serde", derive(Serialize))]
pub struct FreeTransform {
    top_left_x: u32,
    top_left_y: u32,
    fields: FreeTransformFields
}

impl FreeTransform {
    pub fn parse(bytes: &[u8]) -> (usize, Option<u32>, Self) {
        let (offset, (top_left_x, top_left_y, filename_variable, fields))
            : (usize, (u32, u32, Option<u32>, FreeTransformFields))
            = parse_fields(bytes);

        (offset, filename_variable, Self {
            top_left_x,
            top_left_y,
            fields
        })
    }

    pub fn top_left_x(&self) -> u32 {
        self.top_left_x
    }

    pub fn top_left_x_mut(&mut self) -> &mut u32 {
        &mut self.top_left_x
    }

    pub fn top_left_y(&self) -> u32 {
        self.top_left_y
    }

    pub fn top_left_y_mut(&mut self) -> &mut u32 {
        &mut self.top_left_y
    }

    pub fn colors(&self) -> &Colors {
        self.fields.colors()
    }

    pub fn colors_mut(&mut self) -> &mut Colors {
        self.fields.colors_mut()
    }

    pub fn delay(&self) -> u32 {
        self.fields.delay()
    }

    pub fn delay_mut(&mut self) -> &mut u32 {
        self.fields.delay_mut()
    }

    pub fn range_count(&self) -> u32 {
        self.fields.range_count()
    }

    pub fn range_count_mut(&mut self) -> &mut u32 {
        self.fields.range_count_mut()
    }

    pub fn color_values(&self) -> &[u32; 3] {
        self.fields.color_values()
    }

    pub fn color_values_mut(&mut self) -> &mut [u32; 3] {
        self.fields.color_values_mut()
    }

    pub fn zoom_height(&self) -> u32 {
        self.fields.zoom_height()
    }

    pub fn zoom_height_mut(&mut self) -> &mut u32 {
        self.fields.zoom_height_mut()
    }

    pub fn top_right_x(&self) -> u32 {
        self.fields.top_right_x()
    }

    pub fn top_right_x_mut(&mut self) -> &mut u32 {
        self.fields.top_right_x_mut()
    }

    pub fn top_right_y(&self) -> u32 {
        self.fields.top_right_y()
    }

    pub fn top_right_y_mut(&mut self) -> &mut u32 {
        self.fields.top_right_y_mut()
    }

    pub fn bottom_left_x(&self) -> u32 {
        self.fields.bottom_left_x()
    }

    pub fn bottom_left_x_mut(&mut self) -> &mut u32 {
        self.fields.bottom_left_x_mut()
    }

    pub fn bottom_left_y(&self) -> u32 {
        self.fields.bottom_left_y()
    }

    pub fn bottom_left_y_mut(&mut self) -> &mut u32 {
        self.fields.bottom_left_y_mut()
    }

    pub fn bottom_right_x(&self) -> u32 {
        self.fields.bottom_right_x()
    }

    pub fn bottom_right_x_mut(&mut self) -> &mut u32 {
        self.fields.bottom_right_x_mut()
    }

    pub fn bottom_right_y(&self) -> u32 {
        self.fields.bottom_right_y()
    }

    pub fn bottom_right_y_mut(&mut self) -> &mut u32 {
        self.fields.bottom_right_y_mut()
    }
}