vectorGenerated
Category: Packages · Manifest: use "kernels/";
Drawings filled pixel by pixel.
Description
Section titled “Description”Drawings filled pixel by pixel: the shapes entelechy import reads from
SVG, their fill rules, paints and gradients, drawn whole or tiled.
Layer: Graphics. Uses: parallel.
use "vector.entpkg";Kernels
Section titled “Kernels”kernels/fill.ent— Drawing as Kernels. Kernels:vector.frame@1,vector.whole@1,vector.draw@1.kernels/shape.ent— A drawing’s shapes asentelechy importwrites them from an SVG.kernels/tile.ent— The tiled form. Kernels:vector.reach@1,vector.shape_chunks@1,vector.tile_counts@1,vector.tile_fill@1,vector.placed@1,vector.segment_chunks@1,vector.units@1,vector.kept@1,vector.keep@1,vector.zeros@1,vector.backdrop@1,vector.draw_tiled@1.
Graph presets
Section titled “Graph presets”graphs/draw.esn— A drawing throughlookat the window’s size, tiled.graphs/drawing.esn— A drawing, whole and fitted to the window, overbackground.
tests/ holds scenes and their replays, run on every backend:
many.replay, tiled.replay. Every Kernel of the package is reached by
one of them.
Used by the vector example.
Kernels
Section titled “Kernels”| Kernel | Mode | Brief |
|---|---|---|
vector.backdrop@1 |
scatter into input 12 with sum | Each cell’s backdrop, a row of its tile to an element. Each of a unit’s segments wholly past the tile adds its turn to the rows it may cross, a pixel over its ends, each crossing tested at the row’s point in the drawing, read from the frame the drawing reads, as crossed tests it. |
vector.draw@1 |
map | The drawing over background, through frame, at the node’s domain: every pixel asks every shape and segment. |
vector.draw_tiled@1 |
map | The drawing, each pixel asking only its tile’s shapes and, of each, the cell’s own segments over its row’s backdrop: the same words vector.draw@1 draws. |
vector.frame@1 |
map | Where the look puts each pixel’s center in the drawing, and a pixel’s size there: the x of each of across’s columns, then the y of each of down’s rows, then the size; domain = count(across) + count(down) + 1. Every Kernel that asks where a pixel is reads it here, so they agree to the bit wherever each runs. |
vector.keep@1 |
scatter into input 11 with max | Each unit’s segments, in their order, into its part of the cells’ list: the walk vector.kept@1 counts. |
vector.kept@1 |
map | How many of its segments each unit gives its cell. |
vector.placed@1 |
map | Each segment on the canvas, as its shape’s box is. |
vector.reach@1 |
map | Each shape’s reach: the tiles its box, grown by two pixels, touches on the canvas. |
vector.segment_chunks@1 |
map | The box each chunk of segments spans on the canvas: least x and y, most x and y. |
vector.shape_chunks@1 |
map | What each chunk of shapes reaches together. |
vector.tile_counts@1 |
map | How many shapes reach each tile. |
vector.tile_fill@1 |
scatter into input 5 with max | Each tile’s shapes, in their order, into its part of the list: the walk vector.tile_counts@1 counts, stopped at its count. |
vector.units@1 |
map | How many units each cell is: its shape’s chunks. |
vector.whole@1 |
map | A look at the whole drawing: its middle, fitted to the picture. |
vector.zeros@1 |
map | A list of zeros, a row of each cell’s tile to each. |
Methods
Section titled “Methods”Types and structs
Section titled “Types and structs”| Name | Syntax |
|---|---|
Shape |
struct Shape |
FillRule |
type FillRule = enum { NonZero, EvenOdd }; |
Paint |
type Paint = enum { Color, Linear, Radial }; |
Spread |
type Spread = enum { Pad, Reflect, Repeat }; |
Stop |
struct Stop { offset: Float; color: Vec4; } |
Look |
struct Look { center: Vec2; zoom: Float; } |
Reach |
struct Reach { x0: Int; y0: Int; x1: Int; y1: Int; } |
Slot |
struct Slot { at: Int; value: Int; } |
Unit |
struct Unit { cell: Int; tx: Int; ty: Int; chunk: Int; first: Int; count: Int; } |
Graph presets
Section titled “Graph presets”| Name | Interface | Description |
|---|---|---|
draw |
input shapes: Rows<Shape>input segments: Rows<Vec4>input stops: Rows<Stop>input view: Rows<Vec2>input look: Rows<Look>param background: Vec4 = vec4(1.0, 1.0, 1.0, 1.0)output picture <- drawn.result |
A drawing through look at the window’s size, tiled: the canvas is cut into tiles of 16 pixels, each keeps the shapes whose boxes reach it, each of those keeps the segments that reach the tile and the winding of those past it to the right, and each pixel asks only those. It draws the words vector.draw@1 draws, at the cost of a few passes over shapes and segments, so a large drawing (a map, a page of type) draws in time. |
drawing |
input shapes: Rows<Shape>input segments: Rows<Vec4>input stops: Rows<Stop>input view: Rows<Vec2>param background: Vec4 = vec4(1.0, 1.0, 1.0, 1.0)output picture <- drawn.picture |
A drawing, whole and fitted to the window, over background. Its Fields are what entelechy import drawing.svg writes: node picture: graph “../../packages/vector.entpkg/graphs/drawing.esn” { shapes <- shapes; segments <- segments; stops <- stops; view <- view; } |
Kernel descriptions
Section titled “Kernel descriptions”vector.backdrop@1
Section titled “vector.backdrop@1”Each cell’s backdrop, a row of its tile to an element. Each of a unit’s segments wholly past the tile adds its turn to the rows it may cross, a pixel over its ends, each crossing tested at the row’s point in the drawing, read from the frame the drawing reads, as crossed tests it.
| Mode | scatter into input 12 with sum |
| Requires | field.read, field.write |
| Inputs | total: Rows<Int>, units: Rows<Int>, unit_ends: Rows<Int>, tile_ends: Rows<Int>, tile_shapes: Rows<Int>, tiles: Grid<Int>, shapes: Rows<Shape>, placed: Rows<Vec4>, chunks: Rows<Vec4>, segments: Rows<Vec4>, frame: Rows<Float>, canvas: Grid<Int>, zeros: Rows<Int> |
| Params | — |
| Outputs | result: Rows<Int> |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.draw@1
Section titled “vector.draw@1”The drawing over background, through frame, at the node’s domain: every pixel asks every shape and segment.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | shapes: Rows<Shape>, segments: Rows<Vec4>, stops: Rows<Stop>, frame: Rows<Float> |
| Params | background: Vec4 = [1.0, 1.0, 1.0, 1.0] |
| Outputs | result: Image |
| Source | packages/vector.entpkg/kernels/fill.ent |
vector.draw_tiled@1
Section titled “vector.draw_tiled@1”The drawing, each pixel asking only its tile’s shapes and, of each, the cell’s own segments over its row’s backdrop: the same words vector.draw@1 draws.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | shapes: Rows<Shape>, segments: Rows<Vec4>, stops: Rows<Stop>, frame: Rows<Float>, tile_counts: Rows<Int>, tile_ends: Rows<Int>, tile_shapes: Rows<Int>, units: Rows<Int>, unit_ends: Rows<Int>, kept: Rows<Int>, kept_ends: Rows<Int>, cell_segments: Rows<Int>, backdrop: Rows<Int> |
| Params | background: Vec4 = [1.0, 1.0, 1.0, 1.0] |
| Outputs | result: Image |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.frame@1
Section titled “vector.frame@1”Where the look puts each pixel’s center in the drawing, and a pixel’s size there: the x of each of across’s columns, then the y of each of down’s rows, then the size; domain = count(across) + count(down) + 1. Every Kernel that asks where a pixel is reads it here, so they agree to the bit wherever each runs.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | across: Grid<Int>, down: Grid<Int>, view: Rows<Vec2>, look: Rows<Look> |
| Params | — |
| Outputs | result: Rows<Float> |
| Source | packages/vector.entpkg/kernels/fill.ent |
vector.keep@1
Section titled “vector.keep@1”Each unit’s segments, in their order, into its part of the cells’ list: the walk vector.kept@1 counts.
| Mode | scatter into input 11 with max |
| Requires | field.read, field.write |
| Inputs | total: Rows<Int>, kept: Rows<Int>, kept_ends: Rows<Int>, units: Rows<Int>, unit_ends: Rows<Int>, tile_ends: Rows<Int>, tile_shapes: Rows<Int>, tiles: Grid<Int>, shapes: Rows<Shape>, placed: Rows<Vec4>, chunks: Rows<Vec4>, slots: Rows<Int> |
| Params | — |
| Outputs | result: Rows<Int> |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.kept@1
Section titled “vector.kept@1”How many of its segments each unit gives its cell.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | total: Rows<Int>, units: Rows<Int>, unit_ends: Rows<Int>, tile_ends: Rows<Int>, tile_shapes: Rows<Int>, tiles: Grid<Int>, shapes: Rows<Shape>, placed: Rows<Vec4>, chunks: Rows<Vec4> |
| Params | — |
| Outputs | result: Rows<Int> |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.placed@1
Section titled “vector.placed@1”Each segment on the canvas, as its shape’s box is.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | segments: Rows<Vec4>, view: Rows<Vec2>, look: Rows<Look>, canvas: Grid<Int> |
| Params | — |
| Outputs | result: Rows<Vec4> |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.reach@1
Section titled “vector.reach@1”Each shape’s reach: the tiles its box, grown by two pixels, touches on the canvas.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | shapes: Rows<Shape>, view: Rows<Vec2>, look: Rows<Look>, canvas: Grid<Int> |
| Params | — |
| Outputs | result: Rows<Reach> |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.segment_chunks@1
Section titled “vector.segment_chunks@1”The box each chunk of segments spans on the canvas: least x and y, most x and y.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | placed: Rows<Vec4> |
| Params | — |
| Outputs | result: Rows<Vec4> |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.shape_chunks@1
Section titled “vector.shape_chunks@1”What each chunk of shapes reaches together.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | reach: Rows<Reach> |
| Params | — |
| Outputs | result: Rows<Reach> |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.tile_counts@1
Section titled “vector.tile_counts@1”How many shapes reach each tile.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | reach: Rows<Reach>, chunks: Rows<Reach>, tiles: Grid<Int> |
| Params | — |
| Outputs | result: Rows<Int> |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.tile_fill@1
Section titled “vector.tile_fill@1”Each tile’s shapes, in their order, into its part of the list: the walk vector.tile_counts@1 counts, stopped at its count.
| Mode | scatter into input 5 with max |
| Requires | field.read, field.write |
| Inputs | reach: Rows<Reach>, chunks: Rows<Reach>, counts: Rows<Int>, ends: Rows<Int>, tiles: Grid<Int>, slots: Rows<Int> |
| Params | — |
| Outputs | result: Rows<Int> |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.units@1
Section titled “vector.units@1”How many units each cell is: its shape’s chunks.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | total: Rows<Int>, tile_shapes: Rows<Int>, shapes: Rows<Shape> |
| Params | — |
| Outputs | result: Rows<Int> |
| Source | packages/vector.entpkg/kernels/tile.ent |
vector.whole@1
Section titled “vector.whole@1”A look at the whole drawing: its middle, fitted to the picture.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | view: Rows<Vec2> |
| Params | — |
| Outputs | result: Rows<Look> |
| Source | packages/vector.entpkg/kernels/fill.ent |
vector.zeros@1
Section titled “vector.zeros@1”A list of zeros, a row of each cell’s tile to each.
| Mode | map |
| Requires | field.read, field.write |
| Inputs | total: Rows<Int> |
| Params | — |
| Outputs | result: Rows<Int> |
| Source | packages/vector.entpkg/kernels/tile.ent |
many.replay, tiled.replay

