Expand description
Gradient layers (Layer.GradationFillInfo, R10): CSP saves no pixels
for them and draws the gradient when it opens the file.
Big endian, the same section layout as LayerEffectInfo: u32 total, u32 2, then sections of u32 n, UTF-16BE name (n units), payload:
GradationData
u32 size (bytes after this field)
u32 header size (16 or 24, counted from here) u32 stop size (28)
u32 stop count u32 16 [i32 mixing, i32 luminance correction when
the header is 24 bytes; 16-byte headers mix normally]
stop × count:
u32 R, G, B, A (16-bit value repeated in both halves)
u32 flags (1 main colour, 2 sub colour, 0x10 curved to the next stop)
u32 position (0..=0x8000) u32 points in the curve (flag 0x10)
curve × (stops with flag 0x10): f64 x, y pairs (0..1)
GradationSetting
u32 ? u32 shape (0 linear, 1 circular) u32 ?
f64 ellipse width, height, rotation (degrees; circular shapes)
f64 start x, y, end x, y (canvas pixels)
GradationSettingAdd0001
u32 0x14 u32 fill (1: a fill layer, drawn in the first stop's colour)
u32 R, G, B u32 1Between two stops the mix follows a curve (curve.rs): the
stop’s own control points when it has flag 0x10, otherwise CSP’s
default S curve through (0, 0), (0.25, 0.1), (0.75, 0.9), (1, 1).
Colours mix in straight (not premultiplied) sRGB for the normal mode,
in Oklab for 知覚的 (Photoshop互換) and in linear light for リニア
(Photoshop互換); alpha mixes linearly. A fully transparent stop takes
the colour of the stop it mixes with, so only the alpha fades. 知覚的
is CSP’s own pigment-like mix, approximated (see Mixing::Perceptual).
Outside the start and end the end colours continue. A circular
gradient is a circle around the start whose radius is half the
ellipse width (CSP ignores the height and rotation it saves). Measured
in docs/validation/V6b-generated-layers.md.
Structs§
- Gradient
- A gradient or fill layer (
Layer.GradationFillInfo). - Ramp
- The stops of a gradient (also the colours of a gradient map).
- Stop
- One colour stop.