/** Values of the look, as the server keeps them in user_settings.json. */ export type Settings = Record export interface Options { fonts: string[] sameFont: string palettes: string[] moods: string[] extras: string[] shapes: string[] themes: string[] tails: string[] placements: string[] symbols: string[] /** The same marks with their group and a mask of the shape the renderer draws. An older server does not send it. */ marks?: { symbol: string; name: string; group: string; mask: string }[] defaults: Settings settings: Settings auto: { enabled: boolean; text: string; caption: string; sfx: string } } /** One thing the server drew, with its place in image pixels. */ export interface SceneItem { kind: 'bubble' | 'caption' | 'balloon' | 'sfx' | 'region' | 'path' | 'mark' text: string size: number bubble?: number box?: [number, number, number, number] x?: number y?: number nominal?: [number, number] /** Present on what can be moved by hand: "caption", "sfx:0", ... */ id?: string cx?: number cy?: number /** Tilt in degrees, counter-clockwise. */ rotation?: number reach?: number tall?: boolean /** On a sound effect that belongs to an area: the area's id. Its place is the area's. */ region?: string | number } /** One stroke of the hand: an outline that is closed and filled, or a brush stroke. Points are image pixels. */ export type Shape = | { type: 'polygon'; points: [number, number][] } | { type: 'stroke'; points: [number, number][]; width: number } /** Rubs out what the shapes before it painted. */ | { type: 'erase'; points: [number, number][]; width: number } export type RegionKind = 'text' | 'sfx' | 'keepout' | 'censor' | 'mark' | 'tone' | 'lines' | 'frame' /** How a censor area covers the art. */ export type CensorLook = 'bar' | 'white' | 'mosaic' | 'blur' | 'ghost' /** How a painted area looks: a cover, a tone, lines or a frame. Each kind has its own. */ export type RegionLook = CensorLook | 'dots' | 'hatch' | 'cross' | 'fade' | 'focus' | 'speed' | 'tremor' | 'halo' | 'dashes' | 'border' | 'double' | 'dark' | 'xray' /** An area drawn on the image: text or an effect is fitted into it, everything keeps out of it, it is * covered (censor), or one mark stands in it. */ export interface Region { id: string kind: RegionKind shapes: Shape[] text: string fill: 'none' | 'light' | 'dark' | 'black' | 'gray' | 'blue' | 'soft' /** Tilt in degrees, counter-clockwise; an effect is tilted at random while this is not set. */ rotation?: number /** How large the text or effect is against what the area would give it; 1 when not set. */ scale?: number /** The text runs along the brush stroke and bends with it. */ follow?: boolean /** Along the stroke the other way round. */ flip?: boolean /** Set on a bubble made from a template, so its shape and tail can still be changed. */ template?: BubbleTemplate /** Censor, tone, lines and frame areas: how they look; the kind's first when not set. */ look?: RegionLook /** Mark, tone, lines and frame areas: '#rrggbb', or none for white (a mark) or black. */ color?: string } export type Tool = 'off' | 'bubble' | 'brush' | 'eraser' export type BubbleShape = 'oval' | 'box' | 'cloud' | 'burst' | 'thought' | 'wavy' | 'jagged' | 'drip' | 'torn' | 'message' | 'soft' | 'label' export type BubbleTail = 'none' | 'down-left' | 'down' | 'down-right' | 'left' | 'right' | 'up-left' | 'up' | 'up-right' /** A bubble put on the image from a template: its outline is worked out from these. */ export interface BubbleTemplate { shape: BubbleShape tail: BubbleTail /** Where it stands, in image pixels: x0, y0, x1, y1 (before it is turned). */ box: [number, number, number, number] /** How far it is turned about its middle, in degrees, clockwise. */ angle?: number } /** What was set by hand for one item; the server decides whatever is left out. */ export interface Pin { cx?: number cy?: number size?: number rotation?: number reach?: number tall?: boolean } export interface RenderResult { version: number status: string warning: boolean empty: boolean items: SceneItem[] bubbles: [number, number, number, number][] } export type Source = 'generation' | 'own' /** The parts of the side panel that fold. */ export type SectionId = 'bubbles' | 'caption' | 'sfx' | 'areas' | 'all' | 'auto' /** An image being lettered and what the server last made of it. */ export interface Slot { session: string width: number height: number version: number empty: boolean items: SceneItem[] bubbles: [number, number, number, number][] /** The inputs of the last finished render, to skip a render that would change nothing. */ applied: string /** What the server said about that render. */ status: string warning: boolean /** Places, sizes and tilts set by hand, by item id. */ pins: Record /** Areas drawn by hand. */ regions: Region[] /** Which image of which generation this is, when the host knows; an image opened again keeps its slot. */ origin?: string } /** What the host page tells the editor about the image in its gallery. */ export interface HostImage { tab: string url: string | null index: number count: number }