#![no_std]
#![warn(missing_docs)]
#![forbid(unsafe_code)]
#![allow(unused_labels)]
#![allow(clippy::drop_copy)]
#![allow(clippy::get_first)]
#![allow(non_upper_case_globals)]
#![allow(clippy::upper_case_acronyms)]
#![cfg_attr(docs_rs, feature(doc_cfg))]
#![warn(missing_debug_implementations)]
#![warn(clippy::missing_inline_in_public_items)]
#[cfg(feature = "alloc")]
extern crate alloc;
use pixel_formats::*;
mod ascii_array;
mod error;
mod util;
mod borrowed_bitmap;
pub use self::{borrowed_bitmap::BorrowedBitmap, error::*};
#[cfg(feature = "alloc")]
#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
mod alloc_bitmap;
#[cfg(feature = "alloc")]
#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
pub use self::alloc_bitmap::{Bitmap, Palmap};
#[cfg(feature = "png")]
#[cfg_attr(docs_rs, doc(cfg(feature = "png")))]
pub mod png;
#[cfg(feature = "bmp")]
#[cfg_attr(docs_rs, doc(cfg(feature = "bmp")))]
pub mod bmp;
#[cfg(feature = "netpbm")]
#[cfg_attr(docs_rs, doc(cfg(feature = "netpbm")))]
pub mod netpbm;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[allow(nonstandard_style)]
#[allow(missing_docs)]
pub enum sRGBIntent {
Perceptual,
RelativeColorimetric,
Saturation,
AbsoluteColorimetric,
}
#[inline]
#[cfg(feature = "alloc")]
#[cfg_attr(docs_rs, doc(cfg(feature = "alloc")))]
pub fn try_bitmap_rgba<P>(
bytes: &[u8], origin_top_left: bool,
) -> Result<crate::Bitmap<P>, ImagineError>
where
P: Copy + From<r32g32b32a32_Sfloat>,
{
#[cfg(feature = "png")]
if let Ok(bitmap) = png::png_try_bitmap_rgba(bytes, origin_top_left) {
return Ok(bitmap);
}
#[cfg(feature = "bmp")]
if let Ok(bitmap) = bmp::bmp_try_bitmap_rgba(bytes, origin_top_left) {
return Ok(bitmap);
}
#[cfg(feature = "netpbm")]
if let Ok(bitmap) = netpbm::netpbm_try_bitmap_rgba(bytes, origin_top_left) {
return Ok(bitmap);
}
Err(ImagineError::Parse)
}