mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-16 20:25:02 +00:00
Allow alpha in IFF compatibility encoder
This commit is contained in:
@@ -9,8 +9,8 @@ pub fn decode(bytes: &[u8], limits: &Limits) -> Result<Image, CodecError> {
|
||||
bridge::format(Format::Iff, bytes, limits)
|
||||
}
|
||||
pub fn encode(image: &Image) -> Result<Vec<u8>, CodecError> {
|
||||
if image.layout() != crate::ChannelLayout::Rgb || image.sample_type() != crate::SampleType::U8 {
|
||||
return Err(CodecError::encode("IFF", "ILBM writer stores 8-bit RGB pixels"));
|
||||
if !matches!(image.layout(), crate::ChannelLayout::Rgb | crate::ChannelLayout::Rgba) || image.sample_type() != crate::SampleType::U8 {
|
||||
return Err(CodecError::encode("IFF", "ILBM writer stores 8-bit RGB pixels with optional alpha"));
|
||||
}
|
||||
bridge::encode(image, Format::Iff, &Default::default())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user