bevy_image: PCX image support (off by default)

This commit is contained in:
Nick Thomas 2024-11-01 19:41:14 +00:00
parent 17e504812b
commit f4aa48a11b
7 changed files with 23 additions and 4 deletions

View file

@ -277,6 +277,9 @@ ico = ["bevy_internal/ico"]
# JPEG image format support
jpeg = ["bevy_internal/jpeg"]
# PCX image format support
pcx = ["bevy_internal/pcx"]
# PNG image format support
png = ["bevy_internal/png"]

View file

@ -20,6 +20,7 @@ hdr = ["image/hdr"]
ktx2 = ["dep:ktx2"]
ico = ["image/ico"]
jpeg = ["image/jpeg"]
pcx = ["image/pcx"]
png = ["image/png"]
pnm = ["image/pnm"]
qoi = ["image/qoi"]
@ -44,7 +45,7 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.15.0-dev", features = [
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
# rendering
image = { version = "0.25.2", default-features = false }
image = { version = "*", git = "https://github.com/image-rs/image.git", default-features = false }
# misc
bitflags = { version = "2.3", features = ["serde"] }

View file

@ -49,6 +49,8 @@ pub enum ImageFormat {
Jpeg,
#[cfg(feature = "ktx2")]
Ktx2,
#[cfg(feature = "pcx")]
Pcx,
#[cfg(feature = "png")]
Png,
#[cfg(feature = "pnm")]
@ -99,10 +101,12 @@ impl ImageFormat {
ImageFormat::Jpeg => &["jpg", "jpeg"],
#[cfg(feature = "ktx2")]
ImageFormat::Ktx2 => &["ktx2"],
#[cfg(feature = "pnm")]
ImageFormat::Pnm => &["pam", "pbm", "pgm", "ppm"],
#[cfg(feature = "pcx")]
ImageFormat::Pcx => &["pcx"],
#[cfg(feature = "png")]
ImageFormat::Png => &["png"],
#[cfg(feature = "pnm")]
ImageFormat::Pnm => &["pam", "pbm", "pgm", "ppm"],
#[cfg(feature = "qoi")]
ImageFormat::Qoi => &["qoi"],
#[cfg(feature = "tga")]
@ -140,6 +144,8 @@ impl ImageFormat {
ImageFormat::Jpeg => &["image/jpeg"],
#[cfg(feature = "ktx2")]
ImageFormat::Ktx2 => &["image/ktx2"],
#[cfg(feature = "pcx")]
ImageFormat::Pcx => &["image/vnd.zbrush.pcx", "image/x-pcx"],
#[cfg(feature = "png")]
ImageFormat::Png => &["image/png"],
#[cfg(feature = "qoi")]
@ -177,6 +183,7 @@ impl ImageFormat {
"image/x-icon" => feature_gate!("ico", Ico),
"image/jpeg" => feature_gate!("jpeg", Jpeg),
"image/ktx2" => feature_gate!("ktx2", Ktx2),
"image/vnd.zbrush.pcx" | "image/x-pcx" => feature_gate!("pcx", Pcx),
"image/png" => feature_gate!("png", Png),
"image/qoi" | "image/x-qoi" => feature_gate!("qoi", Qoi),
"image/x-exr" => feature_gate!("exr", OpenExr),
@ -205,6 +212,7 @@ impl ImageFormat {
"jpg" | "jpeg" => feature_gate!("jpeg", Jpeg),
"ktx2" => feature_gate!("ktx2", Ktx2),
"pam" | "pbm" | "pgm" | "ppm" => feature_gate!("pnm", Pnm),
"pcx" => feature_gate!("pcx", Pcx),
"png" => feature_gate!("png", Png),
"qoi" => feature_gate!("qoi", Qoi),
"tga" => feature_gate!("tga", Tga),
@ -233,6 +241,8 @@ impl ImageFormat {
ImageFormat::Ico => image::ImageFormat::Ico,
#[cfg(feature = "jpeg")]
ImageFormat::Jpeg => image::ImageFormat::Jpeg,
#[cfg(feature = "pcx")]
ImageFormat::Pcx => image::ImageFormat::Pcx,
#[cfg(feature = "png")]
ImageFormat::Png => image::ImageFormat::Png,
#[cfg(feature = "pnm")]
@ -266,6 +276,7 @@ impl ImageFormat {
image::ImageFormat::Hdr => feature_gate!("hdr", Hdr),
image::ImageFormat::Ico => feature_gate!("ico", Ico),
image::ImageFormat::Jpeg => feature_gate!("jpeg", Jpeg),
image::ImageFormat::Pcx => feature_gate!("pcx", Pcx),
image::ImageFormat::Png => feature_gate!("png", Png),
image::ImageFormat::Pnm => feature_gate!("pnm", Pnm),
image::ImageFormat::Qoi => feature_gate!("qoi", Qoi),

View file

@ -30,6 +30,8 @@ impl ImageLoader {
ImageFormat::Jpeg,
#[cfg(feature = "ktx2")]
ImageFormat::Ktx2,
#[cfg(feature = "pcx")]
ImageFormat::Pcx,
#[cfg(feature = "png")]
ImageFormat::Png,
#[cfg(feature = "pnm")]

View file

@ -50,6 +50,7 @@ ff = ["bevy_image/ff"]
gif = ["bevy_image/gif"]
ico = ["bevy_image/ico"]
jpeg = ["bevy_image/jpeg"]
pcx = ["bevy_image/pcx"]
png = ["bevy_image/png"]
pnm = ["bevy_image/pnm"]
qoi = ["bevy_image/qoi"]

View file

@ -59,7 +59,7 @@ bevy_image = { path = "../bevy_image", version = "0.15.0-dev" }
bevy_mesh = { path = "../bevy_mesh", version = "0.15.0-dev" }
# rendering
image = { version = "0.25.2", default-features = false }
image = { version = "*", git = "https://github.com/image-rs/image.git", default-features = false }
# misc
codespan-reporting = "0.11.0"

View file

@ -85,6 +85,7 @@ The default feature set enables most of the expected features of a game engine,
|pbr_multi_layer_material_textures|Enable support for multi-layer material textures in the `StandardMaterial`, at the risk of blowing past the global, per-shader texture limit on older/lower-end GPUs|
|pbr_pcss|Enable support for PCSS, at the risk of blowing past the global, per-shader sampler limit on older/lower-end GPUs|
|pbr_transmission_textures|Enable support for transmission-related textures in the `StandardMaterial`, at the risk of blowing past the global, per-shader texture limit on older/lower-end GPUs|
|pcx|PCX image format support|
|pnm|PNM image format support, includes pam, pbm, pgm and ppm|
|qoi|QOI image format support|
|reflect_functions|Enable function reflection|