feat: implement layer mask editing support with scratch buffer and coordinate normalization
mandatory-regression-gate / deterministic-tests (push) Has been cancelled
mandatory-regression-gate / protected-performance-path (push) Has been cancelled

This commit is contained in:
Your Name
2026-07-24 06:01:30 +03:00
parent 7496f5e208
commit 505562424b
16 changed files with 1224 additions and 155 deletions
+17 -1
View File
@@ -615,7 +615,7 @@ pub fn parse_psd_sequential_full(bytes: &[u8]) -> Result<ParsedPsdData, String>
let mut mask_default_color = 0;
for channel in &layer.channels {
if channel.id == -2 {
if (channel.id == -2 || channel.id == -3) && decompressed_mask.is_none() {
if let Some(mask) = &layer.mask_info {
let w = (mask.right - mask.left) as u32;
let h = (mask.bottom - mask.top) as u32;
@@ -892,3 +892,19 @@ pub fn import_psd(path: &Path) -> Result<Vec<hcie_protocol::Layer>, String> {
Ok(flat_layers)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_example3_mask_import() {
let path = std::path::Path::new("/mnt/extra/00_PROJECTS/hcie-rust-v3.05/_images/_test_images/example3/Example3-mini.psd");
if path.exists() {
let layers = import_psd(path).expect("import_psd failed");
for l in &layers {
println!("TEST_LAYER: '{}' has_mask={} bounds={:?}", l.name, l.mask_pixels.is_some(), l.mask_bounds);
}
}
}
}