PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge PR #5864: fix(codecs): respect uncompressed DDS row pitch
aionggcc390f34de7c
diff --cc crates/codecs/README.mdindex acce7ea92,8610a6bb1..25dbdc361--- a/crates/codecs/README.md+++ b/crates/codecs/README.md@@@ -75,17 -71,10 +75,18 @@@ embedded table (and a PNG's transparen* **DDS.** The top mip level of a 2D texture: uncompressed pixels described by channel masks(8, 16, 24 or 32 bits, RGB or luminance, with or without alpha) or BC1/BC2/BC3 (DXT1/DXT3/DXT5),- with the legacy header or the DX10 one. Everything opens as U8; the other mip levels are- ignored. Cubemaps, texture arrays, volume textures, premultiplied DXT2/DXT4 and other formats+ with the legacy header or the DX10 one. Uncompressed row padding follows the header's- `DDSD_PITCH` stride; without that flag, rows are tightly packed. Everything opens as U8;- the other mip levels are ignored. Cubemaps, texture arrays, volume textures, premultiplied DXT2/DXT4 and other formats- (BC4–BC7, float) are refused with `CodecError::Unsupported`. Writing is not provided.++ `DDSD_PITCH` stride; without that flag, rows are tightly packed. Everything opens as U8; the++ other mip levels are ignored. Cubemaps, texture arrays, volume textures, premultiplied DXT2/DXT4 and other formats+ (BC4–BC7, float) are refused with `CodecError::Unsupported`. Writing (`EncodeOptions::dds`) makes+ a 2D texture with the legacy header: uncompressed by default (BGRA, BGRX, or luminance with or+ without alpha, so it reads back exactly), or BC1/BC2/BC3. The block encoder is our own, from+ Microsoft's public block-compression documentation: RGB565 endpoints fitted along each block's+ principal axis and refined by least squares, indices picked against the palette the reader+ decodes; BC1 turns texels under half opacity into its transparent black, and BC3 picks+ whichever alpha mode fits. `mipmaps` adds the full chain down to 1×1, each level a box filter+ of the one above (the last column and row of an odd-sized level average three pixels, so none+ is dropped). Cubemaps, arrays, BC4–BC7 and sRGB (DX10-only) formats aren't written.* **FITS.** The image in the primary HDU, or the first `IMAGE` extension, is read; `NAXIS3 = 3`opens as RGB and any other plane count opens the first plane with `DecodeWarning::MorePages`.