Skip to main content

Crate render2d

Crate render2d 

Source

Re-exports§

pub use text::layout_mtext;
pub use text::layout_text;
pub use text::Attach;
pub use text::Bar as TextBar;
pub use text::FontId;
pub use text::FontMetrics;
pub use text::Fonts;
pub use text::GlyphShape;
pub use text::HAlign;
pub use text::Layout as TextLayout;
pub use text::Line as TextLine;
pub use text::MText;
pub use text::Placed as PlacedGlyph;
pub use text::Text;
pub use text::TextStyle;
pub use text::TextStyleId;
pub use text::VAlign;
pub use text::FALLBACK_MAX;
pub use text::LINE_SPACING;

Modules§

curve
dxf
fill
math
msdf
text

Structs§

Block
a block’s settings. Made with new and changed field by field (it may grow)
BlockId
a block of a Scene: entities defined once (Scene::insert_in, in the block’s units) and inserted many times (Shape::Insert); dead after remove_block
Camera
what a scene shows: the point of the drawing at the target’s middle, drawing units per pixel, and the rotation (radians, counter-clockwise: the drawing turns that way on the screen). The y axis points up on the screen
CpuInfo
what the last draw_cpu did (Scene::draw_cpu, cpu_info). It may grow
EntityId
an entity of a Scene; dead after remove, also when its place has gone to another one
FrameStats
what a finished frame measured (Scene::set_stats)
HatchLine
a family of a hatch’s parallel lines, as DXF has them: their angle (radians, counter-clockwise from the x axis), the base point one of them runs through, the spacing between neighbouring lines (at right angles to them) and how far each line’s pattern is shifted along against the one before; a dash pattern (on, off, … in drawing units; none: solid lines; an entry of 0 is a dot). Made with new and changed field by field (it may grow)
HighlightInfo
what the last prepare sent of the highlights (Scene::highlight_info). It may grow
Hit
a hit of Scene::pick
IndexInfo
what the spatial index holds (Scene::index_info). It may grow
Insert
a block placed by an entity (Shape::Insert): its base point to at, scaled (each axis; a negative scale mirrors, unequal magnitudes scale unevenly: circles become ellipses), turned by rotation (radians, counter-clockwise); an array of columns by rows copies spacing apart along the insert’s turned x and y (drawing units, not scaled: DXF’s MINSERT). Made with new and changed field by field (it may grow)
InstanceInfo
what the blocks of a scene hold and what the last prepare sent of them (Scene::instance_info). It may grow
Layer
a layer’s settings. Made with new and changed field by field (it may grow)
LayerId
a layer of a Scene; dead after remove_layer
Overlay
the overlay of a scene: made anew every frame (Scene::overlay). What it holds at prepare is drawn over the scene
OverlayInfo
what the last prepare made of the overlay (Scene::overlay_info). It may grow
Renderer
the pipelines of one colour format on one device
RendererDesc
Renderer::new. Made with new and changed field by field (it may grow)
Scene
entities, layers, styles and the camera of one scene: on a Renderer’s device, or without one (Scene::new_cpu; draw_cpu draws it through lib/gfx)
Snap
an object snap (Scene::snap): its kind, the point (drawing units, f64), how far from the pointer (px), what it lies on (an intersection: both)
SnapOptions
what Scene::snap looks for. Made with new (it may grow)
Style
a stroke’s look. Made with new and changed field by field (it may grow)
StyleId
a style of a Scene
Target
where a pick or a snap found something: the entity on a layer, its layer and, inside an insert, the way down to the entity
TextInfo
what a scene’s text holds (Scene::text_info). It may grow
UploadInfo
what prepare sent for this frame

Enums§

Cap
how an open end ends
Grip
a grip’s state: AutoCAD’s cold (unselected), hover, hot (selected)
Join
how two segments of a polyline meet on the outer side of the turn
Region
an area selection’s region in drawing units (Scene::select)
SelectMode
AutoCAD’s two area selections
Shape
what an entity is (more kinds come: text)
SnapKind
the kinds of object snap (decision 30, and AutoCAD’s insertion point)
Space
what overlay coordinates are: drawing units (through the camera at prepare) or pixels of the target (x right, y down from its top left corner)
Transparency
AutoCAD’s transparency of an entity (Style::transparency): 0 to TRANSPARENCY_MAX percent, multiplied into the colour’s alpha (alpha (100 - percent) / 100, rounded); not group compositing: overlapping entities blend each (docs/RENDER2D.md “Transparenz”)
Unit
how a style’s width is measured

Constants§

ARC_STEP
the largest angle of one piece of an arc (a record): a full circle is 16 of them. Its quad covers the piece’s ring between the chord inside and the tangent outside, so that the pixels the fragment shader looks at follow the stroke (docs/RENDER2D.md “Bögen und Kreise”)
BATCH
quads per instance of a draw (stroke.wgsl BATCH): the u16 indices of one instance reach 4 * BATCH corners
BLOCK_DEPTH
the most levels of blocks inside blocks below an insert on a layer (nested inserts; a cycle is refused anyway)
BLOCK_WGSL
BY_BLOCK_COLOR
Style::by_block: inside a block the colour, the width (and its unit), the dash pattern (entries, unit, phase) come from the insert’s style
BY_BLOCK_DASH
BY_BLOCK_WIDTH
COMMON_WGSL
the WGSL sources as the device gets them (common.wgsl in front of each, block.wgsl behind it in those that place records; stroke.wgsl with fs_full from full_body.wgsl, the same body as the function full_body, and fill.wgsl)
COUNT_SPV
CROSSING_EDGE
CROSSING_FILL
CULL_WGSL
DASH_MAX
the most entries of a dash pattern (Style::dash)
FRAMES_MAX
the most frames the CPU may record ahead of the GPU
FS_FILL_SPV
FS_FULL_SPV
FS_SPV
FS_TEXT_ALL_SPV
FS_TEXT_SPV
GRIP_COLD
GRIP_EDGE
GRIP_HOT
GRIP_HOVER
GRIP_PX
a grip’s side (px, odd: whole pixels around the pixel it sits on) and colours (cold, hover, hot, its outline)
HATCH_DASH_MAX
the most entries of a hatch family’s dash pattern (HatchLine::dash)
HATCH_MAX
the most line families of a hatch (Style::hatch)
HL_ALPHA
HL_HOVER
hovered: the colour seven eighths of the way to HL_HOVER_RGB, strokes a pixel wider on either side (over a selection)
HL_HOVER_RGB
HL_SELECTED
selected: the colour three quarters of the way to HL_SELECTED_RGB, strokes a quarter pixel wider on either side (a hairline stays on the fast way of short thin strokes)
HL_SELECTED_RGB
the highlights’ colours (sRGB, 0xRRGGBB) and the least alpha a highlighted colour gets (hl.wgsl)
HL_WGSL
(G6d) the highlight’s look (behind the stroke and text shaders: hl_wgsl) and the write pass with highlights (behind CULL_WGSL: write_hl_wgsl)
HL_WRITE_WGSL
INSTANCES_SPV
LAYERS_MAX
the most visible layers (stroke.wgsl: first_instance = layer << 16 on Voll)
MARKER_COLOR
MARKER_PX
a snap marker’s size (px), its lines’ width (px) and colour
MARKER_WIDTH
PAGE
records per page: the unit of the pool’s regions and of a workgroup of culling (common.wgsl PAGE)
SCAN_SPV
SCATTER_SPV
SCATTER_WGSL
SNAP_ALL
SNAP_CEN
SNAP_END
SNAP_INS
SNAP_INT
SNAP_MID
SNAP_NEA
SNAP_PER
SNAP_QUA
SNAP_TAN
STROKE_WGSL
TEXTC_WGSL
TEXT_BAR_BELOW
(G6c) textc.wgsl’s T_BAR: below this many pixels per em a text is drawn as bars
TEXT_FILL_FROM
(G6c) text from this many pixels per em on is drawn as fills of its outlines (the edge error of the atlas’s class L grows with the size: docs/RENDER2D.md “Entscheidungen in G6c”); textc.wgsl’s T_BAR and text.wgsl’s T_SL below it
TEXT_LARGE_FROM
(G6c) text.wgsl’s T_SL: from this many pixels per em (the map’s larger stretch) the glyphs come from class L
TEXT_WGSL
text (G6c): STROKE_WGSL with textc.wgsl and text.wgsl behind it (vs_text / fs_text for layers of text alone, vs_text_all / fs_text_all for text among anything else)
TRANSPARENCY_MAX
the most transparency AutoCAD has (percent)
VS_FILL_HL_SPV
VS_FILL_SPV
VS_FULL_HL_SPV
VS_FULL_SPV
VS_HL_SPV
(G6d) the vertex shaders of hl_wgsl and write_hl
VS_SPV
VS_TEXT_ALL_HL_SPV
VS_TEXT_ALL_SPV
VS_TEXT_HL_SPV
VS_TEXT_SPV
WINDOW_EDGE
AutoCAD’s window box (solid, blue tint) and crossing box (dashed, green tint): outline, fill
WINDOW_FILL
WRITE_HL_SPV
WRITE_SPV

Functions§

box_is_window
a selection box is a window: its second corner (pixels) lies right of its first
hl_wgsl
(G6d) the vertex shaders that read the highlight: STROKE_WGSL or TEXT_WGSL with every visible list’s word through hl_take, ink through hl_ink, half_width through hl_wider, and hl.wgsl behind them (the entries keep their names: vs, vs_full, vs_fill, vs_text, vs_text_all). The plain sources and their shaders stay as they are
write_hl_wgsl
(G6d) CULL_WGSL with the write pass that puts the highlight into the visible list (entry write_hl)