modular_aphelion/modules/graffiti/code/piece.dm 
| GRAFFITI_FLAT_MAX_COLORS | Most colours a flattened art may hold: as many as two grid characters can index. |
|---|---|
| GRAFFITI_ALPHA_FLOOR | The least alpha paint keeps, 20%, so translucent paint still shows: a lower one is raised to it, and 0 is refused. |
| /proc/graffiti_color | Returns a colour in its canonical graffiti form: lowercase #rrggbb when its alpha reaches GRAFFITI_ALPHA_CEILING,
the alpha placed graffiti draws opaque paint at, and #rrggbbaa below it, raised to GRAFFITI_ALPHA_FLOOR when lower.
So a stored colour's real alpha is the ceiling when it has seven characters, and its own alpha when it has nine. |
| /proc/graffiti_palette_pack | Packs canonical colours into one string of nine-character #rrggbbaa entries, the form placed art keeps
its palette in. |
| /proc/graffiti_palette_unpack | Unpacks a palette graffiti_palette_pack() wrote. Only its lowercase spelling is read, so an art has one packed form and one hash. |
| /proc/graffiti_encode_flat | Encodes palette indices as a flat art grid. |
| /proc/graffiti_decode_flat | Decodes a flat art grid that graffiti_encode_flat() wrote. Hostile input is refused before anything is
expanded, and decoding stops at pixel_count whatever the runs claim. |
| /proc/graffiti_merge_fingerprint | Returns a fingerprint of what merging gives: the alpha ceiling and the hash of one fixed merge of opaque and translucent paint, glowing and not, made once. The map file keeps it beside its stack cache, so a cache written before merges changed is set aside rather than show stacks under keys today's merges wouldn't give. |
| /proc/graffiti_flat_codes | Returns the characters a flat grid writes, built once, so encoding looks each run's characters up instead of cutting text and calling custom_sprite_canvas_code() for every run, and the glow of art that glows nowhere at each width. |
| /proc/graffiti_art_hash | Returns an art's content identity, which tiles showing the same art share. |
| /proc/graffiti_art_pixels | Counts an art's painted pixels. |
| /proc/graffiti_art_decode | Decodes an art, such as one read from a map file, when it can be drawn: a one- or two-tile width, a palette of 1 to GRAFFITI_FLAT_MAX_COLORS colours, and a grid and glow mask that both cover every pixel. |
| /proc/graffiti_unlit_glow | Returns the glow of art that glows nowhere, as graffiti_encode_flat() writes it and decoded, which graffiti_flat_codes() makes once for each width, so decoded arts that glow nowhere share one list. |
| /proc/graffiti_blend | Blends a colour over another as placed graffiti shows them, in their real alphas: GRAFFITI_ALPHA_CEILING for opaque paint and its own for translucent paint. The standard "over" operator gives the alpha and the colour, and an alpha that reaches the ceiling is stored opaque. |
| /proc/graffiti_merge_arts | Merges arts of one width into one, bottom to top. |
| /proc/graffiti_flatten | Flattens a piece's layers into one art, or only as much of them as a paint job has revealed. |
| /proc/graffiti_layer_records | Decodes a piece's layers for graffiti_merge_arts(), each against the piece's whole palette, glowing on every pixel or on none. A paint job keeps its piece's records, so its steps never decode the layers again. |
| /proc/graffiti_flatten_records | Flattens decoded layers into one art, or only as much of them as a paint job has revealed. Nothing is encoded or decoded on the way, so it is graffiti_flatten() for layers already decoded. |
| /proc/graffiti_split_wide | Splits a wide art into the arts of its two tiles. |
| /proc/graffiti_trim_wide | Narrows a two-tile piece to one tile when no layer paints its right tile, as a wide canvas left blank there saves. |
| /proc/graffiti_validate_piece | Strictly validates a library piece, as Export writes it and Import reads it. Nothing is salvaged, and messages never repeat uploaded text. |
| /proc/graffiti_clean_text | Cleans player text for a piece's name, description or layer names, so that cleaning it again changes nothing. |
| /proc/graffiti_encode_piece | Returns a canonical piece as the text Export writes, format and version first. |
Define Details
GRAFFITI_ALPHA_FLOOR 
The least alpha paint keeps, 20%, so translucent paint still shows: a lower one is raised to it, and 0 is refused.
GRAFFITI_FLAT_MAX_COLORS 
Most colours a flattened art may hold: as many as two grid characters can index.