Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge main into integration-10

aionggf32f882f3a58
diff --cc apps/photocraft-web/src/web.rs
index 74f37aaa3,0bec8646c..74f22b1ad
--- a/apps/photocraft-web/src/web.rs
+++ b/apps/photocraft-web/src/web.rs
@@@ -17,11 -17,11 +17,11 @@@ use wasm_bindgen::JsCast as _
type Inbox = Arc<Mutex<Vec<(String, Vec<u8>)>>>;
/// Everything File › Open reads: PhotoCraft, Photoshop, OpenRaster, Krita and Affinity documents, flat images, and
-/// Photoshop brushes (.abr), gradients (.grd) and swatches (.aco, .ase), which go to the preset libraries.
+/// Photoshop brushes (.abr), gradients (.grd) and swatches (.aco, .act, .ase), which go to the preset libraries.
const OPEN_EXTS: &[&str] = &[
- "pcraft", "pdn", "ora", "kra", "krz", "psd", "psb", "psdt", "png", "jpg", "jpeg", "tif", "tiff", "webp", "gif", "bmp", "tga", "ico", "qoi", "exr", "hdr",
- "pbm", "pgm", "ppm", "pam", "pfm", "dds", "fits", "fit", "fts", "dpx", "cin", "heic", "heif", "hif", "dng", "cr2", "cr3", "nef", "nrw", "arw", "pef",
- "orf", "rw2", "raf", "abr", "grd", "svg", "svgz", "aco", "act", "ase", "af", "afdesign", "afphoto", "afpub",
+ "pcraft", "pdn", "ora", "xcf", "xcfgz", "gz", "kra", "krz", "psd", "psb", "psdt", "png", "jpg", "jpeg", "tif", "tiff", "webp", "gif", "bmp", "tga", "ico",
+ "qoi", "exr", "hdr", "pbm", "pgm", "ppm", "pam", "pfm", "dds", "fits", "fit", "fts", "dpx", "cin", "heic", "heif", "hif", "dng", "cr2", "cr3", "nef",
- "nrw", "arw", "pef", "orf", "rw2", "raf", "abr", "grd", "svg", "svgz", "aco", "ase", "af", "afdesign", "afphoto", "afpub",
++ "nrw", "arw", "pef", "orf", "rw2", "raf", "abr", "grd", "svg", "svgz", "aco", "act", "ase", "af", "afdesign", "afphoto", "afpub",
];
const SVG_EXTS: &[&str] = &["svg", "svgz"];
const CANVAS_ID: &str = "photocraft_canvas";
diff --cc apps/photocraft/src/services.rs
index 2a6f53dd0,082506e92..84a15c8d5
--- a/apps/photocraft/src/services.rs
+++ b/apps/photocraft/src/services.rs
@@@ -17,12 -17,12 +17,12 @@@ use std::sync::Arc
mod recovery_tests;
/// Everything File › Open reads: PhotoCraft, Photoshop, OpenRaster, Krita and Affinity documents, flat images, and
-/// Photoshop brushes (.abr), gradients (.grd), swatches (.aco, .ase) and keyboard shortcut sets
+/// Photoshop brushes (.abr), gradients (.grd), swatches (.aco, .act, .ase) and keyboard shortcut sets
/// (.kys), which go to the preset libraries and Edit › Keyboard Shortcuts.
const OPEN_EXTS: &[&str] = &[
- "pcraft", "pdn", "ora", "kra", "krz", "psd", "psb", "psdt", "png", "jpg", "jpeg", "tif", "tiff", "webp", "gif", "bmp", "tga", "ico", "qoi", "exr", "hdr",
- "pbm", "pgm", "ppm", "pam", "pfm", "pcx", "dds", "xpm", "fits", "fit", "fts", "dpx", "cin", "heic", "heif", "hif", "dng", "cr2", "cr3", "nef", "nrw",
- "arw", "pef", "orf", "rw2", "raf", "abr", "grd", "svg", "svgz", "aco", "act", "ase", "kys", "af", "afdesign", "afphoto", "afpub",
+ "pcraft", "pdn", "ora", "xcf", "xcfgz", "gz", "kra", "krz", "psd", "psb", "psdt", "png", "jpg", "jpeg", "tif", "tiff", "webp", "gif", "bmp", "tga", "ico",
+ "qoi", "exr", "hdr", "pbm", "pgm", "ppm", "pam", "pfm", "pcx", "dds", "xpm", "fits", "fit", "fts", "dpx", "cin", "heic", "heif", "hif", "dng", "cr2",
- "cr3", "nef", "nrw", "arw", "pef", "orf", "rw2", "raf", "abr", "grd", "svg", "svgz", "aco", "ase", "kys", "af", "afdesign", "afphoto", "afpub",
++ "cr3", "nef", "nrw", "arw", "pef", "orf", "rw2", "raf", "abr", "grd", "svg", "svgz", "aco", "act", "ase", "kys", "af", "afdesign", "afphoto", "afpub",
];
const SVG_EXTS: &[&str] = &["svg", "svgz"];
diff --cc crates/engine/src/file_cmds/tests.rs
index 2fa6f98e2,947738b0f..913335afe
--- a/crates/engine/src/file_cmds/tests.rs
+++ b/crates/engine/src/file_cmds/tests.rs
@@@ -1459,9 -1459,14 +1459,21 @@@ fn batch_naming_rejects_outputs_that_re
assert_eq!(std::fs::read(&second).unwrap(), before[1]);
}
+#[test]
+fn exposure_text_near_one_second_is_not_one_over_one() {
+ assert_eq!(exposure_text(0.996).as_deref(), Some("1 s"));
+ assert_eq!(exposure_text(0.99).as_deref(), Some("0.99 s"));
+ assert_eq!(exposure_text(1.0 / 250.0).as_deref(), Some("1/250 s"));
+}
++
+ /// A folder batch picks up GIMP's gzipped `.xcf.gz`, whose last extension alone (`gz`) says nothing.
+ #[cfg(not(target_arch = "wasm32"))]
+ #[test]
+ fn folder_listing_recognises_gzipped_xcf_by_its_double_extension() {
+ assert!(super::openable_name("/scans/page 01.xcf.gz"));
+ assert!(super::openable_name("C:\\scans\\PAGE.XCF.GZ"));
+ assert!(super::openable_name("page.xcfgz"));
+ assert!(super::openable_name("page.PNG"));
+ assert!(!super::openable_name("archive.tar.gz"));
+ assert!(!super::openable_name("notes.txt"));
+ }
diff --cc crates/engine/src/float_cmds.rs
index 71e343efc,8e180d413..bffb67076
--- a/crates/engine/src/float_cmds.rs
+++ b/crates/engine/src/float_cmds.rs
@@@ -61,39 -62,21 +62,21 @@@ impl CutParts
let mut piece = Surface::new(with_alpha);
let fill = !copy && (mask || doc.is_background(layer));
// A mask's untouched pixels (its default, e.g. white) move too, so take the whole canvas.
- let b = sel.content_bounds().intersect(&if mask { doc.bounds() } else { surf.content_bounds() });
+ let b = sel.content_bounds().intersect(&if mask { doc.bounds() } else { base.content_bounds() });
if !b.is_empty() {
- let n = with_alpha.channels();
- let a = n - 1;
- let mut rp = full.read_region(b);
- let mut pp = rp.clone();
- let w = b.width() as usize;
- for (i, (p, r)) in pp.chunks_exact_mut(n).zip(rp.chunks_exact_mut(n)).enumerate() {
- let k = sel.sample_channel(b.x0 + (i % w) as i32, b.y0 + (i / w) as i32, 0);
- // The selection lifts its share of a pixel's coverage, up to all of it, and the
- // rest stays (Photoshop): a layer's own transparency, loaded as the selection,
- // lifts it whole and leaves no ghost behind (#7655). An opaque pixel splits as k
- // and 1 − k, as a product would.
- if k <= 0.0 {
- p.fill(0.0);
- } else {
- p[a] = p[a].min(k);
- }
- if !copy && !fill {
- r[a] = (r[a] - k).max(0.0);
- }
- }
- if !mask {
- rest.write_region(b, &rp);
- }
+ piece = cut_piece(&base, sel, b, with_alpha)?;
if fill {
- crate::pixels::try_fill_surface(&mut rest, b, background, Some(sel), true)?;
+ let opaque_bg = [background[0], background[1], background[2], 1.0];
+ crate::pixels::try_fill_surface(&mut rest, b, opaque_bg, Some(sel), false)?;
+ if mask {
+ rest.prune();
+ }
+ } else if !copy && !mask {
- crate::pixels::try_clear_surface(&mut rest, b, Some(sel))?;
++ crate::pixels::try_lift_coverage(&mut rest, b, sel)?;
}
- rest.prune();
- piece.write_region(b, &pp);
- piece.prune();
}
- Ok(Self { layer, rest, piece, mask })
+ let piece_bounds = piece.content_bounds();
+ Ok(Self { layer, rest, piece, piece_bounds, mask })
}
/// `doc` with the piece moved by whole pixels (dx, dy) over the cut-out layer.
@@@ -123,6 -110,100 +110,103 @@@
}
}
+ /// Extract the selected pixels of `base` over `b` into a `with_alpha` surface, tile by tile in
+ /// parallel. Fully selected tiles on an alpha surface share `base`'s `Arc<Tile>` directly.
+ fn cut_piece(base: &Surface, sel: &Surface, b: photocraft_geom::Rect, with_alpha: PixelFormat) -> Result<Surface> {
+ use photocraft_color::{SampleType, read_sample};
+ use photocraft_geom::{TILE_SIZE, TileCoord};
+ use photocraft_raster::Tile;
+ use rayon::prelude::*;
+
+ let mut piece = Surface::new(with_alpha);
+ let src_fmt = base.format();
+ let same_fmt = src_fmt == with_alpha;
+ let n = with_alpha.channels();
+ let a = n - 1;
+ let dst_bpp = with_alpha.bytes_per_pixel();
+ let src_bpp = src_fmt.bytes_per_pixel();
+ let sb = with_alpha.sample.bytes();
+ let alpha_off = dst_bpp - sb;
+ let src_empty_default = same_fmt && base.default_bytes().iter().all(|&v| v == 0);
+ let oom = |e| EngineError::Other(format!("not enough memory while floating selection ({e}); the document was not changed"));
+ let mut coords = crate::allocation::capacity(b.tiles().count(), "floating selection")?;
+ coords.extend(b.tiles());
+ let tiles = coords
+ .into_par_iter()
+ .map(|tc| -> Result<Option<(TileCoord, Arc<Tile>)>> {
+ let tr = tc.rect().intersect(&b);
+ let mask = crate::fill_cmds::Mask::of(sel, tc);
+ if mask.empty(tr) {
+ return Ok(None);
+ }
+ let src_tile = base.tile(tc);
+ if same_fmt && src_tile.is_none() && src_empty_default {
+ return Ok(None);
+ }
+ if same_fmt
+ && tr == tc.rect()
+ && mask.full(tr)
+ && let Some(t) = src_tile
+ {
+ return Ok(Some((tc, t.clone())));
+ }
+ let src_bytes = src_tile.map_or(base.default_bytes(), |t| t.bytes());
+ let mut out = piece.try_default_tile().map_err(oom)?;
+ let out_bytes = out.bytes_mut();
+ let mut px = [0.0f32; 8];
+ let mut has_content = false;
+ for y in tr.y0..tr.y1 {
+ let row = (y - tc.ty * TILE_SIZE) as usize * TILE_SIZE as usize;
+ for x in tr.x0..tr.x1 {
+ let k = mask.at(x, y);
+ if k <= 0.0 {
+ continue;
+ }
+ let idx = row + (x - tc.tx * TILE_SIZE) as usize;
+ let dst_i = idx * dst_bpp;
+ let Some(dst_px) = out_bytes.get_mut(dst_i..dst_i + dst_bpp) else { continue };
+ let src_i = if src_bytes.len() == src_bpp { 0 } else { idx * src_bpp };
+ let Some(src_px) = src_bytes.get(src_i..src_i + src_bpp) else { continue };
+ if same_fmt && k >= 1.0 {
+ if src_px.iter().any(|&v| v != 0) {
+ dst_px.copy_from_slice(src_px);
+ has_content = true;
+ }
+ continue;
+ }
+ if same_fmt {
+ for (c, v) in px.iter_mut().enumerate().take(n) {
+ *v = read_sample(src_px, src_fmt.sample, c);
+ }
- px[a] *= k;
++ // The selection lifts its share of a pixel's coverage, up to all of it
++ // (Photoshop): a layer's own transparency, loaded as the selection, lifts
++ // it whole (#7655). An opaque pixel splits as k and 1 − k.
++ px[a] = px[a].min(k);
+ } else {
+ for (c, v) in px.iter_mut().enumerate().take(a) {
+ *v = read_sample(src_px, src_fmt.sample, c);
+ }
+ px[a] = k;
+ }
+ if px[a] <= 0.0 {
+ continue;
+ }
+ photocraft_raster::encode_pixel(&with_alpha, &px[..n], dst_px);
+ let non_zero = match with_alpha.sample {
+ SampleType::U8 => dst_px.get(alpha_off) != Some(&0) || dst_px.iter().any(|&v| v != 0),
+ SampleType::U16 => dst_px.get(alpha_off..dst_bpp) != Some(&[0, 0]) || dst_px.iter().any(|&v| v != 0),
+ SampleType::F32 => dst_px.iter().any(|&v| v != 0),
+ };
+ has_content |= non_zero;
+ }
+ }
+ Ok(has_content.then(|| (tc, Arc::new(out))))
+ })
+ .collect::<Result<Vec<_>>>()?;
+ piece.put_tiles(tiles.into_iter().flatten());
+ Ok(piece)
+ }
+
/// A piece floating `offset` whole pixels from where it was cut, over document `revision`.
#[derive(Clone, Debug)]
pub struct Floating {
diff --cc crates/engine/src/float_cmds/tests.rs
index 638051000,f4b9d4e12..130b07f2a
--- a/crates/engine/src/float_cmds/tests.rs
+++ b/crates/engine/src/float_cmds/tests.rs
@@@ -227,52 -227,62 +227,112 @@@ fn cutting_an_untouched_part_of_the_mas
assert_eq!(mask_at(&s, 40, 12), 0.0);
}
+/// #7655: a selection loaded from the layer's own transparency lifts its half-transparent pixels
+/// whole, leaving nothing behind (Photoshop); a half selection of an opaque pixel still splits it.
+#[test]
+fn a_layers_own_transparency_floats_its_soft_pixels_whole() {
+ let mut s = Session::new();
+ s.execute("file.new", json!({"width": 80, "height": 60, "background": "transparent"})).unwrap();
+ let id = s.active().unwrap().active_layer.unwrap();
+ s.edit("paint", |doc, _| {
+ let surf = doc.layer_mut(id).unwrap().surface_mut().unwrap();
+ surf.fill_rect(Rect::new(10, 10, 20, 30), &[1.0, 0.0, 0.0, 0.5]);
+ surf.fill_rect(Rect::new(20, 10, 30, 30), &[1.0, 0.0, 0.0, 1.0]);
+ Ok(())
+ })
+ .unwrap();
+ s.execute("select.loadSelection", json!({"channel": "transparency"})).unwrap();
+ s.execute("select.float", json!({"dx": 0, "dy": 25})).unwrap();
+ s.execute("select.drop", json!({})).unwrap();
+ let d = &s.active().unwrap().doc;
+ assert_eq!(alpha(d, id, 15, 20), 0.0, "no ghost where the soft pixels were");
+ assert!((alpha(d, id, 15, 45) - 0.5).abs() < 0.01, "they moved whole: {}", alpha(d, id, 15, 45));
+ assert_eq!((alpha(d, id, 25, 20), alpha(d, id, 25, 45)), (0.0, 1.0));
+
+ // A copy (⌥) of them is as solid as they are, as Photoshop's Layer via Copy of the same
+ // selection is, and leaves them where they were.
+ s.undo();
+ s.execute("select.loadSelection", json!({"channel": "transparency"})).unwrap();
+ s.execute("select.float", json!({"dx": 0, "dy": 25, "copy": true})).unwrap();
+ s.execute("select.drop", json!({})).unwrap();
+ let d = &s.active().unwrap().doc;
+ assert!((alpha(d, id, 15, 20) - 0.5).abs() < 0.01 && (alpha(d, id, 15, 45) - 0.5).abs() < 0.01, "{} {}", alpha(d, id, 15, 20), alpha(d, id, 15, 45));
+
+ // A half selection of an opaque pixel splits it half and half, as before.
+ let (mut s, id) = session();
+ s.execute("select.all", json!({})).unwrap();
+ s.edit("half", |doc, _| {
+ let sel = doc.selection.as_mut().unwrap();
+ sel.fill_rect(doc_rect(80, 60), &[0.5]);
+ Ok(())
+ })
+ .unwrap();
+ s.execute("select.float", json!({"dx": 40, "dy": 0})).unwrap();
+ s.execute("select.drop", json!({})).unwrap();
+ let d = &s.active().unwrap().doc;
+ assert!((alpha(d, id, 15, 15) - 0.5).abs() < 0.01 && (alpha(d, id, 55, 15) - 0.5).abs() < 0.01);
+}
+
+fn doc_rect(w: i32, h: i32) -> Rect {
+ Rect::new(0, 0, w, h)
+}
++
+ #[test]
+ fn float_shares_interior_tiles_on_cut_and_place() {
+ let mut s = Session::new();
+ s.execute("file.new", json!({"width": 1024, "height": 1024})).unwrap();
+ s.tools.background = [0.2, 0.4, 0.8, 1.0];
+ let id = s.active().unwrap().active_layer.unwrap();
+ // Paint non-uniform pixels so original tiles are distinct.
+ s.edit("pattern", |doc, _| {
+ let surf = doc.layer_mut(id).unwrap().surface_mut().unwrap();
+ for ty in 0..4 {
+ for tx in 0..4 {
+ surf.write_pixel(tx * 256 + 5, ty * 256 + 5, &[tx as f32 * 0.25, ty as f32 * 0.25, 0.5, 1.0]);
+ }
+ }
+ Ok(())
+ })
+ .unwrap();
+ // Select (100..900)^2, which fully covers interior tiles (1, 1) and (2, 2).
+ s.execute("select.rect", json!({"x": 100, "y": 100, "width": 800, "height": 800})).unwrap();
+ s.execute("select.float", json!({})).unwrap();
+ let st = s.active().unwrap();
+ let orig = st.doc.layer(id).unwrap().surface().unwrap();
+ let parts = &floating(st).unwrap().parts;
+ let tc1 = photocraft_geom::TileCoord { tx: 1, ty: 1 };
+ let tc2 = photocraft_geom::TileCoord { tx: 2, ty: 2 };
+ // Interior tiles of `piece` share the original layer's Arc<Tile>.
+ assert!(Arc::ptr_eq(orig.tile(tc1).unwrap(), parts.piece.tile(tc1).unwrap()));
+ assert!(Arc::ptr_eq(orig.tile(tc2).unwrap(), parts.piece.tile(tc2).unwrap()));
+ // Interior tiles of the Background hole in `rest` share one solid fill Arc<Tile>.
+ assert!(Arc::ptr_eq(parts.rest.tile(tc1).unwrap(), parts.rest.tile(tc2).unwrap()));
+ // Moving by a whole tile (256, 0) shares the interior tile directly in the preview document.
+ let shown = displayed(st, (256, 0)).unwrap();
+ let shown_surf = shown.layer(id).unwrap().surface().unwrap();
+ let moved_tc = photocraft_geom::TileCoord { tx: 2, ty: 1 };
+ assert!(Arc::ptr_eq(orig.tile(tc1).unwrap(), shown_surf.tile(moved_tc).unwrap()));
+ }
+
+ #[test]
+ fn float_feathered_selection_preserves_partial_alpha_across_depths() {
+ for depth in [8, 16, 32] {
+ let mut s = Session::new();
+ s.execute("file.new", json!({"width": 120, "height": 80, "background": "transparent", "depth": depth})).unwrap();
+ let id = s.active().unwrap().active_layer.unwrap();
+ s.edit("paint", |doc, _| {
+ doc.layer_mut(id).unwrap().surface_mut().unwrap().fill_rect(Rect::new(0, 0, 55, 80), &[1.0, 0.0, 0.0, 1.0]);
+ Ok(())
+ })
+ .unwrap();
+ s.execute("select.rect", json!({"x": 20, "y": 20, "width": 30, "height": 30, "feather": 4.0})).unwrap();
+ s.execute("select.float", json!({"dx": 40, "dy": 0})).unwrap();
+ s.execute("select.drop", json!({})).unwrap();
+ let surf = s.active().unwrap().doc.layer(id).unwrap().surface().unwrap();
+ // Center of moved piece is opaque red; center of hole is transparent; feathered edge has partial alpha.
+ assert!(surf.rgba(75, 35)[3] > 0.95, "{depth}-bit moved center");
+ assert!(surf.rgba(35, 35)[3] < 0.05, "{depth}-bit hole center");
+ let edge_a = surf.rgba(60, 35)[3];
+ assert!(edge_a > 0.1 && edge_a < 0.9, "{depth}-bit feathered edge alpha={edge_a}");
+ }
+ }
diff --cc crates/engine/src/pixels.rs
index b046de03b,c03d3dc61..dc4e531f5
--- a/crates/engine/src/pixels.rs
+++ b/crates/engine/src/pixels.rs
@@@ -294,11 -299,9 +299,33 @@@ pub(crate) fn try_clear_surface(s: &mu
px.fill(0.0);
}
true
- })?;
- s.prune();
- Ok(())
+ })
+ }
+
++/// Take the coverage a floating selection lifts out of `s` over `area`: each pixel loses its
++/// selection coverage k of alpha, down to none, so a selection made from the layer's own
++/// transparency leaves nothing behind (#7655), where [`try_clear_surface`] would leave a ghost.
++pub(crate) fn try_lift_coverage(s: &mut Surface, area: Rect, selection: &Surface) -> crate::Result<()> {
++ let fmt = s.format();
++ let n = fmt.channels();
++ if !fmt.alpha {
++ return Ok(());
++ }
++ let empty_default = s.default_bytes().iter().all(|&b| b == 0);
++ let whole = |full: bool| (full && empty_default).then_some(TileEdit::Drop);
++ edit_tiles(s, area, Some(selection), "lifting pixels", whole, |k, px| {
++ if k <= 0.0 {
++ return false;
++ }
++ let Some(a) = px.get_mut(n - 1) else { return false };
++ *a = (*a - k).max(0.0);
++ if *a <= 0.0 {
++ px.fill(0.0);
++ }
++ true
++ })
+}
+
/// A whole-tile shortcut of [`edit_tiles`].
enum TileEdit {
/// Replace the tile with this (shared) one.
diff --cc xtask/src/corpus.rs
index c65abba9f,10c528d5c..4cd276d6c
--- a/xtask/src/corpus.rs
+++ b/xtask/src/corpus.rs
@@@ -34,9 -34,8 +35,9 @@@ const CRITICAL: &[&str] = &
"crates/format/",
"crates/affinity/",
"crates/raw/",
+ "crates/engine/src/atn_cmds",
];
- /// `cargo xtask corpus [--all | --pngsuite | --download | --psd | --psd-tools | --heif | --exr | --pixls | --affinity | --atn | --photoshop [--local]] [--update-manifest]`
-/// `cargo xtask corpus [--all | --pngsuite | --download | --psd | --psd-tools | --heif | --exr | --pixls | --affinity | --photoshop [--local] | --gimp [--local]] [--update-manifest]`
++/// `cargo xtask corpus [--all | --pngsuite | --download | --psd | --psd-tools | --heif | --exr | --pixls | --affinity | --atn | --photoshop [--local] | --gimp [--local]] [--update-manifest]`
pub fn cmd(args: &[&str]) -> Result<(), String> {
let update = args.contains(&"--update-manifest");
let mut did = false;
diff --cc xtask/src/corpus_pins.rs
index bfb152b6d,24e777077..641d1ef26
--- a/xtask/src/corpus_pins.rs
+++ b/xtask/src/corpus_pins.rs
@@@ -239,75 -267,8 +267,75 @@@ pub const AFFINITY: PinnedCorpus = Pinn
)
},
};
+/// Photoshop Actions files (`.atn`) from public repositories under permissive licences, the
+/// real-file oracles of `photocraft-psd::atn` and the engine's `.atn` import (2026-10-12).
+/// https://github.com/sbaril/Photoshop-Scripts (MIT): `Actions/`.
+pub const SBARIL_COMMIT: &str = "622493c9c617c9d2ff38500e8e512c0ad421eed9";
+/// https://github.com/bjango/Bjango-Actions (BSD, `Help/License.md`): three sets at the root.
+pub const BJANGO_COMMIT: &str = "0fdc790b4931fd36816e6056dd84c2aa0d3ff054";
+/// https://github.com/BKWLD/photoshop-actions (MIT).
+pub const BKWLD_COMMIT: &str = "d1a5d24e02bf23f78659106473ef7d8c747bea00";
+/// https://github.com/mrijk/atntools (MIT): the fixture of a Rust `.atn` reader.
+pub const ATNTOOLS_COMMIT: &str = "529db30b631f32bc7970121af0393853c2154fa0";
+/// https://github.com/damsmcfly/photoshop-cleaner-trimmer (Unlicense).
+pub const TRIMMER_COMMIT: &str = "fd3814df2a625ed7a015633eb91d8fe2f5bbe9a0";
+/// https://github.com/uclagamelab/AlphaUtilityAdditions (BSD-2-Clause).
+pub const ALPHA_UTILITY_COMMIT: &str = "7bdae950a7db4c6c2224bcaf08f4c17ec18958cb";
+/// https://github.com/overbyte/photoshop-gif-creator-script (MIT).
+pub const GIF_CREATOR_COMMIT: &str = "9fb78e8c09a21678afc84ccb31a435bd242894df";
+
+/// `corpus/atn`: Photoshop Actions sets from seven public repositories, one folder each.
+pub const ATN: PinnedCorpus = PinnedCorpus {
+ name: "atn",
+ dest: "atn",
+ upstreams: &[
+ Upstream { prefix: "sbaril/", repo: "sbaril/Photoshop-Scripts", commit: SBARIL_COMMIT, subdir: "Actions", extras: &[("LICENSE", "sbaril/LICENSE")] },
+ Upstream { prefix: "bjango/", repo: "bjango/Bjango-Actions", commit: BJANGO_COMMIT, subdir: "", extras: &[("Help/License.md", "bjango/License.md")] },
+ Upstream { prefix: "bkwld/", repo: "BKWLD/photoshop-actions", commit: BKWLD_COMMIT, subdir: "", extras: &[("LICENSE", "bkwld/LICENSE")] },
+ Upstream { prefix: "atntools/", repo: "mrijk/atntools", commit: ATNTOOLS_COMMIT, subdir: "", extras: &[("LICENSE", "atntools/LICENSE")] },
+ Upstream {
+ prefix: "trimmer/",
+ repo: "damsmcfly/photoshop-cleaner-trimmer",
+ commit: TRIMMER_COMMIT,
+ subdir: "",
+ extras: &[("LICENSE", "trimmer/LICENSE")],
+ },
+ Upstream {
+ prefix: "alpha-utility/",
+ repo: "uclagamelab/AlphaUtilityAdditions",
+ commit: ALPHA_UTILITY_COMMIT,
+ subdir: "",
+ extras: &[("LICENSE", "alpha-utility/LICENSE")],
+ },
+ Upstream {
+ prefix: "gif-creator/",
+ repo: "overbyte/photoshop-gif-creator-script",
+ commit: GIF_CREATOR_COMMIT,
+ subdir: "",
+ extras: &[("LICENSE", "gif-creator/LICENSE")],
+ },
+ ],
+ manifest: "xtask/atn-corpus.sha256",
+ exts: &["atn"],
+ subset: false,
+ sources_md: |c| {
+ format!(
+ "# Photoshop Actions (.atn) corpus\n\nAction sets from public repositories, unmodified, each in its own folder with its licence: \
+ `sbaril/` (https://github.com/sbaril/Photoshop-Scripts/tree/{SBARIL_COMMIT}/Actions, MIT), \
+ `bjango/` (https://github.com/bjango/Bjango-Actions/tree/{BJANGO_COMMIT}, BSD), \
+ `bkwld/` (https://github.com/BKWLD/photoshop-actions/tree/{BKWLD_COMMIT}, MIT), \
+ `atntools/` (https://github.com/mrijk/atntools/tree/{ATNTOOLS_COMMIT}, MIT), \
+ `trimmer/` (https://github.com/damsmcfly/photoshop-cleaner-trimmer/tree/{TRIMMER_COMMIT}, Unlicense), \
+ `alpha-utility/` (https://github.com/uclagamelab/AlphaUtilityAdditions/tree/{ALPHA_UTILITY_COMMIT}, BSD-2-Clause), \
+ `gif-creator/` (https://github.com/overbyte/photoshop-gif-creator-script/tree/{GIF_CREATOR_COMMIT}, MIT). \
+ Fetched and sha256-verified by `cargo xtask corpus --atn` against `{}`. Gitignored; never commit these files.\n",
+ c.manifest
+ )
+ },
+};
+
/// Every pinned corpus, in fetch order.
- pub const ALL: &[&PinnedCorpus] = &[&PSD_MIXED, &PSD_TOOLS, &PHOTOSHOP, &HEIF, &EXR, &AFFINITY, &ATN];
-pub const ALL: &[&PinnedCorpus] = &[&PSD_MIXED, &PSD_TOOLS, &PHOTOSHOP, &GIMP, &HEIF, &EXR, &AFFINITY];
++pub const ALL: &[&PinnedCorpus] = &[&PSD_MIXED, &PSD_TOOLS, &PHOTOSHOP, &GIMP, &HEIF, &EXR, &AFFINITY, &ATN];
/// `corpus/pixls`: real camera raws from <https://raw.pixls.us> (released into the public
/// domain / CC0 by their photographers; see ATTRIBUTION.md). One file per decode path
diff --cc xtask/src/main.rs
index d849d58d5,9106dec54..544e427a2
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@@ -25,10 -25,10 +25,10 @@@ commands
layers enforce the crate dependency layering (plan/architecture.md §3)
wasm cargo check --target wasm32-unknown-unknown for the wasm-safe crates
ci fmt --check, clippy -D warnings, test, layers, wasm (stops at first failure)
- corpus [--all | --pngsuite | --psd | --psd-tools | --pixls | --atn | --photoshop] [--local] [--update-manifest]
- corpus [--all | --pngsuite | --psd | --psd-tools | --pixls | --photoshop | --gimp] [--local] [--update-manifest]
++ corpus [--all | --pngsuite | --psd | --psd-tools | --pixls | --atn | --photoshop | --gimp] [--local] [--update-manifest]
show where test corpora live and their pins (xtask/src/corpus_pins.rs), or fetch
them into corpus/ (pinned commits, sha256-verified; --all = every corpus but pixls,
- --photoshop --local copies from ../photocraft-corpus or $PHOTOCRAFT_CORPUS_REPO)
+ --photoshop/--gimp --local copy from ../photocraft-corpus or $PHOTOCRAFT_CORPUS_REPO)
test-corpus [-p <crate>]... [--changed] [--pixls] [--local] [-- <test args>]
fetch every corpus, then cargo test --release --features corpus on the corpus
crates; --changed runs only if psd/io/codecs/compose/gpu/text/format/raw changed;