- pub fn is_be(&self) -> bool { self.be }
- pub fn has_alpha(&self) -> bool { self.alpha }
- pub fn is_paletted(&self) -> bool { self.palette }
- pub fn get_elem_size(&self) -> u8 { self.elem_size }
+ /// Reports whether the packing format is big-endian.
+ pub fn is_be(self) -> bool { self.be }
+ /// Reports whether colourspace has alpha component.
+ pub fn has_alpha(self) -> bool { self.alpha }
+ /// Reports whether this is paletted format.
+ pub fn is_paletted(self) -> bool { self.palette }
+ /// Returns single packed pixel size.
+ pub fn get_elem_size(self) -> u8 { self.elem_size }
+ /// Reports whether the format is not packed.
+ pub fn is_unpacked(&self) -> bool {
+ if self.palette { return false; }
+ for chr in self.comp_info.iter() {
+ if let Some(ref chromaton) = chr {
+ if chromaton.is_packed() { return false; }
+ }
+ }
+ true
+ }
+ /// Returns the maximum component bit depth.
+ pub fn get_max_depth(&self) -> u8 {
+ let mut mdepth = 0;
+ for chr in self.comp_info.iter() {
+ if let Some(ref chromaton) = chr {
+ mdepth = mdepth.max(chromaton.depth);
+ }
+ }
+ mdepth
+ }
+ /// Returns the maximum component subsampling.
+ pub fn get_max_subsampling(&self) -> u8 {
+ let mut ssamp = 0;
+ for chr in self.comp_info.iter() {
+ if let Some(ref chromaton) = chr {
+ let (ss_v, ss_h) = chromaton.get_subsampling();
+ ssamp = ssamp.max(ss_v).max(ss_h);
+ }
+ }
+ ssamp
+ }