Expand description
The tone layer effect (トーン, section EffectTone of
Layer.LayerEffectInfo): the layer drawn as a black-and-white
halftone screen.
The 76-byte section is big endian:
+0 u32 on (1) / off (0)
+4 f64 resolution the line count refers to (the canvas's in the corpus)
+12 u32 dot shape: 1 round, 2 square, 4 lines (others not decoded)
+16 u32 density: 0 from the image, 2 fixed (+20)
+20 u32 fixed density in percent
+24 f64 lines per inch
+32 u32 1 (meaning unknown)
+40 u32 angle in degrees
+44 u32 30, 10, 100 (no visible effect at 100 instead of 30)
+52 i32 ×2: 0 in most layers; other values change the dots (not decoded)Measured against CSP’s exports of two files made for it
(docs/validation/V6-made-files.md; 98–99.9 % of the pixels agree
for the decoded settings):
- The screen is a lattice anchored at the canvas origin. Its cell vectors are the period (resolution / lines) along the angle (y down), each coordinate rounded to whole pixels: 30 px at 45° gives (21, 21), at 30° (26, 15). A dot is centred in every cell; the cell corners are where the holes of dark areas are.
- Each pixel is compared, at its top-left corner, with the threshold of its place in the cell: the share of the cell that is covered before that place. Round dots grow as circles and turn into round holes past half (the PostScript “round” spot function); square dots grow as squares; lines grow across the second cell vector.
- The result is two-valued. With density from the image, a pixel is drawn where its alpha is above the threshold: black where its darkness × alpha is too, white otherwise. The darkness is 1 − (0.114 R + 0.299 G + 0.587 B): the BT.601 weights, but on the channels in another order (flat red, green, blue and yellow measured). With a fixed density, the dots are circles (no holes past half), black, and drawn wherever the layer has pixels; the rest is transparent.
Structs§
- Tone
- Settings of a switched-on tone effect.