Skip to main content

mln_engine/image/
mod.rs

1//! Images: the codecs, ports of those `include/mln/util/image.hpp` declares
2//! (`decodeImage`, `encodePNG`), from
3//! `platform/default/src/mln/util/{image,jpeg_reader,png_reader,png_writer}.cpp`.
4//!
5//! C++ throws `std::runtime_error`; here the functions return
6//! `Err(message)` with the same message.
7//!
8//! Port-only: `decoder::decode` is how the map's code decodes images: with
9//! `decode_image` natively, and with the browser's decoders on wasm.
10//!
11//! The style's images, as the renderer's layouts request them, are in
12//! `image_store`, and the sprite parser in [`sprite`].
13
14#[cfg(target_family = "wasm")]
15mod browser_decoder;
16pub(crate) mod decoder;
17#[expect(clippy::module_inception, reason = "`image::image` holds `decode_image`")]
18mod image;
19pub(crate) mod image_store;
20#[cfg(not(target_family = "wasm"))]
21mod jpeg_reader;
22mod png_reader;
23pub(crate) mod png_writer;
24pub(crate) mod premultiply;
25pub mod sprite;
26mod webp_reader;
27
28pub use image::decode_image;
29pub use image_store::{ImageStore, ImageType};
30pub use png_reader::decode_png;
31pub use png_writer::encode_png;