texture_packer/
texture_packer_config.rs

1use std::default::Default;
2
3/// Configuration for a texture packer.
4#[derive(Debug, Copy, Clone)]
5pub struct TexturePackerConfig {
6    //
7    // layout configuration
8    //
9    /// Max width of the packed image. Default value is `1024`.
10    pub max_width: u32,
11    /// Max height of the packed image. Default value is `1024`.
12    pub max_height: u32,
13    /// True to allow rotation of the input images. Default value is `true`. Images rotated will be
14    /// rotated 90 degrees clockwise.
15    pub allow_rotation: bool,
16
17    /// If enabled, the size of the output texture will always match [max_width] and [max_height]
18    /// leaving potentially much unused space on the texture.
19    pub force_max_dimensions: bool,
20
21    //
22    // texture configuration
23    //
24    /// Size of the padding on the outer edge of the packed image in pixel. Default value is `0`.
25    pub border_padding: u32,
26    /// Size of the padding between frames in pixel. Default value is `2`
27    pub texture_padding: u32,
28    /// Size of the repeated pixels at the border of each image. Default value is `0`.
29    pub texture_extrusion: u32,
30
31    /// True to trim the empty pixels of the input images. Default value is `true`.
32    pub trim: bool,
33
34    /// True to draw the red line on the edge of the each frames. Useful for debugging. Default
35    /// value is `false`.
36    pub texture_outlines: bool,
37}
38
39impl Default for TexturePackerConfig {
40    fn default() -> TexturePackerConfig {
41        TexturePackerConfig {
42            max_width: 1024,
43            max_height: 1024,
44            allow_rotation: true,
45
46            force_max_dimensions: false,
47            border_padding: 0,
48            texture_padding: 2,
49            texture_extrusion: 0,
50
51            trim: true,
52
53            texture_outlines: false,
54        }
55    }
56}