Files
Dylan M. Taylor 0984f412a6 craft-affinity: bounded reader for native Affinity documents, from VectorCraft and PhotoCraft (#914)
* craft-affinity: bounded reader for native Affinity documents, moved from VectorCraft

The reader of .af, .afdesign, .afphoto and .afpub files (archive, object stream and document
model) as it is in storytold/vectorcraft at 6e873b80 (crates/affinity), under a neutral name.
Its corpus tests read the pinned public documents scripts/fetch-affinity-corpus.sh fetches.

* craft-affinity: fold in what only PhotoCraft's copy of the reader had

From storytold/photocraft at 63b641b5 (crates/affinity), onto the VectorCraft copy:

- Special shapes: clouds, hearts, cogs, callouts, arrows, double stars, tears, crescents,
  diamonds and segments come in as their own outlines, not their bounding ellipse.
- Null slots of object lists are charged to the document's work before a list is scanned,
  on every visit of a shared object (children, attachments, effects, compound operands,
  page lists, paint lists, gradient colours, text blocks and runs, table cells, tile lists).
- A colour or gradient position record is decoded only as far as its components are read.
- 16-bit and 8-bit planes are interleaved through tables, not an f64 for each pixel.
- Limits::max_pixel_bytes: the caller sets what the pixel layers of one import may hold.
- Pixels::cmyka8_to_rgba8 for a caller without colour management.

The crate README and docs describe the model on its own terms.

* craft-affinity: a callout with a right-to-left box no longer panics; an oversized shape imports as its box

Ported from storytold/photocraft#10473 by DJHoltkamp. A callout rectangle clamped its tail
with clamp(x0, x1), which panics when the box is stored right to left. A box with finite
corners whose size overflows gave infinite or NaN outline points; it now imports as its box
with a warning. Also drops the inflated doc.dat once it is parsed.
2026-11-11 17:42:11 -05:00

12 KiB

1cc8ca0db0d8fc545eb29153be900f153fa6b7b7eac068d05e54a502aba1264feafdesignload-color.afdesignMIThttps://raw.githubusercontent.com/NickBeeuwsaert/AFDesignLoad/a18dd50a7079fb861a28835eeefa0d015f03f4a1/testDesigns/color.afdesign
29a17f500d09fb3b1a70d24aabdc2882955ec3eac3700a474549e6100be3a8484afdesignload-layer_mode.afdesignMIThttps://raw.githubusercontent.com/NickBeeuwsaert/AFDesignLoad/a18dd50a7079fb861a28835eeefa0d015f03f4a1/testDesigns/layer_mode.afdesign
377ae60c02749224fe2c52691c951568138eaed5f8584ebc5da83715fae0234ddafdesignload-layer_test.afdesignMIThttps://raw.githubusercontent.com/NickBeeuwsaert/AFDesignLoad/a18dd50a7079fb861a28835eeefa0d015f03f4a1/testDesigns/layer_test.afdesign
404944918ff8e29c5c1b466b7e43c232f7ab80db15fb934080bbcd7baaf093e22afdesignload-margins.afdesignMIThttps://raw.githubusercontent.com/NickBeeuwsaert/AFDesignLoad/a18dd50a7079fb861a28835eeefa0d015f03f4a1/testDesigns/margins.afdesign
535afa31b89f2b9970eb3701ee64e2a19476383637e8b07689334d6ffe556b593afdesignload-raster_test.afdesignMIThttps://raw.githubusercontent.com/NickBeeuwsaert/AFDesignLoad/a18dd50a7079fb861a28835eeefa0d015f03f4a1/testDesigns/raster_test.afdesign
6e56c35f876277b101790ff4384cfde103a093ed6c81790a2d62176de21da339fafdesignload-revision_test.afdesignMIThttps://raw.githubusercontent.com/NickBeeuwsaert/AFDesignLoad/a18dd50a7079fb861a28835eeefa0d015f03f4a1/testDesigns/revision_test.afdesign
708946c60c0da1c8aeea92d65acfb244721eeb3b480ed358609f4a48bbecfc5b9afdesignload-shape_test.afdesignMIThttps://raw.githubusercontent.com/NickBeeuwsaert/AFDesignLoad/a18dd50a7079fb861a28835eeefa0d015f03f4a1/testDesigns/shape_test.afdesign
87306ab4fcbdc225d816f32a0d2aca15ac887053f60170459ac947e70f4ef343dafdesignload-slice_test.afdesignMIThttps://raw.githubusercontent.com/NickBeeuwsaert/AFDesignLoad/a18dd50a7079fb861a28835eeefa0d015f03f4a1/testDesigns/slice_test.afdesign
9e5d04bac0235af9386aea251cdd6903ed7810d335fdb6194d0483ea30b14e24aafdesignload-test_path.afdesignMIThttps://raw.githubusercontent.com/NickBeeuwsaert/AFDesignLoad/a18dd50a7079fb861a28835eeefa0d015f03f4a1/testDesigns/test_path.afdesign
10c499cf3ca73cf7cd3e2e65bed048d1b8ecf03e7167b74d54f0ae6db31868cab8affinity3-mexican-guy.afCC0-1.0https://raw.githubusercontent.com/samuel-etver/vector-art/255f8add3c8f0740196e22bd59502b811b532f0b/simple/mexican-guy.af
11730e3fae51d9044ada58f51c7b5f9327d99e8d62376453bc251d0d26cda47743affinity3-mexican-man.afCC0-1.0https://raw.githubusercontent.com/samuel-etver/vector-art/255f8add3c8f0740196e22bd59502b811b532f0b/simple/mexican-man.af
125f5fccc0bd8be2bb3b2a07461ec77a012a61eef1883485d7c80f72d4383231ceaffinity3-mexican-woman.afCC0-1.0https://raw.githubusercontent.com/samuel-etver/vector-art/255f8add3c8f0740196e22bd59502b811b532f0b/simple/mexican-woman.af
130a52bb923c949c566a4339b996bce1a67b683f61def1a73dfefb910effaa450daffinity3-playing-cards.afCC0-1.0https://raw.githubusercontent.com/samuel-etver/vector-art/255f8add3c8f0740196e22bd59502b811b532f0b/simple/playing-cards.af
1487a7bd93de16c404f6c6dd9cdebff96ec47832a3b342d2ce0af73d9a87e209e0designer-beer.afdesignCC0-1.0https://raw.githubusercontent.com/samuel-etver/vector-art/255f8add3c8f0740196e22bd59502b811b532f0b/simple/beer.afdesign
1509ba790c428e8e09dc0b9ddebb4f3db6daefaa2af1da492ee34e73fba1b8af69designer-cactus.afdesignCC0-1.0https://raw.githubusercontent.com/samuel-etver/vector-art/255f8add3c8f0740196e22bd59502b811b532f0b/simple/cactus.afdesign
16c3bcd0395b407493bc9d2877d424029b70f0e4c817a56e893f7ac74973df52e5designer-car.afdesignCC0-1.0https://raw.githubusercontent.com/samuel-etver/vector-art/255f8add3c8f0740196e22bd59502b811b532f0b/simple/car.afdesign
17112562bc91e7cccf003d34364430544208373c4fb4bb4ab9acdaf27cf0125047designer-flowers.afdesignCC0-1.0https://raw.githubusercontent.com/samuel-etver/vector-art/255f8add3c8f0740196e22bd59502b811b532f0b/simple/flowers.afdesign
18023531b8216f2d4da24ab715e3b313506712e50d5f5bf7da927f434def1d0ea2designer-lion-track.afdesignCC0-1.0https://raw.githubusercontent.com/samuel-etver/vector-art/255f8add3c8f0740196e22bd59502b811b532f0b/simple/lion-track.afdesign
19e1b121d7c3d02356baa5dea512f5aa1fe77249c28d7b227e29cab2bc67ec323aeviltwo-AssetStore.aftemplateMIThttps://raw.githubusercontent.com/eviltwo/AssetStoreTemplate/f671981ee89d15526285b3cc87b4393d3defe644/AssetStoreTemplate/AssetStore.aftemplate
20fbb196e918e302c16f8de9f2e6dffaef70ab3c317b32a9f44607fd4b2ead0206jac21-SimpleLogo.afdesignMIThttps://raw.githubusercontent.com/Jac21/Branding/57ae3f45bf4637f6927c0b07de25b922c55f944f/Logos/JC/DesignerFiles/Affinity/SimpleLogo.afdesign
219d874245936483de3ec04cca48b383028d33666801dff1814246a44e695e29b8jac21-SimpleLogoBanner.afdesignMIThttps://raw.githubusercontent.com/Jac21/Branding/57ae3f45bf4637f6927c0b07de25b922c55f944f/Logos/JC/DesignerFiles/Affinity/SimpleLogoBanner.afdesign
22ec1072cb03fcd0ed7ac1dfc7e087f4920df545fe9c84a386a7dac2fd33fbbe1fleakcanary-vector_icon.afdesignApache-2.0https://raw.githubusercontent.com/square/leakcanary/00880a8fb66eb4046a0124bff8303a04874bc07e/docs/assets/vector_icon.afdesign
23bbc50c8c376e0e5980939be7df6769feed1a30289c7efc6391b204dfb15de88dpatchy-LICENSE.txtMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/LICENSE
24150e423be0c5eb22f252a38c2de68ab3ccec7e20bfba166f7ddd622ac243d8f4patchy-NOTICE.txtMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/NOTICE-THIRD-PARTY.md
259bea4e2ceddc2438943c3b26505299389d07c64bbe2821be01eba9e69a06ce1epatchy-adjust-curves.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-adjust-curves.af
263141df41efeab7a250782e1418d96d4faf3b15107763df8002714aa8a8edd259patchy-adjust-hsl.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-adjust-hsl.af
270361284661e1376b91675cb5f7705b1d560711c9f86aa53e255ee5365e023680patchy-artboards.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-artboards.af
287239c42b6f9fb25b6ad9c12397afb4e0c1361a505e8126855d3a8cb45b192b87patchy-blend-affinity.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-blend-affinity.af
294d1fd761dd1508a31d37c4f4acbe01ca0d336ef3cb9bfdcddfc40ad4102f9d74patchy-cmyk.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-cmyk.af
3075975eea4c325b90beac5015f6c2731156e90a5ec0f4c0a22aa6324e5dcb4ffcpatchy-dpi300.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-dpi300.af
31bd15ca80e322eb38460176e1b9b187247c3b9e455e55624f71ae5db1122a1eedpatchy-embedded-jpeg.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-embedded-jpeg.af
3262c9a5c4cff475a1a47ad6582d24b4fcb56ac84e94641b7ca44c9f8b05053bf1patchy-fx-blur.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-fx-blur.af
33d515c84a702aee19359740e61f4ff16b02e363533f24287be5e1ba4b3539ef54patchy-fx-gradient.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-fx-gradient.af
34eeb8f0988a7effe2088ead4015916bed13875d9aaa88a3bf477127214831e820patchy-fx.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-fx.af
353da524362f70f316c3be4beab2022e2ae7275bbd153cc7204bc328a7dc8a538apatchy-group.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-group.af
3625ee650339e7951a4db76932e889e0558134bd6b55be7c5b5c7d54b601c053bfpatchy-incremental-chain.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-incremental-chain.af
37f83c1bd0108315c95f55ddbfb84b7188e73c301dbeb0e3a209ddf991075737b0patchy-lab.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-lab.af
38da724875124ca2dea2ab69671198c9e0af87f8e325d634c8f6d4256210b00dccpatchy-lazy-placed.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-lazy-placed.af
3959da2bb7d58a356e09ca1819020af85bb05217b1b24ec55df9f9f2ff5235c68apatchy-live-filter.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-live-filter.af
409e505e5dc5f0854d2a13ae30699b000b32f40b80d80afd570f00a33952ca895epatchy-rgba16.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-rgba16.af
419f2a838484399dfc4da4af893facf9d0cd33ed40173aa88264fe8f3756d81a42patchy-rgba8.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-rgba8.af
425dab9c128aa791558ccb8e995e6bf89cc1c50bfcd907dfdce9c764163503e17apatchy-shapes-2.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-shapes-2.af
43dba88c1c2e1c1cca947af6ebc82e32457301b228c8f6a9483edbae7c4ef32653patchy-shapes.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-shapes.af
44f03afbf8965a137439f2fb5d228e2c3349ca81d26e4e7e426b2fcc191348a7f4patchy-text-artistic.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-text-artistic.af
4566b4fadba91cdf974c1ddef021ce073ecc09b5b25d8c273d400d6c71265b7b75patchy-text-caps.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-text-caps.af
460cf93a1105878ad237e7f3d724be8e85619efd91d2c7fc6ae63b121e0930fc72patchy-text-frame.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-text-frame.af
47dfb6ca947e0d33091a7d6d9466f379cc22e3e8847ae7722d8e93bd89a0e8b813patchy-text-indent.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-text-indent.af
4856c5d030b9956151110e57fe83aebc47d141efce4df424f6ff5643312c4a7549patchy-text-para-spacing.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-text-para-spacing.af
49a5ccb62ee8d7e36d1a19a037aba989a5ba0232767e9f3305f7d9f7d4603291ddpatchy-text-rotated.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-text-rotated.af
5007c54ed90e49c4d791964228bee638fbff95a7b06dc3eccbedb3016f9fcef05epatchy-text-runs.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-text-runs.af
5187e1dee23769932b7e414116233063a8d68726cbffdebb975b3cd0ef447c602apatchy-transform.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-transform.af
52fa5dd80f44ae0712a9888c62953fd442a28119034d343db93b7892d5d2a61328patchy-vector-mask.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-vector-mask.af
538ab1995ecbd9306ebcb7a4d2cd81701f34401e67f08b242f14dc3e3d04c94803patchy-vector.afMIThttps://raw.githubusercontent.com/SethRobinson/Patchy/de84eab550758b30fa062e479f5778cce7693b73/test-fixtures/af/tiny-vector.af