New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add type .ico #1
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,8 @@ pub enum Type { | |
Rgb, | ||
/// FLIF (Free Lossless Image Format) files | ||
Flif, | ||
/// ICO files | ||
ICO | ||
} | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ const BMP: &'static [u8] = b"BM"; | |
const BGP: &'static [u8] = b"BPG\xfb"; | ||
const RGB: &'static [u8] = b"\x01\xda"; | ||
const FLIF: &'static [u8] = b"FLIF"; | ||
const ICO: &'static [u8] = b"\x00\x00\x01\x00"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't seen them either. Also, it isn't listed as one of image's supported file types. |
||
|
||
#[inline] | ||
fn is_pbm(ref bytes: [u8; 32]) -> bool { | ||
|
@@ -51,6 +52,7 @@ pub fn guess(ref bytes: [u8; 32]) -> Option<Type> { | |
_ if &bytes[..4] == BGP => Some(Type::Bgp), | ||
_ if &bytes[..2] == RGB => Some(Type::Rgb), | ||
_ if &bytes[..4] == FLIF => Some(Type::Flif), | ||
_ if &bytes[..4] == ICO => Some(Type::ICO), | ||
_ if is_pbm(*bytes) => Some(Type::Pbm), | ||
_ if is_pgm(*bytes) => Some(Type::Pgm), | ||
_ if is_ppm(*bytes) => Some(Type::Ppm), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum variants should be in UpperCamelCase, like an
Ico