mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-16 23:42:27 +00:00
Format Sun Raster feature gates
This commit is contained in:
1 parent
741323cbc3
commit
d7696c4c76
3 files changed
+25
-11
No files matched your search
@@ -18,10 +18,10 @@ pub(crate) mod jxl;
|
||||
pub(crate) mod pcx;
|
||||
pub(crate) mod png;
|
||||
pub(crate) mod pnm;
|
||||
#[cfg(feature = "sunraster")]
|
||||
pub(crate) mod sunraster;
|
||||
#[cfg(feature = "sgi")]
|
||||
pub(crate) mod sgi;
|
||||
#[cfg(feature = "sunraster")]
|
||||
pub(crate) mod sunraster;
|
||||
pub(crate) mod tga;
|
||||
pub(crate) mod tiff;
|
||||
pub(crate) mod tiff_exif;
|
||||
|
||||
@@ -328,7 +328,13 @@ pub fn caps(format: Format) -> FormatCaps {
|
||||
Format::Cineon => FormatCaps { depths: &[S::U16], layouts: &[L::Gray, L::Rgb], alpha: false, ..base },
|
||||
Format::Dicom => FormatCaps { read: true, write: false, depths: &[S::U8, S::U16], layouts: &[L::Gray, L::Rgb], alpha: false, ..base },
|
||||
Format::Iff => FormatCaps { depths: &[S::U8], layouts: &[L::Rgb, L::Rgba], alpha: true, ..base },
|
||||
Format::SunRaster => FormatCaps { read: cfg!(feature = "sunraster"), write: cfg!(feature = "sunraster"), layouts: &[L::Gray, L::Rgb, L::Rgba], alpha: true, ..base },
|
||||
Format::SunRaster => FormatCaps {
|
||||
read: cfg!(feature = "sunraster"),
|
||||
write: cfg!(feature = "sunraster"),
|
||||
layouts: &[L::Gray, L::Rgb, L::Rgba],
|
||||
alpha: true,
|
||||
..base
|
||||
},
|
||||
Format::Sgi => {
|
||||
FormatCaps { read: cfg!(feature = "sgi"), write: cfg!(feature = "sgi"), depths: &[S::U8, S::U16], layouts: RGB_GRAY, alpha: true, ..base }
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ pub use crate::resolution::{exif_resolution, export_exif, export_xmp, photoshop_
|
||||
pub use crate::source_settings::{WebpEncoding, jpeg_quality, webp_encoding};
|
||||
pub use half::f16;
|
||||
|
||||
#[cfg(feature = "sunraster")]
|
||||
use crate::codecs::sunraster;
|
||||
#[cfg(feature = "sgi")]
|
||||
use crate::codecs::sgi;
|
||||
#[cfg(feature = "sunraster")]
|
||||
use crate::codecs::sunraster;
|
||||
use crate::codecs::{dds, dicom, dpx, exr, fits, heif, iff, jp2, jpeg, jpegls, jxl, pcx, png, pnm, tiff, via_image, webp, xpm};
|
||||
|
||||
/// Detect the format and decode with default [`Limits`].
|
||||
@@ -109,10 +109,14 @@ pub fn decode_as_with(format: Format, bytes: &[u8], opts: &DecodeOptions) -> Res
|
||||
Format::Iff => iff::decode(bytes, l),
|
||||
Format::SunRaster => {
|
||||
#[cfg(feature = "sunraster")]
|
||||
{ sunraster::decode(bytes, l) }
|
||||
{
|
||||
sunraster::decode(bytes, l)
|
||||
}
|
||||
#[cfg(not(feature = "sunraster"))]
|
||||
{ Err(CodecError::unsupported(format, "Sun Raster support requires the sunraster feature")) }
|
||||
},
|
||||
{
|
||||
Err(CodecError::unsupported(format, "Sun Raster support requires the sunraster feature"))
|
||||
}
|
||||
}
|
||||
Format::Sgi => {
|
||||
#[cfg(feature = "sgi")]
|
||||
{
|
||||
@@ -482,10 +486,14 @@ pub fn encode(image: &Image, format: Format, opts: &EncodeOptions) -> Result<Vec
|
||||
Format::Iff => iff::encode(image, plan),
|
||||
Format::SunRaster => {
|
||||
#[cfg(feature = "sunraster")]
|
||||
{ sunraster::encode(image, plan) }
|
||||
{
|
||||
sunraster::encode(image, plan)
|
||||
}
|
||||
#[cfg(not(feature = "sunraster"))]
|
||||
{ Err(CodecError::unsupported(format, "Sun Raster support requires the sunraster feature")) }
|
||||
},
|
||||
{
|
||||
Err(CodecError::unsupported(format, "Sun Raster support requires the sunraster feature"))
|
||||
}
|
||||
}
|
||||
Format::Sgi => {
|
||||
#[cfg(feature = "sgi")]
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user