Commit Graph
3 Commits
Author SHA1 Message Date
dotCooCoo 3cdeca266a craft-doc: bound shared tile conversion and reject trailing frames 2026-11-02 19:07:05 -08:00
dotCooCoo a5d321af47 craft-doc: find tiles by name once per call and decode each hash once
- pcraft_layer_rgba builds a name-to-entry map of the bundle once per
  call instead of walking the central directory for every tile.
- A tile that several references name is read, decoded and counted
  against max_total once per call. A hash referenced at two pixel sizes
  is malformed.
- Surfaces stored as RGB or grayscale are read in documents of every
  mode, so bitmap, duotone, indexed and multichannel documents read. A
  CMYK or Lab layer or mask gives Unsupported, and an RGB mask gives its
  first channel.
- A canvas of zero width or height is malformed.
- The docs name video layers, the masks of layers without pixels, and
  tile references counting against max_items.
- doc.yml runs the tests without features again, next to
  --all-features.
2026-11-02 18:30:41 -08:00
dotCooCoo 3798d807de craft-doc: PhotoCraft layer pixels and masks behind the pcraft-pixels feature
pcraft_layer_rgba(bytes, layer, &Limits) decodes one layer of a .pcraft
bundle over the canvas: a raster layer's surface, or the rendered copy
saved with a text, shape or smart object layer, as RGBA at the layer's
8, 16 or 32-bit sample type, with the layer mask as its own plane.
Grayscale repeats the gray value, missing tiles hold the default pixel,
and tiles outside the canvas are not read. Other color modes give
Unsupported; groups, adjustment and fill layers give None.

Tiles are read with craft-pcraft-format's TileRef and tile paths,
decoded with ruzstd and checked against their BLAKE3 hash, as PhotoCraft
reads them. The decoded layer and mask count against max_entry and
max_total before they are allocated; a frame is decoded only up to its
tile's size, and a frame larger than the tile plus an eighth and 4 KiB,
or one that declares a window over 8 MiB, is refused.

The feature adds ruzstd and blake3, both pure Rust. The doc workflow
runs clippy and the tests with --all-features.

Part of #59.
2026-11-02 14:58:06 -08:00