/tg/ Station 13 - Modules - Types — Var Details - Proc Details

sprite_editor_workspace

Selection moves and placements, drawing bounds and input sanitizing, shared by every SpriteEditor workspace.

Vars

config_flagsA bitfield specifying whether certain functions of the sprite editor should be performed if the corresponding ui actions are received - used to prevent href exploitation
mask_strokeSet while a stroke decoded from a compact mask is checked. A mask can't name a pixel twice, so can_transact() skips its duplicate check; no window can set it.
tool_flagsA bitfield specifying what tools we are allowed to use in the sprite editor

Procs

all_points_allowedWhether is_point_allowed() takes every pixel of a view, so a compact stroke mask's points, all on the canvas by construction, need no check each.
get_first_layer_pixel_dataGet a reference to the pixel data for the first layer of the given dir
is_point_allowedWhether a pixel may be painted; the base workspace allows the whole canvas.
new_transactionTake a new transaction, perform it, and optionally add it to the undo history. Returns TRUE if the transaction was valid.
prepare_selection_moveBuild an immutable old/new pixel patch before modifying the frame, including overlapping moves.
prepare_selection_placementValidates a selection the window placed itself: pasted, turned, cut down to a mask, or dropped after hanging off the canvas.
resize_canvasMove a drawing onto a canvas of another size without redrawing it: the overlap is kept, the new space is blank. The undo history goes with it, since every recorded transaction addresses pixels of the canvas it was drawn on.
sanitize_transactionKeep only validated input; history metadata belongs to the server.
valid_boxWhether box is list(left, top, right, bottom) of whole pixels on the canvas, none of it inside out.
valid_point_pairShared point validation and the extension point for consumer-specific drawing bounds.

Var Details

config_flags

A bitfield specifying whether certain functions of the sprite editor should be performed if the corresponding ui actions are received - used to prevent href exploitation

mask_stroke

Set while a stroke decoded from a compact mask is checked. A mask can't name a pixel twice, so can_transact() skips its duplicate check; no window can set it.

tool_flags

A bitfield specifying what tools we are allowed to use in the sprite editor

Proc Details

all_points_allowed

Whether is_point_allowed() takes every pixel of a view, so a compact stroke mask's points, all on the canvas by construction, need no check each.

Arguments:

Returns:

get_first_layer_pixel_data

Get a reference to the pixel data for the first layer of the given dir

is_point_allowed

Whether a pixel may be painted; the base workspace allows the whole canvas.

new_transaction

Take a new transaction, perform it, and optionally add it to the undo history. Returns TRUE if the transaction was valid.

prepare_selection_move

Build an immutable old/new pixel patch before modifying the frame, including overlapping moves.

prepare_selection_placement

Validates a selection the window placed itself: pasted, turned, cut down to a mask, or dropped after hanging off the canvas.

The window sends the box around every pixel that changes (area), the new pixel values used in it (palette), and the box row by row as digits characters per pixel (codes): an index into the values in CUSTOM_SPRITE_INDEX_ALPHABET, or dots where the pixel stays as it is. That keeps a large paste within one small message. Transparent values lift paint away.

Lifted pixels may come from anywhere on the canvas, as a move's may. New paint follows the pencil's rules, so any that lands outside the drawing area is dropped rather than refusing the rest. Anything malformed refuses the whole placement.

Returns TRUE when anything changes; points then holds each pixel's old and new color.

resize_canvas

Move a drawing onto a canvas of another size without redrawing it: the overlap is kept, the new space is blank. The undo history goes with it, since every recorded transaction addresses pixels of the canvas it was drawn on.

sanitize_transaction

Keep only validated input; history metadata belongs to the server.

valid_box

Whether box is list(left, top, right, bottom) of whole pixels on the canvas, none of it inside out.

valid_point_pair

Shared point validation and the extension point for consumer-specific drawing bounds.