Emitting#
Panel Core to SVG, to a print PDF, and to the exports for image models. No emitter makes a layout
decision: everything it draws or says was already decided. The shapes Panel Core names but
does not spell out – a burst’s spikes, a tail’s corners, where each letter lands – are worked
out once in scenet.emit.geometry, and the order a panel is painted in is scenet.emit.marks,
so that every emitter draws the same thing. Its marks are everything painted, and have nothing to
do with the marks key of the language, a cast member’s emanata.
scenet.emit.svg#
Panel Core into SVG.
Purely mechanical: every position here was decided by the solver. The emitter makes no layout decisions, which is what keeps rendering swappable and golden tests meaningful.
Numbers are formatted through one helper at fixed precision so that output is byte-identical across platforms, whose float repr differs in the last digit.
- scenet.emit.svg.XLINK = 'http://www.w3.org/1999/xlink'#
The namespace
xlink:hrefis in. SVG 2 deprecates it for plainhref, and every renderer still reads it; Inkscape does not yet load a resource named by plainhref(inkscape/inbox#4411), and editing the output there is a likely next step.
- scenet.emit.svg.GLYPH_SCALE_PLACES = 6#
Decimal places for a glyph’s scale. The scale is size/unitsPerEm, and a font’s units are a thousand or more to the em, so two places – right for a coordinate – wrote 0.035 as 0.04 and drew every letter 14% larger than it was measured. Six keep the drawn size within a millionth of an em of the measured one.
- scenet.emit.svg.FACE_ATTRIBUTES: dict[Face, str] = {Face.BOLD_ITALIC: ' font-weight="bold" font-style="italic"', Face.ITALIC: ' font-style="italic"', Face.REGULAR: ' font-style="normal"'}#
How a run in another face than its line’s is marked in live text. A
<tspan>only where the face changes, so a line without emphasis is exactly the<text>it was.
- scenet.emit.svg.fmt(value, places=2)[source]#
Format a number for SVG output.
Trailing zeros are stripped so
100.00prints as100, which keeps files small and diffs readable without making them any less exact.Two places is a hundredth of a panel unit, which is exact for a coordinate. It is not for a factor: a glyph’s scale multiplies a thousand font units, so it takes
places=6.- Return type:
- scenet.emit.svg.accessible_name(core)[source]#
What makes a panel one image a screen reader can read: its attributes and children.
The panel is
role="img", named by one<title>, its first child: the description, then every balloon, caption and sound effect’s label, inorder. The words go in the name, which is announced, rather than a description, which often is not (NVDA, JAWS) – and in nothing else. Named througharia-labelledbyby a<title>and a<desc>, the panel was read by NVDA 2026.2 with Edge 155 a second time, the<desc>as its description, whenever a reader moved to it by graphic. One title is read once.It needs no id either, so a page holding several inlined SVGs – the VS Code preview, a web comic – where
getElementByIdfinds the first match, cannot name one panel with another’s words. An image’s children are presentational, so nothing inside it is named, and the order is this one sequence whatever order things are painted in. With no words at all, nothing is written: an image with no name is worse than none. Every word was resolved in the pipeline; this only copies.
- scenet.emit.svg.panel_body(core, family, *, live_text=False, id_prefix='', embed=None)[source]#
A panel’s contents, without the document around them: what a strip or page places.
- Parameters:
core (
PanelCore) – The compiled panel.family (
Typeface) – The faces its lettering was measured in, fromtypeface_of().live_text (
bool) – Emit lettering as<text>rather than glyph outlines.id_prefix (
str) – Put in front of everyidthe panel writes, and every reference to one.embed (
Mapping[str,bytes] |None) – The supplied pictures’ bytes, by digest – whatCompileResult.imagesholds. Given, each picture is written into the SVG as adata:URI, and must be here; left out, it is linked by the path the document wrote, which a viewer reads from beside the SVG.
- Return type:
- Returns:
The lines between the root’s opening tag and its closing one, none of them empty.
- scenet.emit.svg.in_painters_order(core)[source]#
The actors and masses of a panel, in the order they are drawn: back to front.
Masses and actors share one painter’s order, which is the whole point of
planemapping ontodepth: a far mass, the cast, and a foreground mass fall into place in a single sort with no layering code of their own. Within one depth, masses keep the order Panel Core lists them in, which is back to front – their ids are numbered that way, butm10sorted as text would come beforem2– and actors break ties on id. No mass shares a depth with an actor: the backdrop is behind every actor, and the foreground in front of all of them.
- scenet.emit.svg.image_href(image, embed=None)[source]#
Where an
<image>finds its picture: the path as written, or the bytes themselves.A path is percent-encoded and nothing more,
/kept: a name with a space,#or:in it then stays a path rather than becoming a fragment, a query or a scheme. Format conversion, not a decision – which file it names was the document’s.- Parameters:
- Return type:
- Returns:
The value of
xlink -- href.- Raises:
RenderError – There is something to embed from, and not these bytes.
Example
>>> from scenet.core import Box, CoreImage >>> from scenet.emit.svg import image_href >>> image = CoreImage( ... href="art/p 1.png", ... media_type="image/png", ... sha256="00", ... pixels=(1, 1), ... fit="cover", ... preserve_aspect_ratio="xMidYMid slice", ... box=Box(x=0, y=0, width=1, height=1), ... ) >>> image_href(image) 'art/p%201.png' >>> image_href(image, {"00": b"PNG"}) 'data:image/png;base64,UE5H'
- scenet.emit.svg.attr(value)[source]#
Quote a string for use as an XML attribute value, delimiters included.
Returns the value with its surrounding quotes, because choosing the quote character is part of escaping correctly –
quoteattrpicks whichever one avoids the most escaping.This exists because
xml.sax.saxutils.escapedoes not escape quotation marks. That is fine for element content and wrong for an attribute: identifiers here come from user documents – a cast key, a panel name – and one containing a double quote would close the attribute early and let the rest of it be read as markup. The output is injected withinnerHTMLby the browser playground, so that is a scripting vector, not merely malformed XML.- Parameters:
value (
str) – Any string, trusted or not.- Return type:
- Returns:
The value, escaped and wrapped in quotes.
Example
>>> from scenet.emit.svg import attr >>> attr("alice") '"alice"' >>> attr('a" onload=x') '\'a" onload=x\''
- scenet.emit.svg.typeface_of(core, *, metrics=None, fonts=None)[source]#
The family a Core’s lettering was measured in, from the fonts handed over.
- Parameters:
core (
PanelCore) – The compiled panel.metrics (
FontMetrics|None) – A regular face given by hand, as it was given to the compile.fonts (
Mapping[str,FontMetrics] |None) – Declared fonts by digest.
- Return type:
- Returns:
The shipped family, with each face the Core names in its declared font.
- Raises:
RenderError – A face the Core names is in none of the fonts given.
scenet.emit.geometry#
The numbers every emitter draws from, where Panel Core names a shape but not its points.
Panel Core says a balloon is a shout in this box with its tail from here to there; it does not list a burst’s spikes, the two corners where a tail leaves its balloon, or where each letter of a line lands. Those follow from the Core by arithmetic alone, and two emitters – the SVG and the print PDF – must draw exactly the same ones. So they are worked out here, once, and each emitter only writes them down in its own format.
Nothing here decides anything: every position was the solver’s, and these are its shapes spelt out. Each expression keeps the order of operations it had inside the SVG emitter, so the floats – and the SVG written from them – are what they always were.
- scenet.emit.geometry.STROKE = '#111111'#
Ink: every line drawn and every letter lettered, unless Core says otherwise.
- scenet.emit.geometry.FILL_FIGURE = '#e8e6e1'#
The pale fill of a figure, inside its outline.
- scenet.emit.geometry.FILL_BALLOON = '#ffffff'#
A balloon’s fill, which is the paper’s.
- scenet.emit.geometry.FILL_PANEL = '#ffffff'#
The panel’s ground: the paper it is printed on.
- scenet.emit.geometry.BALLOON_CORNER = 0.42#
Corner rounding of a speech balloon, as a fraction of its smaller side.
- scenet.emit.geometry.TAIL_BASE_FRACTION = 0.18#
Half-width of a tail where it meets the balloon, as a fraction of balloon height.
- scenet.emit.geometry.FRAME_STROKE_WIDTH = 6.0#
The frame around a panel, centred on its edge.
- scenet.emit.geometry.WHISPER_DASH = (12.0, 9.0)#
A whisper’s dashes, along its outline.
- scenet.emit.geometry.WEATHER_OPACITY = 0.85#
Falling weather is drawn at less than full opacity so it reads as passing through the panel rather than as marks on top of it. Which tone it uses was chosen by the solver and travels in
CoreAtmosphere.fall_tone.
- scenet.emit.geometry.THOUGHT_BUBBLES = (0.35, 0.62, 0.85)#
Where a thought balloon’s three bubbles sit along its tail, from balloon to mouth.
- scenet.emit.geometry.ASCENT = 0.74#
How far below the top of a line its baseline sits, as a fraction of the type size.
- class scenet.emit.geometry.Pointer[source]#
Bases:
objectA tail’s triangle: wide where it leaves the balloon, a point at the mouth.
- control#
Where a curved tail bends, through both of its sides;
Nonewhen straight.
- __init__(left, tip, right, control)#
- class scenet.emit.geometry.PlacedRun[source]#
Bases:
objectWhere each letter of one run lands along its line.
- metrics#
The face it is lettered in.
- Type:
- origins#
The left edge of each character of
run.text, in panel units, whether or not the character has an outline to draw.
- __init__(run, metrics, scale, origins)#
- scenet.emit.geometry.burst(box)[source]#
A shout’s spiky outline.
Spike count follows the balloon’s perimeter so a long balloon does not end up with a handful of enormous points.
- scenet.emit.geometry.corner_radius(box)[source]#
How round a speech balloon’s corners are.
- Return type:
- scenet.emit.geometry.ellipse(box)[source]#
A thought balloon: the ellipse inscribed in its box, as
(cx, cy, rx, ry).
- scenet.emit.geometry.thought_bubbles(balloon)[source]#
A thought balloon’s tail: shrinking circles towards the mouth, as
(x, y, r).The established convention, which reads instantly.
- scenet.emit.geometry.pointer(balloon)[source]#
Every other balloon’s tail: a tapered triangle from its start to the mouth.
- Return type:
- scenet.emit.geometry.inner_width(width)[source]#
The pale stroke inside a limb’s ink one, which leaves a figure’s outline showing.
- Return type:
- scenet.emit.geometry.baselines(box, count, line_height, font_size)[source]#
Where a box’s lines of lettering sit: its padding, and each line’s baseline.
Text is laid out from the top of the box: padding, then one line height per line, landing each baseline where the solver’s measurement assumed it. The padding is derived from the box rather than restated as a constant, so it cannot drift from the solver’s.
- scenet.emit.geometry.line_width(runs, font_size, family)[source]#
A line’s width, measured exactly as the solver measured it.
- Return type:
- scenet.emit.geometry.centred(box, width)[source]#
Where a line of this width starts, centred in a balloon’s box.
- Return type:
- scenet.emit.geometry.glyph_walk(runs, x, font_size, family)[source]#
Where every letter of a line lands, from its left edge.
Each run is drawn from its own face, and the cursor advances by each character’s step – its advance plus the kerning to the next – which is exactly what was measured.
scenet.emit.marks#
A panel as the marks drawn in it: what each is, where, and in which order.
The SVG emitter writes a panel as text as it goes. A print emitter needs the same
drawing as data: every shape, the order it is painted in, and what it is – a line of
ink, the paper showing through, a grey – because a printer is told inks, not colours.
marks lists exactly what the SVG paints, one mark per painted element, in the same
order, from the same numbers (scenet.emit.geometry); tests/test_marks.py holds the
two to each other for every gallery panel.
Each paint keeps the colour the SVG draws and the grey it is the twin of: a tinted mass draws its colour on screen and prints its grey.
- scenet.emit.marks.PAPER = '#ffffff'#
The paper, which every white in Scenet is: nothing is ever printed in white ink.
- class scenet.emit.marks.Role[source]#
Bases:
StrEnumWhat a paint is, which is what decides the ink it prints in.
- INK = 'ink'#
A line or letter of ink, drawn over whatever is beneath it.
- SOLID = 'solid'#
A solid area of ink with something reversed out of it: a dark caption box.
- PAPER = 'paper'#
The paper: a balloon, the panel’s ground, letters reversed out of ink.
- TONE = 'tone'#
A grey: a figure’s fill, a caption box, weather.
- MASS = 'mass'#
A backdrop mass: a grey, which may be large and near black.
- class scenet.emit.marks.Paint[source]#
Bases:
objectA fill or a stroke.
- __init__(colour, role, grey, opacity=1.0)#
- class scenet.emit.marks.Rect[source]#
Bases:
objectA rectangle, its corners rounded by
radius.- __init__(x, y, width, height, radius=0.0)#
- class scenet.emit.marks.Ellipse[source]#
Bases:
objectAn ellipse, its axes along the panel’s.
- __init__(cx, cy, rx, ry)#
- class scenet.emit.marks.Polygon[source]#
Bases:
objectPoints joined in order, closed back to the first or left open.
- __init__(points, closed=True)#
- class scenet.emit.marks.Line[source]#
Bases:
objectA straight line: a streak of rain.
- __init__(start, end)#
- class scenet.emit.marks.Segment[source]#
Bases:
objectA straight stroke, which SVG writes as a path: a figure’s limb.
- __init__(start, end)#
- class scenet.emit.marks.Glyph[source]#
Bases:
objectOne letter’s outline, in its font’s units, placed and scaled into the panel.
- metrics#
The face it is drawn from.
- Type:
- __init__(metrics, char, x, y, scale, angle=0.0)#
- class scenet.emit.marks.Text[source]#
Bases:
objectOne line of lettering set as text, with
--live-text.The SVG writes it as one
<text>; print sets each run in its embedded face. Its glyphs land where their outlines would, each run’s origins worked out bygeometry.glyph_walk.- __init__(runs, baseline, font_size)#
- class scenet.emit.marks.Picture[source]#
Bases:
objectA supplied picture, in the box Panel Core placed it in.
- __init__(image)#
- class scenet.emit.marks.Veil[source]#
Bases:
objectThe fog or cloud over a backdrop: the atmosphere’s noise, over the panel.
- __init__(width, height, veil)#
- class scenet.emit.marks.Mark[source]#
Bases:
objectOne thing painted in a panel.
- owner#
What it belongs to, named as the SVG’s ids name it:
panel,image,mass-<id>,actor-<id>,sfx-<id>,balloon-<id>,caption-<id>,weatherorveil.- Type:
- shape#
Where it is.
- rounded#
Round caps and joins on its outline, as everything drawn over the backdrop has. Only an outline has caps and joins, so a mark with none leaves it
False.- Type:
- property is_veil: bool#
Whether this is the veil, which the SVG draws with a filter and print as a mask.
- __init__(owner, shape, fill=None, stroke=None, width=0.0, rounded=False, dash=(), stroke_first=False)#
- scenet.emit.marks.marks(core, family, *, live_text=False)[source]#
Everything a panel paints, in the order it is painted.
- Parameters:
core (
PanelCore) – The compiled panel.family (
Typeface) – The faces its lettering was measured in, fromtypeface_of.live_text (
bool) – Each line of a balloon or a caption as oneTextmark, as the SVG’s--live-textwrites one<text>, rather than a mark for each letter’s outline. Sound effects are outlines either way.
- Return type:
- Returns:
One mark per element the SVG paints, in the same order, with the veil where the SVG draws it.
scenet.emit.pdf#
Panel Core into a PDF a printer takes.
The SVG is for screens; this is for print. It draws exactly what the SVG draws – the same
marks, from the same numbers (scenet.emit.marks) – but says it in inks rather than
colours, because print has a convention a screen does not: lettering goes on the black
plate only, overprinting whatever is under it, so type stays sharp when the colour plates
drift out of register. So every paint is set by what it is, never by converting its hex:
ink – every line and letter – is 100% K and overprints;
the paper – a balloon, the panel’s ground, letters reversed out – is no ink at all, and knocks out what is under it;
a grey is black alone, at the K that prints its lightness under the condition the colours print under (
black_for()); a mass dark enough to be near black prints rich black instead, C40 K100, for even coverage;a tinted colour prints its CMYK twin under one printing condition (
scenet.emit.cmyk), and inmonoits grey, the twin every colour was chosen against.
Nothing is decided here that the SVG does not already show. A page unit prints as a tenth
of a millimetre. The fog and cloud veil, which the SVG draws with a noise filter PDF does not
have, is the same noise computed here (scenet.emit.turbulence) and drawn as a soft mask over
the veil’s ink.
Deterministic, like every other output: objects in a fixed order, nothing compressed (zlib
implementations differ from one platform to the next), no dates, and an /ID taken from
the content. No PDF/X conformance is claimed: that needs a preflight tool this project does
not run.
- scenet.emit.pdf.POINTS_PER_UNIT = 0.28346456692913385#
A page unit, printed: a tenth of a millimetre, in PDF points (72 to the inch).
- scenet.emit.pdf.SCALE_PLACES = 6#
Places for the scale from units to points. Two – right for a coordinate – would write 0.28 and print every page 1.2% small.
- scenet.emit.pdf.INK_PLACES = 4#
Places for an ink’s percentage, as a fraction of 1.
- scenet.emit.pdf.RICH_BLACK = (0.4, 0.0, 0.0, 1.0)#
The rich black a large near-black area prints in: C40 K100, well within any printer’s ink limit. Small type stays 100% K, which a plate drifting out of register cannot blur.
- scenet.emit.pdf.RICH_BLACK_LIGHTNESS = 0.1#
How dark, in OKLab lightness, a mass must be to print rich black: the night foreground, the darkest rung of the ladder (
solve/backdrop.py).
- scenet.emit.pdf.PRINT_DPI = 300#
The resolution printers ask a picture to have at its printed size.
- scenet.emit.pdf.KAPPA = 0.5522847498307936#
How round a quarter of a circle is, drawn as one cubic curve.
- scenet.emit.pdf.PRODUCER = 'Scenet'#
What a PDF reader is told made the file. No version: a release would change every byte.
- scenet.emit.pdf.SRGB_PROFILE = b'\x00\x00\x0b\xd0\x00\x00\x00\x00\x02\x00\x00\x00mntrRGB XYZ \x07\xdf\x00\x02\x00\x0f\x00\x00\x00\x00\x00\x00acsp\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf6\xd6\x00\x01\x00\x00\x00\x00\xd3-\x00\x00\x00\x00=\x0e\xb2\xde\xae\x93\x97\xbe\x9bg&\xce\x8c\nC\xce\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10desc\x00\x00\x01D\x00\x00\x00cbXYZ\x00\x00\x01\xa8\x00\x00\x00\x14bTRC\x00\x00\x01\xbc\x00\x00\x08\x0cgTRC\x00\x00\x01\xbc\x00\x00\x08\x0crTRC\x00\x00\x01\xbc\x00\x00\x08\x0cdmdd\x00\x00\t\xc8\x00\x00\x00\x88gXYZ\x00\x00\nP\x00\x00\x00\x14lumi\x00\x00\nd\x00\x00\x00\x14meas\x00\x00\nx\x00\x00\x00$bkpt\x00\x00\n\x9c\x00\x00\x00\x14rXYZ\x00\x00\n\xb0\x00\x00\x00\x14tech\x00\x00\n\xc4\x00\x00\x00\x0cvued\x00\x00\n\xd0\x00\x00\x00\x87wtpt\x00\x00\x0bX\x00\x00\x00\x14cprt\x00\x00\x0bl\x00\x00\x007chad\x00\x00\x0b\xa4\x00\x00\x00,desc\x00\x00\x00\x00\x00\x00\x00\tsRGB2014\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00XYZ \x00\x00\x00\x00\x00\x00$\xa0\x00\x00\x0f\x84\x00\x00\xb6\xcfcurv\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x05\x00\n\x00\x0f\x00\x14\x00\x19\x00\x1e\x00#\x00(\x00-\x002\x007\x00;\x00@\x00E\x00J\x00O\x00T\x00Y\x00^\x00c\x00h\x00m\x00r\x00w\x00|\x00\x81\x00\x86\x00\x8b\x00\x90\x00\x95\x00\x9a\x00\x9f\x00\xa4\x00\xa9\x00\xae\x00\xb2\x00\xb7\x00\xbc\x00\xc1\x00\xc6\x00\xcb\x00\xd0\x00\xd5\x00\xdb\x00\xe0\x00\xe5\x00\xeb\x00\xf0\x00\xf6\x00\xfb\x01\x01\x01\x07\x01\r\x01\x13\x01\x19\x01\x1f\x01%\x01+\x012\x018\x01>\x01E\x01L\x01R\x01Y\x01`\x01g\x01n\x01u\x01|\x01\x83\x01\x8b\x01\x92\x01\x9a\x01\xa1\x01\xa9\x01\xb1\x01\xb9\x01\xc1\x01\xc9\x01\xd1\x01\xd9\x01\xe1\x01\xe9\x01\xf2\x01\xfa\x02\x03\x02\x0c\x02\x14\x02\x1d\x02&\x02/\x028\x02A\x02K\x02T\x02]\x02g\x02q\x02z\x02\x84\x02\x8e\x02\x98\x02\xa2\x02\xac\x02\xb6\x02\xc1\x02\xcb\x02\xd5\x02\xe0\x02\xeb\x02\xf5\x03\x00\x03\x0b\x03\x16\x03!\x03-\x038\x03C\x03O\x03Z\x03f\x03r\x03~\x03\x8a\x03\x96\x03\xa2\x03\xae\x03\xba\x03\xc7\x03\xd3\x03\xe0\x03\xec\x03\xf9\x04\x06\x04\x13\x04 \x04-\x04;\x04H\x04U\x04c\x04q\x04~\x04\x8c\x04\x9a\x04\xa8\x04\xb6\x04\xc4\x04\xd3\x04\xe1\x04\xf0\x04\xfe\x05\r\x05\x1c\x05+\x05:\x05I\x05X\x05g\x05w\x05\x86\x05\x96\x05\xa6\x05\xb5\x05\xc5\x05\xd5\x05\xe5\x05\xf6\x06\x06\x06\x16\x06\'\x067\x06H\x06Y\x06j\x06{\x06\x8c\x06\x9d\x06\xaf\x06\xc0\x06\xd1\x06\xe3\x06\xf5\x07\x07\x07\x19\x07+\x07=\x07O\x07a\x07t\x07\x86\x07\x99\x07\xac\x07\xbf\x07\xd2\x07\xe5\x07\xf8\x08\x0b\x08\x1f\x082\x08F\x08Z\x08n\x08\x82\x08\x96\x08\xaa\x08\xbe\x08\xd2\x08\xe7\x08\xfb\t\x10\t%\t:\tO\td\ty\t\x8f\t\xa4\t\xba\t\xcf\t\xe5\t\xfb\n\x11\n\'\n=\nT\nj\n\x81\n\x98\n\xae\n\xc5\n\xdc\n\xf3\x0b\x0b\x0b"\x0b9\x0bQ\x0bi\x0b\x80\x0b\x98\x0b\xb0\x0b\xc8\x0b\xe1\x0b\xf9\x0c\x12\x0c*\x0cC\x0c\\\x0cu\x0c\x8e\x0c\xa7\x0c\xc0\x0c\xd9\x0c\xf3\r\r\r&\r@\rZ\rt\r\x8e\r\xa9\r\xc3\r\xde\r\xf8\x0e\x13\x0e.\x0eI\x0ed\x0e\x7f\x0e\x9b\x0e\xb6\x0e\xd2\x0e\xee\x0f\t\x0f%\x0fA\x0f^\x0fz\x0f\x96\x0f\xb3\x0f\xcf\x0f\xec\x10\t\x10&\x10C\x10a\x10~\x10\x9b\x10\xb9\x10\xd7\x10\xf5\x11\x13\x111\x11O\x11m\x11\x8c\x11\xaa\x11\xc9\x11\xe8\x12\x07\x12&\x12E\x12d\x12\x84\x12\xa3\x12\xc3\x12\xe3\x13\x03\x13#\x13C\x13c\x13\x83\x13\xa4\x13\xc5\x13\xe5\x14\x06\x14\'\x14I\x14j\x14\x8b\x14\xad\x14\xce\x14\xf0\x15\x12\x154\x15V\x15x\x15\x9b\x15\xbd\x15\xe0\x16\x03\x16&\x16I\x16l\x16\x8f\x16\xb2\x16\xd6\x16\xfa\x17\x1d\x17A\x17e\x17\x89\x17\xae\x17\xd2\x17\xf7\x18\x1b\x18@\x18e\x18\x8a\x18\xaf\x18\xd5\x18\xfa\x19 \x19E\x19k\x19\x91\x19\xb7\x19\xdd\x1a\x04\x1a*\x1aQ\x1aw\x1a\x9e\x1a\xc5\x1a\xec\x1b\x14\x1b;\x1bc\x1b\x8a\x1b\xb2\x1b\xda\x1c\x02\x1c*\x1cR\x1c{\x1c\xa3\x1c\xcc\x1c\xf5\x1d\x1e\x1dG\x1dp\x1d\x99\x1d\xc3\x1d\xec\x1e\x16\x1e@\x1ej\x1e\x94\x1e\xbe\x1e\xe9\x1f\x13\x1f>\x1fi\x1f\x94\x1f\xbf\x1f\xea \x15 A l \x98 \xc4 \xf0!\x1c!H!u!\xa1!\xce!\xfb"\'"U"\x82"\xaf"\xdd#\n#8#f#\x94#\xc2#\xf0$\x1f$M$|$\xab$\xda%\t%8%h%\x97%\xc7%\xf7&\'&W&\x87&\xb7&\xe8\'\x18\'I\'z\'\xab\'\xdc(\r(?(q(\xa2(\xd4)\x06)8)k)\x9d)\xd0*\x02*5*h*\x9b*\xcf+\x02+6+i+\x9d+\xd1,\x05,9,n,\xa2,\xd7-\x0c-A-v-\xab-\xe1.\x16.L.\x82.\xb7.\xee/$/Z/\x91/\xc7/\xfe050l0\xa40\xdb1\x121J1\x821\xba1\xf22*2c2\x9b2\xd43\r3F3\x7f3\xb83\xf14+4e4\x9e4\xd85\x135M5\x875\xc25\xfd676r6\xae6\xe97$7`7\x9c7\xd78\x148P8\x8c8\xc89\x059B9\x7f9\xbc9\xf9:6:t:\xb2:\xef;-;k;\xaa;\xe8<\'<e<\xa4<\xe3="=a=\xa1=\xe0> >`>\xa0>\xe0?!?a?\xa2?\xe2@#@d@\xa6@\xe7A)AjA\xacA\xeeB0BrB\xb5B\xf7C:C}C\xc0D\x03DGD\x8aD\xceE\x12EUE\x9aE\xdeF"FgF\xabF\xf0G5G{G\xc0H\x05HKH\x91H\xd7I\x1dIcI\xa9I\xf0J7J}J\xc4K\x0cKSK\x9aK\xe2L*LrL\xbaM\x02MJM\x93M\xdcN%NnN\xb7O\x00OIO\x93O\xddP\'PqP\xbbQ\x06QPQ\x9bQ\xe6R1R|R\xc7S\x13S_S\xaaS\xf6TBT\x8fT\xdbU(UuU\xc2V\x0fV\\V\xa9V\xf7WDW\x92W\xe0X/X}X\xcbY\x1aYiY\xb8Z\x07ZVZ\xa6Z\xf5[E[\x95[\xe5\\5\\\x86\\\xd6]\']x]\xc9^\x1a^l^\xbd_\x0f_a_\xb3`\x05`W`\xaa`\xfcaOa\xa2a\xf5bIb\x9cb\xf0cCc\x97c\xebd@d\x94d\xe9e=e\x92e\xe7f=f\x92f\xe8g=g\x93g\xe9h?h\x96h\xeciCi\x9ai\xf1jHj\x9fj\xf7kOk\xa7k\xfflWl\xafm\x08m`m\xb9n\x12nkn\xc4o\x1eoxo\xd1p+p\x86p\xe0q:q\x95q\xf0rKr\xa6s\x01s]s\xb8t\x14tpt\xccu(u\x85u\xe1v>v\x9bv\xf8wVw\xb3x\x11xnx\xccy*y\x89y\xe7zFz\xa5{\x04{c{\xc2|!|\x81|\xe1}A}\xa1~\x01~b~\xc2\x7f#\x7f\x84\x7f\xe5\x80G\x80\xa8\x81\n\x81k\x81\xcd\x820\x82\x92\x82\xf4\x83W\x83\xba\x84\x1d\x84\x80\x84\xe3\x85G\x85\xab\x86\x0e\x86r\x86\xd7\x87;\x87\x9f\x88\x04\x88i\x88\xce\x893\x89\x99\x89\xfe\x8ad\x8a\xca\x8b0\x8b\x96\x8b\xfc\x8cc\x8c\xca\x8d1\x8d\x98\x8d\xff\x8ef\x8e\xce\x8f6\x8f\x9e\x90\x06\x90n\x90\xd6\x91?\x91\xa8\x92\x11\x92z\x92\xe3\x93M\x93\xb6\x94 \x94\x8a\x94\xf4\x95_\x95\xc9\x964\x96\x9f\x97\n\x97u\x97\xe0\x98L\x98\xb8\x99$\x99\x90\x99\xfc\x9ah\x9a\xd5\x9bB\x9b\xaf\x9c\x1c\x9c\x89\x9c\xf7\x9dd\x9d\xd2\x9e@\x9e\xae\x9f\x1d\x9f\x8b\x9f\xfa\xa0i\xa0\xd8\xa1G\xa1\xb6\xa2&\xa2\x96\xa3\x06\xa3v\xa3\xe6\xa4V\xa4\xc7\xa58\xa5\xa9\xa6\x1a\xa6\x8b\xa6\xfd\xa7n\xa7\xe0\xa8R\xa8\xc4\xa97\xa9\xa9\xaa\x1c\xaa\x8f\xab\x02\xabu\xab\xe9\xac\\\xac\xd0\xadD\xad\xb8\xae-\xae\xa1\xaf\x16\xaf\x8b\xb0\x00\xb0u\xb0\xea\xb1`\xb1\xd6\xb2K\xb2\xc2\xb38\xb3\xae\xb4%\xb4\x9c\xb5\x13\xb5\x8a\xb6\x01\xb6y\xb6\xf0\xb7h\xb7\xe0\xb8Y\xb8\xd1\xb9J\xb9\xc2\xba;\xba\xb5\xbb.\xbb\xa7\xbc!\xbc\x9b\xbd\x15\xbd\x8f\xbe\n\xbe\x84\xbe\xff\xbfz\xbf\xf5\xc0p\xc0\xec\xc1g\xc1\xe3\xc2_\xc2\xdb\xc3X\xc3\xd4\xc4Q\xc4\xce\xc5K\xc5\xc8\xc6F\xc6\xc3\xc7A\xc7\xbf\xc8=\xc8\xbc\xc9:\xc9\xb9\xca8\xca\xb7\xcb6\xcb\xb6\xcc5\xcc\xb5\xcd5\xcd\xb5\xce6\xce\xb6\xcf7\xcf\xb8\xd09\xd0\xba\xd1<\xd1\xbe\xd2?\xd2\xc1\xd3D\xd3\xc6\xd4I\xd4\xcb\xd5N\xd5\xd1\xd6U\xd6\xd8\xd7\\\xd7\xe0\xd8d\xd8\xe8\xd9l\xd9\xf1\xdav\xda\xfb\xdb\x80\xdc\x05\xdc\x8a\xdd\x10\xdd\x96\xde\x1c\xde\xa2\xdf)\xdf\xaf\xe06\xe0\xbd\xe1D\xe1\xcc\xe2S\xe2\xdb\xe3c\xe3\xeb\xe4s\xe4\xfc\xe5\x84\xe6\r\xe6\x96\xe7\x1f\xe7\xa9\xe82\xe8\xbc\xe9F\xe9\xd0\xea[\xea\xe5\xebp\xeb\xfb\xec\x86\xed\x11\xed\x9c\xee(\xee\xb4\xef@\xef\xcc\xf0X\xf0\xe5\xf1r\xf1\xff\xf2\x8c\xf3\x19\xf3\xa7\xf44\xf4\xc2\xf5P\xf5\xde\xf6m\xf6\xfb\xf7\x8a\xf8\x19\xf8\xa8\xf98\xf9\xc7\xfaW\xfa\xe7\xfbw\xfc\x07\xfc\x98\xfd)\xfd\xba\xfeK\xfe\xdc\xffm\xff\xffdesc\x00\x00\x00\x00\x00\x00\x00.IEC 61966-2-1 Default RGB Colour Space - sRGB\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00XYZ \x00\x00\x00\x00\x00\x00b\x99\x00\x00\xb7\x85\x00\x00\x18\xdaXYZ \x00\x00\x00\x00\x00\x00\x00\x00\x00P\x00\x00\x00\x00\x00\x00meas\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02XYZ \x00\x00\x00\x00\x00\x00\x00\x9e\x00\x00\x00\xa4\x00\x00\x00\x87XYZ \x00\x00\x00\x00\x00\x00o\xa2\x00\x008\xf5\x00\x00\x03\x90sig \x00\x00\x00\x00CRT desc\x00\x00\x00\x00\x00\x00\x00-Reference Viewing Condition in IEC 61966-2-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00XYZ \x00\x00\x00\x00\x00\x00\xf6\xd6\x00\x01\x00\x00\x00\x00\xd3-text\x00\x00\x00\x00Copyright International Color Consortium, 2015\x00\x00sf32\x00\x00\x00\x00\x00\x01\x0cD\x00\x00\x05\xdf\xff\xff\xf3&\x00\x00\x07\x94\x00\x00\xfd\x8f\xff\xff\xfb\xa1\xff\xff\xfd\xa2\x00\x00\x03\xdb\x00\x00\xc0u'#
The ICC’s sRGB profile, which every RGB picture is tagged with: what a browser reads an untagged picture as, said to a print workflow rather than left to its guess.
- scenet.emit.pdf.OUTPUT_INTENT = '<< /Type /OutputIntent /S /GTS_PDFX /OutputConditionIdentifier (CGATS21-2-CRPC6) /RegistryName (http://www.color.org) /Info (GRACoL 2013, coated #1 sheetfed, CGATS 21-2 CRPC6) >>'#
The printing condition the CMYK twins were made for, named by its ICC registry identifier. A registered condition needs no profile in a plain PDF, and none is embedded: the file claims no PDF/X, which would.
- scenet.emit.pdf.PAGE_GROUP = '/Group << /Type /Group /S /Transparency /CS /DeviceCMYK >>'#
Every page blends its transparency in CMYK, the space it prints in, rather than in one a reader or a RIP picks.
- scenet.emit.pdf.TEXT_PLACES = 6#
Places for where a line set as text starts, so its glyphs land on the outlines’ origins.
- scenet.emit.pdf.Faces#
The faces a document’s text is set in, by their resource name, each with every character lettered in it: what goes into the file, once each.
- scenet.emit.pdf.Veils#
The veils a document paints, by the name of the graphics state that masks each.
- scenet.emit.pdf.lightness(colour)[source]#
OKLab lightness of an sRGB
#rrggbbcolour, grey or not.The solver’s own
lightnessrefuses anything with a hue, because every decision it takes is on a grey. Print has one fill that is not quite grey – a figure’s,#e8e6e1– so the whole conversion is spelt out here.- Return type:
- scenet.emit.pdf.LAB_EPSILON = 0.008856451679035631#
CIELAB’s two constants: where its lightness turns from a straight line to a cube root.
- scenet.emit.pdf.lightness_star(colour)[source]#
CIELAB L* of an sRGB
#rrggbbcolour: how light it looks, as press profiles measure it.Example
>>> from scenet.emit.pdf import lightness_star >>> round(lightness_star("#777777"), 1) 50.0
- Return type:
- scenet.emit.pdf.black_for(grey)[source]#
How much black, alone, a grey prints with: its lightness, on paper.
Black’s ramp under the printing condition (
scenet.emit.cmyk.BLACK_RAMP) says what each whole percent of K prints; a grey takes the K, read between them, that prints its own lightness – once black point compensation has put the screen’s black on the press’s, in luminance, as it does for every colour’s twin. A grey darker than black alone can print takes it all.
- scenet.emit.pdf.overprints(paint)[source]#
Whether a paint prints over what is under it rather than knocking it out: ink does.
- Return type:
- scenet.emit.pdf.printed_panels(pages, panels)[source]#
The panels a print PDF draws: those on a page, or every panel when there are none.
- scenet.emit.pdf.print_notes(panels, *, live_text=False, fonts=None, pages=())[source]#
What print leaves out or changes, one sentence each, for the panels printed.
- Parameters:
panels (
Mapping[str,PanelCore]) – The panels the PDF draws, by name.live_text (
bool) – The PDF letters in text, so a face that may not be embedded is said.fonts (
Mapping[str,FontMetrics] |None) – The declared fonts the panels were lettered in, by digest.pages (
Sequence[PageCore]) – The pages the PDF prints, so a page whose panels bleed with no bleed to run into is said.
- Return type:
- Returns:
The notes – the pages’ first, in order, then the panels’, in the panels’ order.
- scenet.emit.pdf.resolution(image)[source]#
How many of a picture’s pixels fall to the inch where it is printed, the lower way.
A unit prints as a tenth of a millimetre, so an inch is 254 units.
- Return type:
- scenet.emit.pdf.panel_content(core, fonts=None, *, live_text=False)[source]#
A panel’s marks as PDF content, one
q ... Qblock each, in painting order.The veil is a soft mask over its ink, named by the
gsits block sets.- Parameters:
- Return type:
- Returns:
The content lines, in the panel’s own units.
- Raises:
RenderError – The panel is drawn over a supplied picture, or names a font not given.
scenet.emit.pdf_fonts#
A lettering face as a font in the print PDF, for live text.
With --live-text, print letters in the faces themselves rather than in their outlines, so
the words can be selected, searched and copied. The outlines’ promise holds all the same:
each glyph lands where its outline would, at the step the solver measured – that is
scenet.emit.pdf’s part; this module carries the face.
A face goes in as a subset: the glyphs drawn, the glyphs those are built from, and
.notdef, made by fontTools’ subsetter with every glyph kept at its own id. The code the PDF
draws a glyph by is that id, so there is one kind of font for every face: Type0, Identity-H.
TrueType outlines go in as FontFile2; CFF outlines as their OpenType file,
FontFile3 /OpenType (PDF 1.6, ISO 32000-1 §9.7.4.2: a CFF without CID operators is read by
glyph id). Nothing a reader would lay text out with goes in – no GSUB, no GPOS, no
hinting – because every position is the PDF’s.
The face’s licence decides whether it goes in at all: the OS/2 table’s fsType, read as the
OpenType specification says (embedding()). A face that may not go in, or one PDF 1.6
cannot carry, keeps its lettering in outlines, and refusal() says why.
Deterministic, like the rest of the file: the subset’s options are fixed, its date is never
rewritten (fontTools would otherwise stamp the time, or read SOURCE_DATE_EPOCH), its tag
comes from what it holds, and nothing is compressed.
- scenet.emit.pdf_fonts.USAGE = 15#
fsType’s usage permissions, bits 0 to 3 (OpenType,OS/2): 0 is installable.
- scenet.emit.pdf_fonts.RESTRICTED = 2#
A restricted licence: the face may not be embedded.
- scenet.emit.pdf_fonts.PREVIEW_AND_PRINT = 4#
Preview and print: the face may be embedded in a document that is viewed or printed.
- scenet.emit.pdf_fonts.EDITABLE = 8#
Editable: the face may be embedded in a document that is edited.
- scenet.emit.pdf_fonts.NO_SUBSETTING = 256#
The face may not be subset before it is embedded.
- scenet.emit.pdf_fonts.BITMAP_ONLY = 512#
Only the face’s bitmaps may be embedded, none of its outlines.
- scenet.emit.pdf_fonts.WIDTH_PLACES = 6#
Places for a width, in thousandths of an em.
- scenet.emit.pdf_fonts.UNREAD = ('GSUB', 'GPOS', 'GDEF', 'BASE', 'JSTF', 'fvar', 'gvar', 'avar', 'cvar', 'HVAR', 'VVAR', 'MVAR', 'STAT')#
Tables print never reads from a subset: positions are the PDF’s, not the face’s layout tables’, and the default instance of a variable face is the one that was measured.
- scenet.emit.pdf_fonts.CMAP_BLOCK = 100#
The most entries one
beginbfcharblock of a CMap may hold.
- scenet.emit.pdf_fonts.FIXED_PITCH = 1#
FontDescriptorflags (ISO 32000-1, table 123).
- scenet.emit.pdf_fonts.Part#
One object of the PDF: its dictionary’s entries, and its stream’s bytes when it is one.
- class scenet.emit.pdf_fonts.Embedding[source]#
Bases:
StrEnumWhat of a face goes into the PDF.
- SUBSET = 'subset'#
The glyphs drawn, and the glyphs those are built from.
- WHOLE = 'whole'#
The whole file, as it is: the face may not be subset.
- NONE = 'none'#
Nothing: its licence forbids it, or lets only its bitmaps go in.
- scenet.emit.pdf_fonts.embedding(fs_type)[source]#
What a face’s
fsTypelets print embed.The usage sub-field is 0 for an installable face, 2 for a restricted licence, 4 for preview and print, 8 for editable. A face that sets several takes the least restrictive, as the specification allows; one that sets only the reserved bit 0 is read as restricted. A face whose bitmaps alone may go in is not embedded: print has no use for its bitmaps.
- Parameters:
fs_type (
int|None) – TheOS/2table’sfsType, orNonefor a face without that table, which nothing restricts.- Return type:
- Returns:
What goes in.
Example
>>> from scenet.emit.pdf_fonts import embedding >>> [embedding(bits).value for bits in (0x0004, 0x0002, 0x0006, 0x0100)] ['subset', 'none', 'subset', 'whole']
- scenet.emit.pdf_fonts.refusal(metrics)[source]#
Why a face cannot go into the print PDF, or
Nonewhen it can.Worded to follow “is not embedded: “, in a print note.
- class scenet.emit.pdf_fonts.PdfFont[source]#
Bases:
objectA face as the print PDF carries it.
- name#
Its name in the PDF: a subset’s tag, then its PostScript name –
ABCDEF+SourceSansPro-Regular.- Type:
- widths#
Each code’s advance, in thousandths of an em, in order of code.
- text#
The character each code stands for, in order of code: its
ToUnicodemap.
- objects(first)[source]#
Its five objects, numbered from
first.The font a page names, its CIDFont, its descriptor, the font file and its
ToUnicodemap, in that order.
- __init__(name, program, truetype, widths, text, descriptor)#
- scenet.emit.pdf_fonts.width(metrics, character)[source]#
A character’s advance as the font’s
Warray gives it, in thousandths of an em.The writer sets each glyph by this same number, so a reader’s arithmetic and the outlines’ agree: see
scenet.emit.pdf.- Return type:
- scenet.emit.pdf_fonts.pdf_font(metrics, characters)[source]#
A face as a PDF font, holding the glyphs of
characters.- Parameters:
metrics (
FontMetrics) – The face, whichrefusal()found nothing against.characters (
Iterable[str]) – Every character lettered in it, in any order. One the face lacks is left out, as its outlines leave it out.
- Return type:
- Returns:
The font – the same for the same face and characters, whatever their order.
scenet.emit.pdf_images#
A supplied picture as a PDF image, pixels unchanged.
The compiler only ever reads a picture’s size (scenet.images); print has to carry the
picture itself. The rule is to change nothing: no colour conversion – an RGB picture
stays RGB, which the printer’s RIP converts, and the PDF writer tags it as sRGB –
and, wherever PDF can read the file’s own data, the file’s own bytes:
a JPEG Acrobat and every RIP decode (baseline, extended or progressive, 8-bit) goes in whole, as
DCTDecode;a PNG that is not interlaced and has no alpha goes in as its image data,
FlateDecodewith the PNG predictors PDF shares with it – a palette as/Indexed, a transparent colour as a colour-key/Mask;anything else – interlaced, alpha, a palette with transparency – is decoded and its samples stored uncompressed, alpha as a soft mask beside them. Never re-deflated: zlib implementations differ from one platform to the next, and so would the bytes.
gAMA, iCCP and sRGB chunks, and a JPEG’s own profile, are not carried over: an RGB
picture is read as sRGB, as a browser reads an untagged one. A grey picture stays
DeviceGray, printing on black alone, and a CMYK JPEG DeviceCMYK.
- scenet.emit.pdf_images.SIGNATURE = b'\x89PNG\r\n\x1a\n'#
The PNG signature, and the colour types by their number.
- scenet.emit.pdf_images.READABLE_FRAMES = {192, 193, 194}#
JPEG start-of-frame markers PDF readers decode: baseline, extended and progressive.
- scenet.emit.pdf_images.FRAMES = frozenset({192, 193, 194, 195, 197, 198, 199, 201, 202, 203, 205, 206, 207})#
Every start-of-frame marker, readable or not.
- scenet.emit.pdf_images.ADAM7 = ((0, 0, 8, 8), (4, 0, 8, 8), (0, 4, 4, 8), (2, 0, 4, 4), (0, 2, 2, 4), (1, 0, 2, 2), (0, 1, 1, 2))#
Adam7’s passes: where each starts in an 8 x 8 block, and its step, as (x, y, dx, dy).
- class scenet.emit.pdf_images.Embedded[source]#
Bases:
objectA picture ready to be written as an image XObject.
- mask#
The soft mask – alpha – as entries and bytes, if the picture has one.
- __init__(dictionary, data, mask=None)#
- scenet.emit.pdf_images.embed(data, media_type, name)[source]#
A supplied picture’s bytes as a PDF image.
- Parameters:
- Raises:
RenderError – A JPEG no PDF reader decodes, or a file whose data is cut short.
- Return type:
scenet.emit.turbulence#
The fog and cloud veil’s noise, computed for print.
The SVG draws the veil with feTurbulence, and a browser computes its noise. A PDF has no
such filter, so print computes the same noise itself and carries it as a raster: SVG 1.1’s
reference algorithm, which the specification calls “the exact algorithm used for this filter
effect” and which browsers implement. The Filter Effects draft has since changed how that
algorithm draws its gradients; browsers have not, and print follows what the screen shows.
One departure from the C code. A gradient whose two random components are both zero – 243 of the 65,536 seeds Scenet writes draw one – is divided by its zero length there. Chromium keeps it (0, 0); so does print, where the C code would leave NaN.
The noise is sampled at the centre of each sample, one per VEIL_STEP panel units
(127 dpi at a tenth of a millimetre a unit): about fifteen samples across the finest octave of
fog, which looks no different printed than twice as many. It is computed in float64 with
addition, subtraction, multiplication and floor alone, in an explicit loop over octaves –
nothing whose result could depend on the platform, the vector unit or the order of a sum – so
the same veil is the same bytes everywhere, Pyodide included.
- scenet.emit.turbulence.VEIL_STEP = 2.0#
Panel units between samples: 127 dpi.
- scenet.emit.turbulence.RAND_M = 2147483647#
The reference code’s constants: Park and Miller’s generator, and the lattice’s size.
- scenet.emit.turbulence.BAND = 256#
Rows worked out at once, so a veil over a whole page holds no more than a band in memory.
- scenet.emit.turbulence.park_miller(seed)[source]#
The next of Park and Miller’s minimal standard random numbers, as the reference has it.
- Return type:
- class scenet.emit.turbulence.Lattice[source]#
Bases:
objectThe reference code’s lattice for one seed.
- __init__(selector, gradient)#
- scenet.emit.turbulence.lattice(seed)[source]#
The lattice
initbuilds for a seed.In the reference code’s order: every channel’s gradients first, then the shuffle.
- Return type:
- scenet.emit.turbulence.fractal_noise(grid, channel, x, y, frequency, octaves)[source]#
The reference
turbulence, asfractalNoisedoes it.Each octave’s noise at half the weight of the one before, summed in order.
- Return type:
- class scenet.emit.turbulence.Alpha[source]#
Bases:
objectA veil’s opacity, sampled:
rowsrows ofcolumnsbytes, 0 clear and 255 opaque.- __init__(columns, rows, data)#
- scenet.emit.turbulence.veil_alpha(veil, width, height, step=2.0)[source]#
How opaque a veil is over a panel, sample by sample.
What the SVG’s colour matrix makes of the noise:
opacityof its red channel and half that of its green, each channel(noise + 1) / 2clamped to [0, 1]; then clamped, and rounded to a byte once.- Parameters:
- Return type:
- Returns:
The samples, covering the panel from its top left, the last row and column reaching at most a step past its edge.
scenet.emit.cmyk#
The tinted palette’s CMYK twins, and black’s ramp, for print.
Generated by scripts/make_palette.py, which converts every colour the compiler owns through
the condition’s ICC profile with littleCMS – relative colorimetric, black point compensation,
from sRGB – and measures what K alone prints. Do not edit: run the script.
- scenet.emit.cmyk.CONDITION = 'CGATS21-2-CRPC6'#
The printing condition, by its ICC registry name: GRACoL 2013, coated #1.
- scenet.emit.cmyk.BLACK_POINT = 10.98#
How dark the condition’s black prints, in CIELAB L*. Black point compensation maps sRGB’s black onto it, and every lightness on the way, in luminance: Y’ = Ybk + Y (1 - Ybk).
- scenet.emit.cmyk.CMYK: dict[str, tuple[int, int, int, int]] = {'#010206': (85, 73, 55, 97), '#050a0f': (85, 70, 55, 94), '#070e19': (88, 70, 44, 90), '#080410': (84, 76, 44, 94), '#11111b': (83, 73, 47, 88), '#182331': (85, 65, 38, 76), '#2a3849': (81, 60, 34, 58), '#2c182b': (69, 83, 33, 77), '#313941': (75, 59, 46, 58), '#3b313f': (69, 70, 41, 59), '#3d4f62': (75, 52, 32, 40), '#5a3240': (45, 76, 40, 54), '#65727c': (59, 42, 34, 22), '#6d5561': (50, 60, 38, 31), '#88514b': (25, 64, 54, 36), '#9fb0bc': (40, 22, 18, 2), '#a27f7f': (30, 46, 36, 15), '#b07750': (13, 49, 64, 23), '#d2af9c': (16, 31, 34, 4), '#ddf2ff': (14, 0, 0, 0), '#fef0a1': (2, 2, 45, 0)}#
Each colour’s CMYK under the condition, in whole percents, by the colour’s
#rrggbb.
- scenet.emit.cmyk.BLACK_RAMP: tuple[float, ...] = (100.0, 99.22, 98.43, 97.65, 96.86, 96.08, 95.69, 94.9, 94.12, 93.33, 92.55, 91.76, 90.98, 90.59, 89.41, 89.02, 88.24, 87.84, 86.67, 86.27, 85.49, 84.71, 83.92, 83.14, 82.75, 81.96, 81.18, 80.39, 80.0, 79.22, 78.43, 77.65, 76.86, 76.08, 75.29, 74.9, 74.12, 73.33, 72.55, 72.16, 70.98, 70.2, 69.8, 69.02, 68.24, 67.45, 67.06, 65.88, 65.49, 64.71, 63.53, 63.14, 61.96, 61.57, 60.78, 60.0, 59.22, 58.43, 57.65, 56.86, 56.08, 54.9, 54.12, 53.33, 52.55, 51.76, 50.98, 49.8, 49.41, 48.24, 47.45, 46.67, 45.49, 44.71, 43.53, 42.75, 41.96, 41.18, 40.0, 39.22, 38.04, 36.86, 36.08, 34.9, 34.12, 32.94, 32.16, 30.59, 29.8, 28.63, 27.45, 26.67, 25.49, 24.31, 23.14, 22.35, 21.18, 20.39, 19.22, 18.43, 17.25)#
What each whole percent of K, alone, prints under the condition, in CIELAB L*: K 0 is the paper, L* 100; K 100 is as dark as one plate goes.
scenet.emit.debug_svg#
Diagnostic overlay: what the solver was actually looking at.
Building a geometric solver without this is guesswork. When a balloon lands somewhere surprising, the question is always “what did the solver think was there?” – and the answer is invisible in the finished panel. This draws the hidden geometry: silhouette hulls, face exclusion circles, anchors, gaze vectors, tail routes, and what an inset covers.
- scenet.emit.debug_svg.TRIM = '#d0217a'#
The trim of a page whose panels bleed, and the box their lettering keeps inside.
- scenet.emit.debug_svg.lettering_box(box)[source]#
A bleeding panel’s lettering box, dashed: what the trim will never cut.
- Return type:
- scenet.emit.debug_svg.debug_body(core, *, id_prefix='')[source]#
The overlay’s contents, without the document around them: what a strip places.
Every part is kept, an empty one included – a panel with no setting draws no backdrop, and leaves a blank line where it would be – so the overlay reads the same placed as alone.
scenet.emit.strip#
Several panels laid out as a strip.
Deliberately minimal. Real page composition – tiers, panels of varying size, the page-level reading path, bleeds – is a substantial design problem in its own right and is explicitly out of scope. This is the smallest thing that lets a sequence be read as a sequence: panels in a row, separated by a gutter, in declaration order.
The gutter is not decoration. It is where the reader performs what Scott McCloud calls closure – inferring what happened between two panels – and it is the one formal element that distinguishes comics from a series of illustrations.
A panel in a strip looks exactly as it does alone. Two things make that true, and both used to be missing:
Each panel is clipped to its frame. A shot crops the body at the frame, so most of a figure usually lies outside it. A panel on its own hides that behind its
viewBox; here the same rectangle is aclipPath, or the rest of the figure would draw into the gutter – and, once panels stack, into the tier below. The clip sits on an inner group with no transform of its own, becauseuserSpaceOnUseis defined against the referencing element’s user space, which is ambiguous on an element that also carries atransform. The overlay is clipped too: alone, itsviewBoxclips it just the same.Every id is unique. Each panel’s ids, and the references to them, are prefixed by the panel’s position –
p1-,p2-– rather than its name. A name is whatever the document said, and while attribute escaping keeps one inside its quotes, nothing would keep it insideurl(#...). Position is unique, safe and the same on every run. The panel’s group keeps its name, aspanel-<name>.
- scenet.emit.strip.GROUP = ' role="group"'#
A document of panels, for a screen reader: a group, each panel in it an image.
groupis the role every engine computes and screen readers announce;graphics-documentis the specification’s, but Firefox reduces it to a plain document and no screen-reader test of it is published (ACT rule 7d6734 calls its support inconsistent).
- scenet.emit.strip.HIDDEN = ' aria-hidden="true"'#
On a shape of the document’s own – a background, a page, an inset’s ring – so that WebKit, which exposes an unnamed shape under a named ancestor as an unnamed image, does not announce it.
- scenet.emit.strip.reading_direction(directions, what)[source]#
The one way a set of panels or pages is read, which laying them out side by side needs.
- Raises:
RenderError – They are not all read the same way. Every panel and page of one document is, so this is panels gathered from documents read differently.
- Return type:
- scenet.emit.strip.counted(number, noun)[source]#
1 panel,2 panels: a count as it is said.Example
>>> from scenet.emit.strip import counted >>> counted(1, "panel"), counted(3, "page") ('1 panel', '3 pages')
- Return type:
- scenet.emit.strip.placed_panel(name, core, position, x, y, *, live_text=False, debug=False, fonts=None, holes=(), aria=True, embed=None)[source]#
One panel, rendered on its own and put at
(x, y)in a larger document.Shared by the strip and the page, so both place a panel the same way: clipped to its frame, and with every id prefixed by the panel’s position in the document – see the module docstring for why position and not name.
- Parameters:
name (
str) – The panel’s name, kept as the group’s id.core (
PanelCore) – The compiled panel.position (
int) – Its one-based position in the document, unique within it.x (
float) – Where its left edge goes.y (
float) – Where its top edge goes.live_text (
bool) – Emit lettering as<text>rather than glyph outlines.debug (
bool) – Place the panel’s diagnostic overlay instead of the panel.fonts (
Mapping[str,FontMetrics] |None) – The declared fonts the panel was lettered in, by digest.holes (
Sequence[Box]) – Areas cut out of it, in its own units: on a page, the rings of the insets set into it, which are drawn over it. Each is a clip of its own, nested inside the frame’s, so the clips intersect and two rings that touch need no geometry.aria (
bool) – Make the panel’s group the image a screen reader reads, named asaccessible_namenames a panel. Never on an overlay.embed (
Mapping[str,bytes] |None) – The supplied pictures’ bytes, by digest, to write into the SVG.
- Return type:
- Returns:
The lines of SVG, indented for the document’s top level.
scenet.emit.page#
Pages into SVG: every panel at its frame.
Mechanical, like every emitter: the frames were resolved into Page Core and each panel into
its own Panel Core, so this only places one inside the other. Each panel is placed exactly
as the strip places one (placed_panel): rendered on
its own, clipped to its frame, its ids prefixed by its position so they stay unique in the
page.
For a screen reader, a page is a named group and each panel in it one image, in reading order; the page’s own shapes – its sheet, an inset’s ring – are hidden.
scenet.emit.conditioning#
What the exports for image models share: the canvas, fractions of it, and the JSON.
The exports hand a panel’s staging to whatever a reader feeds it to – ControlNet, GLIGEN, a tool of their own. No model runs in Scenet: each export is another emitter, reading Panel Core and nothing else, as deterministic and as explicable as the SVG.
Everything is said on the panel’s own canvas: one pixel per panel unit, rounded up to whole pixels. A box is said as fractions of the panel, which is what box-conditioned models take.
- scenet.emit.conditioning.FRACTION_PLACES = 4#
Decimal places of a fraction of the panel: a tenth of a unit on a panel 1000 wide.
- class scenet.emit.conditioning.Ramp[source]#
Bases:
objectA fill that runs straight down or up the panel, from one colour to another.
A linear gradient in the panel’s own units with no slant, so everything at one height is one colour; past either end, the colour is that end’s. Its paint names
startas the fallback: a renderer that cannot resolve the gradient drawsstart, and so does a tool reading a region’s colour from itsfill.- ends#
Where it ends: below
beginsfor a ramp that runs down, above it for one that runs up.- Type:
- __init__(start, end, begins, ends)#
- class scenet.emit.conditioning.Region[source]#
Bases:
objectOne region a map export fills: what the panel’s geometric contract names.
An actor’s hull – where staging put it, not the mannequin Scenet draws it as, so a model is told where a character is and the pose how it stands – a mass’s polygon, or a figure’s body and face as its picture’s contract declares them.
- polygon#
The outline. Empty for a figure whose contract declares no body.
- depth#
Painter’s order, as Panel Core records it. None for a figure, which has none of its own.
- kind#
What a mass is made of, which the depth map reads: the sky is at infinity, and a ground, floor, water or ceiling recedes. None for an actor or a figure.
- who#
The character it is, for an actor or a figure: the actor’s id, or the part a figure plays – or, uncast, its own name. None for a mass.
- __init__(id, polygon, disc=None, depth=None, kind=None, who=None)#
- scenet.emit.conditioning.canvas(core)[source]#
The panel as an image: one pixel per panel unit, rounded up to whole pixels.
Example
>>> from scenet import compile_source >>> from scenet.emit.conditioning import canvas >>> canvas( ... compile_source("{panel: {size: [600.5, 400]}, cast: {a: {reference: alice}}}").core ... ) (601, 400)
- scenet.emit.conditioning.drawn_at(core, point)[source]#
Whether a point is inside what the panel draws: the frame, edge included.
A panel in a slanted tier is drawn clipped to its
outline, so outside the outline is outside the panel. An inset over it is not: the panel’s art is drawn under it as usual.- Return type:
- scenet.emit.conditioning.figure_extent(figure)[source]#
What a figure a picture draws covers: its body, and its face.
A contract may declare a body without the head, or no body at all, and the face is always there: its bounding square joins whatever body there is.
- scenet.emit.conditioning.flat_map(core, fills)[source]#
An SVG of flat fills and ramps on black, on the panel’s canvas, clipped as the panel is.
Black is nothing: the paper, the sky, a supplied picture whose content the compiler never saw. A panel in a slanted tier is clipped to its outline; an inset over it is not there, since the panel’s art is drawn under it as usual.
Edges are crisp,
shape-rendering="crispEdges": an antialiased edge would blend two regions into a colour, or a grey, that belongs to neither. A ramp’s greys are all its own region’s. The map is the pose’s and the boxes’ canvas – the panel rounded up to whole pixels, one unit to a pixel – so every export is on one pixel grid. Nothing is stretched: what lies past the panel’s own edge, under a pixel wide, is black, which is nothing.Each ramp is a gradient defined before any shape and named by the position of its region in drawing order,
ramp-2, never by the region’s id: an id is whatever a Core said, and while attribute escaping keeps one inside its quotes, nothing would keep it insideurl(...).
- scenet.emit.conditioning.fraction_box(core, points)[source]#
The bounds of what the panel draws of a shape, as
[xmin, ymin, xmax, ymax]fractions.The shape is the convex hull of the points – a hull, a body, a box – cut to what the panel draws: its frame, or a slanted tier’s outline. What lies outside is not in the picture, so a body wider below the frame is bounded where the frame cuts it.
- scenet.emit.conditioning.regions(core)[source]#
Every region of the panel, in the order the panel draws them: back to front.
Masses and actors in the panel’s own painter’s order, then the figures a picture draws, which are over the picture and under nothing, in the order their contract declares them. Marks and sound effects are none of them: they are drawn around a figure, not part of it.
scenet.emit.pose#
Each actor’s skeleton as OpenPose JSON, for pose-conditioned image models.
The OpenPose output format
as ControlNet’s tooling reads it: people[].pose_keypoints_2d, flat x, y, confidence
triplets in the COCO-18 body order, in pixels of a canvas canvas_width by canvas_height.
Left and right. Scenet names a joint by the side of the screen it is on in the puppet’s
rest pose, and mirrors a figure facing left; OpenPose names a point by the subject’s own side.
Every Scenet body faces the reader, turned one way or the other, and a body facing the reader
has its right on the reader’s left. So the subject’s right is _l on a figure facing right and
_r on one facing left – on the reader’s left either way.
A point is missing – 0, 0, 0, as OpenPose writes a part it did not detect – when the puppet
has no joint or feature by that name, when it is outside what the panel draws, and always for
the ears, which no puppet draws. root, spine and head have no COCO-18 counterpart.
Figures a picture draws were never posed and have no skeleton, so they are not in people.
- scenet.emit.pose.COCO_18: tuple[str, ...] = ('nose', 'neck', 'right_shoulder', 'right_elbow', 'right_wrist', 'left_shoulder', 'left_elbow', 'left_wrist', 'right_hip', 'right_knee', 'right_ankle', 'left_hip', 'left_knee', 'left_ankle', 'right_eye', 'left_eye', 'right_ear', 'left_ear')#
The COCO-18 body points, in OpenPose’s order.
- scenet.emit.pose.SOURCES: tuple[tuple[str, str] | None, ...] = (('features', 'nose'), ('joints', 'neck'), ('joints', 'shoulder_{R}'), ('joints', 'elbow_{R}'), ('joints', 'wrist_{R}'), ('joints', 'shoulder_{L}'), ('joints', 'elbow_{L}'), ('joints', 'wrist_{L}'), ('joints', 'hip_{R}'), ('joints', 'knee_{R}'), ('joints', 'ankle_{R}'), ('joints', 'hip_{L}'), ('joints', 'knee_{L}'), ('joints', 'ankle_{L}'), ('features', 'eye_{R}'), ('features', 'eye_{L}'), None, None)#
Where each point comes from: a joint or a face feature,
{R}the suffix of the subject’s right and{L}of their left. None for a point no puppet has.
- scenet.emit.pose.keypoints(core, actor)[source]#
One actor as COCO-18: fifty-four numbers,
x, y, confidenceper point.
- scenet.emit.pose.render_pose(core)[source]#
Every actor’s pose as OpenPose JSON.
One person per actor, in Panel Core’s order – the order the semantics export lists the actors in – so
people[i]is the i-th actor. Coordinates are pixels of the panel’s canvas, as OpenPose writes them; a tool that wants fractions divides by the canvas size.
scenet.emit.boxes#
Each figure’s extent with a phrase, for box-conditioned image models.
“This entity, here”, as GLIGEN takes it: a phrase and a box per actor and per figure a picture
draws, the box as [xmin, ymin, xmax, ymax] fractions of the panel – what diffusers’ GLIGEN
pipeline reads as gligen_boxes, beside the phrases as gligen_phrases.
An actor’s box is its hull’s bounds: the silhouette staging spaced the cast by, which leaves emanata out so that a figure who starts sweating does not move. A figure’s is its body and face as the picture’s contract declares them. Each is clipped to the panel, and one wholly outside it has no box.
The phrase is the description’s own words for a figure (traits): its name, how it stands, its face, its marks. Where it is on
the panel is the box’s to say.
- class scenet.emit.boxes.Boxed[source]#
Bases:
objectOne box the export writes, and whose region it is.
- __init__(id, region, phrase, box)#
scenet.emit.semantics#
What a panel holds, as structure, for whatever writes a prompt from it.
Not a prompt. Prompt dialects differ per model and change every few months, and turning structure into prose is the language step that prior art leaves to whatever is in the loop, not to a compiler. So this hands over the structure: the camera, the setting, every actor – reference, pose, expression, marks, facing, whom they look at, depth – every figure a picture draws, and every balloon, caption and sound effect in reading order with its box.
Where Panel Core already has words, they are copied, never phrased again: the panel’s
description and each entry’s label, which accessible output reads.
Each actor and figure also carries its mask colour: the mask export’s own, taken from its code
rather than worked out again, so a tool can map a colour of the mask to a character without
parsing the SVG. The two cannot disagree – and so a change to how the mask is coloured changes
this export too.
- scenet.emit.semantics.render_semantics(core)[source]#
What the panel holds, as JSON.
Actors are listed in Panel Core’s order, the order the pose export lists people in. Facing is read from the mirror: a mirrored puppet faces left. Each actor and figure has its mask colour.
The palette is named only when it is not
mono, so the semantics of every panel drawn in grey is what it was before palettes existed. It is the one export a palette reaches: colour never changes a value, so the pose, boxes, depth and mask are the same in every palette.
scenet.emit.depth#
A panel’s planes as a depth map, for depth-conditioned image models.
Scenet is orthographic and has no metric depth. What it has is a painter’s order – an integer
depth actors and masses share – so the map is grey planes in that order, and claims
nothing more: the steps are ranks, not distances.
ControlNet’s depth maps run white near, black far. That is the reverse of the backdrop’s own value ladder, where aerial perspective makes far planes paler, so none of those tones is reused: a model handed them would read the panel inside out.
Black is nothing nearer than infinity: the paper, the sky (whatever plane it was filed under, as its tone already treats it), and a supplied picture, whose content the compiler never saw.
Every other depth present, ranked far to near, is one even step paler, so the frontmost is white.
Figures a picture draws have no painter’s order of their own. They share one plane, in front of the picture they are drawn against.
A surface that lies flat recedes. A ground, a floor or a stretch of water is not a wall at one distance, and one flat grey tells a model it is: the floor comes out painted as a backdrop, with figures pasted on it. Depth models are trained on relative inverse depth, and through a pinhole camera a flat ground’s inverse depth grows in proportion to how far below the horizon it is seen – a straight ramp in screen height. So each is a ramp from the horizon, at its own step, to the panel’s bottom edge; a ceiling the same, up to the top edge. That claims what the kind already says, that the surface recedes to the horizon, and still no distance between two regions:
At the horizon, its own step, so it is never darker than its plane and the painter’s order holds everywhere. Scenet stands walls and buildings on the horizon line itself, so the true disparity there, black, would put the ground behind what stands on it.
At the edge, the farthest figure’s step, white when there is none, so no figure is ever darker than the floor around its feet. A ground in the foreground plane, already a step above every actor, stays flat: a ramp would only darken it.
- scenet.emit.depth.grey(value)[source]#
A grey of one value,
#rrggbb.Example
>>> from scenet.emit.depth import grey >>> grey(255), grey(0) ('#ffffff', '#000000')
- Return type:
- scenet.emit.depth.recedes(core, region)[source]#
Where a surface that lies flat recedes from and to, as heights:
(far, near).A ground, floor or water runs from the horizon down to the panel’s bottom edge, a ceiling from the horizon up to its top edge. A backdrop that sets no horizon – a hand-edited one – recedes from the mass’s own far edge instead: a ground’s top, a ceiling’s bottom.
- Parameters:
- Return type:
- Returns:
The two heights, or None for anything that does not lie flat, or that has no room to recede toward the reader.
Example
>>> from scenet import compile_source >>> from scenet.emit.conditioning import regions >>> from scenet.emit.depth import recedes >>> core = compile_source( ... "{panel: {size: [900, 560]}, setting: {place: street}," ... " cast: {a: {reference: alice}}}" ... ).core >>> [recedes(core, region) for region in regions(core)][-2:] [(308.0, 560.0), None]
scenet.emit.mask#
A panel’s regions as an instance mask, for region-conditioned image models.
One flat fill per actor, figure and mass, under the id the panel’s SVG gives it – actor-alice,
mass-m0, figure-ana – so a segmentation keeps the labels the panel has. The colour of an id
is read from the SVG itself. Regions are drawn in the panel’s own painter’s order, so what covers
what is what the panel draws, and black is nothing.
A character keeps its colour across panels, unless another character in the same panel has the same hue, in which case the later id (in sorted order) takes the next free one. The hue comes from the id’s digest, one of 64, so a regional prompt or an identity follows a character down the page; a figure a picture draws takes the colour of the part it plays. With 64 hues, two of four characters share one about one panel in ten. Masses take theirs in drawing order from a band of their own – paler, less saturated – so a wall is never mistaken for a character.
This is an instance map, not a class map: two actors are two colours. What each region is – an actor’s puppet, a mass’s kind and plane – is in the semantics export, by the same id.
- scenet.emit.mask.CHARACTER_SLOTS = 64#
How many colours a character may take: hues evenly round the wheel, saturated and bright.
- scenet.emit.mask.GOLDEN = 0.6180339887498949#
The golden ratio’s fractional part: hues stepped by it never repeat and stay far apart.
- scenet.emit.mask.character_colour(slot)[source]#
A character’s colour: one of
CHARACTER_SLOTShues, saturated and bright.Example
>>> from scenet.emit.mask import character_colour >>> character_colour(0) '#ff2626'
- Return type:
- scenet.emit.mask.colours(drawn)[source]#
Each region’s mask colour, in the order given.
Characters are settled in the order of their names, whatever order they are drawn in: each takes its own slot, or the next one no earlier name took.
- scenet.emit.mask.mass_colour(index)[source]#
The colour of the mass drawn
index-th: less saturated than any character’s, never dark.Hues step round the wheel by the golden ratio, and every other one is a little darker, so neighbours in drawing order are easy to tell apart.
Example
>>> from scenet.emit.mask import mass_colour >>> mass_colour(0) '#d97777'
- Return type:
scenet.emit.export#
Every export of a panel’s staging for image models, at once.
Five files, each another emitter reading Panel Core alone: the pose as OpenPose JSON, boxes with phrases, a depth map in painter’s order, an instance mask, and the semantics as structure. No model runs in Scenet – what a reader feeds these to is outside the pipeline, as a tracing over the SVG would be – and nothing is rasterised: text, JSON and SVG only, each byte-identical across runs and platforms.
- scenet.emit.export.EXPORTS: tuple[tuple[str, Callable[[PanelCore], str]], ...] = (('.pose.json', <function render_pose>), ('.boxes.json', <function render_boxes>), ('.depth.svg', <function render_depth>), ('.mask.svg', <function render_mask>), ('.semantics.json', <function render_semantics>))#
Each export, by the suffix its file takes after the panel’s own name, in the order
scenet build --conditioningwrites them – which is also the order of the fields ofConditioning, the one place it is written.
- scenet.emit.export.conditioning_archive(panels, stem)[source]#
Every panel’s exports in one ZIP, named as
scenet build --conditioningnames them.What the playground offers for a document of several panels, where five downloads a panel would be a click for every file. Unpacked, it is what the command line writes: a panel document’s five files are
stem.pose.jsonand the rest, and every other document’s are named after their panel,stem.one.pose.json, even a lone one.Stored, not deflated, and stamped with no clock or machine of its own, so the same panels give the same bytes on every run and every platform.
scenet.emit.preview#
The pose and the boxes exports, drawn to be looked at.
The pose and the boxes are JSON, which a model reads and a person cannot. These draw each as a picture on the exports’ own canvas, for the playground to show beside the depth map and the mask. They read what the exports read – the same keypoints, the same boxes – so what is shown is what is written, and they are no export themselves: a model is handed the JSON.
The pose is drawn as ControlNet’s OpenPose annotator draws a skeleton, so it looks like what a reader who works with these models has seen: each limb and each point in the usual OpenPose colour, on black. A limb is drawn only between two points that are there.
The boxes are labelled rectangles, each in its region’s colour in the mask, so the two side by side say who is who in one colour. The label is the phrase the export pairs the box with.
- scenet.emit.preview.OPENPOSE_COLOURS: tuple[str, ...] = ('#ff0000', '#ff5500', '#ffaa00', '#ffff00', '#aaff00', '#55ff00', '#00ff00', '#00ff55', '#00ffaa', '#00ffff', '#00aaff', '#0055ff', '#0000ff', '#5500ff', '#aa00ff', '#ff00ff', '#ff00aa', '#ff0055')#
Each COCO-18 point’s colour, in OpenPose’s order: red round the wheel to rose. A limb takes the colour at its own position in
OPENPOSE_LIMBS.
- scenet.emit.preview.OPENPOSE_LIMBS: tuple[tuple[int, int], ...] = ((1, 2), (1, 5), (2, 3), (3, 4), (5, 6), (6, 7), (1, 8), (8, 9), (9, 10), (1, 11), (11, 12), (12, 13), (1, 0), (0, 14), (14, 16), (0, 15), (15, 17))#
The limbs OpenPose draws, as pairs of COCO-18 points: the neck to each shoulder, down each arm, the neck to each hip and down each leg, then the head. Its two ear-to-shoulder limbs are left out, as its own drawing leaves them out.
- scenet.emit.preview.REFERENCE_WIDTH = 512#
The width OpenPose’s drawing is sized for. A canvas twice as wide draws twice as thick, so a skeleton looks the same on any panel.
- scenet.emit.preview.render_boxes_preview(core)[source]#
Every box the boxes export writes, labelled with its phrase, in its mask colour.