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
// Standard Uses
use std::path::Path;

// Crate Uses
use crate::formats::sub::SubInfo;
use crate::formats::subs::GroupSubInfo;

// External Uses
use anyhow::{Result};
use image::DynamicImage;
use image::io::Reader;


#[derive(Default)]
pub struct UnifiedImage {
    pub groups: Vec<GroupSubInfo>,
    pub subs: Vec<SubInfo>,
    image: DynamicImage
}


impl UnifiedImage {
    pub fn from_file(path: &Path) -> Result<Self> {
        let image = Reader::open(path)?.decode()?;

        Ok(Self {
            groups: vec![],
            subs: vec![],
            image
        })
    }

    pub fn name(&self) -> String {
        "test".to_owned()
    }

    pub fn add_sub(&mut self, info: SubInfo) {
        self.subs.push(info);
    }

    pub fn add_subs_group(&mut self, group: GroupSubInfo) {
        self.groups.push(group);
    }

    pub fn slice_subs(self) -> Vec<UnifiedImage> {
        todo!()
    }
}