@@ -5,12 +5,13 @@ use crate::{compute_output_size_sharpen, fetch_magic_wand, Crop, ImageConfig, Im
55
66#[ derive( Debug ) ]
77struct ICOConfigInner {
8- strip_metadata : bool ,
9- width : u16 ,
10- height : u16 ,
11- crop : Option < Crop > ,
12- shrink_only : bool ,
13- sharpen : f64 ,
8+ strip_metadata : bool ,
9+ width : u16 ,
10+ height : u16 ,
11+ crop : Option < Crop > ,
12+ shrink_only : bool ,
13+ sharpen : f64 ,
14+ respect_orientation : bool ,
1415}
1516
1617impl ICOConfigInner {
@@ -25,6 +26,7 @@ impl ICOConfigInner {
2526 crop : config. crop ,
2627 shrink_only : false ,
2728 sharpen : config. sharpen ,
29+ respect_orientation : config. respect_orientation ,
2830 } ) ;
2931 }
3032
@@ -36,13 +38,15 @@ impl ICOConfigInner {
3638/// The output config of an ICO image.
3739pub struct ICOConfig {
3840 /// Remove the metadata stored in the input image.
39- pub strip_metadata : bool ,
41+ pub strip_metadata : bool ,
4042 /// The size of the output image, made up of a width and a height. `0` means the original width or the original height.
41- pub size : Vec < ( u16 , u16 ) > ,
43+ pub size : Vec < ( u16 , u16 ) > ,
4244 /// Crop the image.
43- pub crop : Option < Crop > ,
45+ pub crop : Option < Crop > ,
4446 /// The higher the sharper. A negative value means auto adjustment.
45- pub sharpen : f64 ,
47+ pub sharpen : f64 ,
48+ /// Apply orientation from image metadata if available.
49+ pub respect_orientation : bool ,
4650}
4751
4852impl ICOConfig {
@@ -53,15 +57,17 @@ impl ICOConfig {
5357 /// size: Vec::with_capacity(1),
5458 /// crop: None,
5559 /// sharpen: -1f64,
60+ /// respect_orientation: false,
5661 /// }
5762 /// ```
5863 #[ inline]
5964 pub fn new ( ) -> ICOConfig {
6065 ICOConfig {
61- strip_metadata : true ,
62- size : Vec :: with_capacity ( 1 ) ,
63- crop : None ,
64- sharpen : -1f64 ,
66+ strip_metadata : true ,
67+ size : Vec :: with_capacity ( 1 ) ,
68+ crop : None ,
69+ sharpen : -1f64 ,
70+ respect_orientation : false ,
6571 }
6672 }
6773}
@@ -103,6 +109,11 @@ impl ImageConfig for ICOConfigInner {
103109 fn is_shrink_only ( & self ) -> bool {
104110 self . shrink_only
105111 }
112+
113+ #[ inline]
114+ fn respect_orientation ( & self ) -> bool {
115+ self . respect_orientation
116+ }
106117}
107118
108119/// Convert an image to an ICO image.
0 commit comments