summaryrefslogtreecommitdiff
path: root/src/lowlevel/image.rs
blob: 5374b8c3923b5321432c854128275e1b65bdde1f (plain) (blame)
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
use rgb::RGB8;

pub enum ImageSource {
    External {
        /// The reference to the tileset image file (Tiled supports most common image formats). Only used if the image is not embedded.
        source: String,
    },

    /// Embedded images with a data child element
    ///
    /// Note that it is not currently possible to use Tiled to create maps with embedded image data, even though the TMX format supports this
    Embedded {
        /// . Valid values are file extensions like png, gif, jpg, bmp, etc.
        format: String,
        data: super::data::EncodedData,
    },
}

pub struct Image {
    pub source: ImageSource,
    /// Defines a specific color that is treated as transparent (example value: “#FF00FF” for magenta).
    /// Including the “#” is optional and Tiled leaves it out for compatibility reasons. (optional)
    pub transparent_color: Option<RGB8>,
    /// The image width in pixels (optional, used for tile index correction when the image changes)
    pub width: Option<usize>,
    /// The image height in pixels (optional)
    pub height: Option<usize>,
}