mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-14 22:42:46 +00:00
Adds crates/texture (craft-texture), the first step of RFC-0032 (storytold/craft-contrib#50). The code comes from MaterialCraft crates/image/src/lib.rs at 31330629, with its six tests unchanged. No app uses the crate yet. Changes from the source: - Image fields are private; from_data checks the size and the buffer length, so a zero side can no longer reach a panic and a short buffer is rejected instead of read with defaults. - Limits caps the side, pixels and bytes; the try_ constructors and try_map, try_to_kind, try_resize and try_to_rgba8_display reserve memory first and return an error. - Repeat sampling reduces the coordinate to its fractional part, so the period holds at large coordinates. - Bilinear sampling sums the four weighted texels and skips zero weights; box shrinking sums in f64. - generate_uv clamps the size before computing pixel centers. - linear_to_srgb(NaN) returns NaN. - rayon is behind the parallel feature.
20 lines
408 B
TOML
20 lines
408 B
TOML
[package]
|
|
name = "craft-texture"
|
|
description = "Bounded linear float image planes and texture sampling"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
repository.workspace = true
|
|
|
|
[features]
|
|
default = []
|
|
parallel = ["dep:rayon"]
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
rayon = { workspace = true, optional = true }
|
|
thiserror = { workspace = true }
|