LING71671/moon-egui/src/draw does not have a README file

    DrawList

    pub struct DrawList {
    commands : Array[DrawCmd]
    } derive(Eq,
    Debug
    )

    DrawList::add_circle

    fn DrawList::add_circle(self : DrawList, center :
    Vec2
    , radius : Double, color :
    Color
    ) -> Unit

    DrawList::add_circle_stroke

    fn DrawList::add_circle_stroke(self : DrawList, center :
    Vec2
    , radius : Double, color :
    Color
    , stroke_width : Double) -> Unit

    DrawList::add_line

    DrawList::add_linear_gradient

    DrawList::add_rect

    fn DrawList::add_rect(self : DrawList, rect :
    Rect
    , color :
    Color
    , corner_radius : Double) -> Unit

    DrawList::add_rect_stroke

    fn DrawList::add_rect_stroke(self : DrawList, rect :
    Rect
    , color :
    Color
    , stroke_width : Double, corner_radius : Double) -> Unit

    DrawList::add_text

    fn DrawList::add_text(self : DrawList, pos :
    Vec2
    , text : String, font_size : Double, color :
    Color
    , font_family? : String, font_weight? : Int) -> Unit

    DrawList::append

    fn DrawList::append(self : DrawList, other : DrawList) -> Unit

    Append every command of other into this list, preserving order. Used to composite the deferred foreground layer onto the main layer.

    DrawList::clear

    fn DrawList::clear(self : DrawList) -> Unit

    DrawList::commands

    fn DrawList::commands(self : DrawList) -> Array[DrawCmd]

    DrawList::get_command

    fn DrawList::get_command(self : DrawList, index : Int) -> DrawCmd?

    DrawList::is_empty

    fn DrawList::is_empty(self : DrawList) -> Bool

    DrawList::len

    fn DrawList::len(self : DrawList) -> Int

    DrawList::new

    fn DrawList::new() -> DrawList

    DrawList::pop_clip

    fn DrawList::pop_clip(self : DrawList) -> Unit

    DrawList::push

    fn DrawList::push(self : DrawList, cmd : DrawCmd) -> Unit

    DrawList::push_clip

    fn DrawList::push_clip(self : DrawList, rect :
    Rect
    ) -> Unit

    DrawList::to_mesh

    fn DrawList::to_mesh(self : DrawList) -> Mesh

    Extension method to directly compile a DrawList into a Mesh.

    DrawList::to_svg

    fn DrawList::to_svg(self : DrawList, width : Double, height : Double, background? :
    Color
    ) -> String

    Convenience extension method on DrawList to render directly to SVG.

    Mesh

    pub struct Mesh {
    vertices : Array[Vertex]
    indices : Array[Int]
    } derive(Eq,
    Debug
    )

    Contiguous 2D triangle mesh holding vertex and index buffers for batched WebGL/GPU rendering.

    Mesh::add_quad

    fn Mesh::add_quad(self : Mesh, i0 : Int, i1 : Int, i2 : Int, i3 : Int) -> Unit

    Appends a quad defined by 4 vertex indices (i0: top-left, i1: top-right, i2: bottom-right, i3: bottom-left).

    Mesh::add_triangle

    fn Mesh::add_triangle(self : Mesh, i0 : Int, i1 : Int, i2 : Int) -> Unit

    Mesh::add_vertex

    fn Mesh::add_vertex(self : Mesh, v : Vertex) -> Int

    Mesh::clear

    fn Mesh::clear(self : Mesh) -> Unit

    Mesh::index_count

    fn Mesh::index_count(self : Mesh) -> Int

    Mesh::new

    fn Mesh::new() -> Mesh

    Mesh::tessellate_circle

    fn Mesh::tessellate_circle(self : Mesh, center :
    Vec2
    , radius : Double, color :
    Color
    , segments? : Int) -> Unit

    Tessellates a filled solid circle into a triangle fan.

    Mesh::tessellate_draw_list

    fn Mesh::tessellate_draw_list(self : Mesh, draw_list : DrawList) -> Unit

    Batch converts an entire DrawList into a single contiguous Mesh.

    NOTE on primitive support and lossy conversions:
    • Supports geometric vector primitives: Rect, RectStroke, Circle, and Line.
    • LinearGradient is approximated as a solid rectangle filled with start_col, as smooth vertex gradient interpolation requires multi-color vertex meshes or shader support.
    • Text commands are skipped here; text geometry must be generated via a font atlas texture.
    • Clip commands are not tessellated into vertex geometry; viewport clipping must be managed via hardware scissor test or geometric polygon clipping.

    Mesh::tessellate_line

    fn Mesh::tessellate_line(self : Mesh, start :
    Vec2
    , end :
    Vec2
    , color :
    Color
    , stroke_width : Double) -> Unit

    Tessellates a line segment into an oriented rectangle quad.

    Mesh::tessellate_rect

    fn Mesh::tessellate_rect(self : Mesh, rect :
    Rect
    , color :
    Color
    , corner_radius : Double) -> Unit

    Tessellates a filled solid rectangle into the mesh.

    Mesh::tessellate_rect_stroke

    fn Mesh::tessellate_rect_stroke(self : Mesh, rect :
    Rect
    , color :
    Color
    , stroke_width : Double, corner_radius? : Double) -> Unit

    Tessellates a stroked rectangle border into the mesh.

    Mesh::vertex_count

    fn Mesh::vertex_count(self : Mesh) -> Int

    Mesh::write_vertex_floats

    fn Mesh::write_vertex_floats(self : Mesh, out : Array[Double]) -> Unit

    Serializes interleaved vertex attributes (x, y, u, v, r, g, b, a) into a flat array for direct WebGL Float32Buffer upload.

    SvgExporter

    pub struct SvgExporter {
    width : Double
    height : Double
    background :
    Color
    ?
    } derive(Eq,
    Debug
    )

    SvgExporter converts a DrawList into compliant standalone SVG XML markup.

    SvgExporter::new

    fn SvgExporter::new(width : Double, height : Double, background? :
    Color
    ) -> SvgExporter

    SvgExporter::render_to_string

    fn SvgExporter::render_to_string(self : SvgExporter, draw_list : DrawList) -> String

    Renders the given DrawList as a standard standalone SVG string.

    Vertex

    pub struct Vertex {
    x : Double
    y : Double
    u : Double
    v : Double
    r : Double
    g : Double
    b : Double
    a : Double
    } derive(Default, Eq,
    Debug
    )

    A single 2D vertex holding spatial coordinates, UV texture coordinates, and normalized RGBA color channels for hardware-accelerated GPU rasterization.

    Vertex::new

    fn Vertex::new(x : Double, y : Double, u? : Double, v? : Double, color? :
    Color
    ) -> Vertex