Sign in

    wzzc-dev/moui/render/common does not have a README file

    SvgTextPathResolver

    type SvgTextPathResolver = (SvgTextRun) -> SvgTextRunOutline?

    Host-supplied conversion from an SVG text run to glyph outline polygons.

    DrawPlan

    pub(all) struct DrawPlan {
    ops : Array[PlanOp]
    diagnostics : Array[DrawPlanDiagnostic]
    }

    A lowered draw stream: neutral ops plus diagnostics for structural problems found during lowering (unbalanced clip/transform/opacity/layer/ filter scopes). Renderers execute ops; diagnostics is an additional shared signal that does not change native execution.

    DrawPlanDiagnostic

    pub(all) struct DrawPlanDiagnostic {
    command : String
    reason : String
    } derive(Eq,
    Debug
    )

    DrawPlanDiagnostic::equal

    DrawPlanDiagnostic::not_equal

    GpuRenderWorker

    pub struct GpuRenderWorker {
    state : GpuRenderWorkerState
    surface_generation : Int
    gpu_context_generation : Int
    next_sequence : Int
    in_flight : GpuRenderWorkerFrame?
    pending : GpuRenderWorkerFrame?
    controls : Array[
    RendererControlMessage
    ]
    completions : Array[
    RenderPresentCompletion
    ]
    submitted : Int
    started : Int
    completed : Int
    dropped : Int
    replaced_pending : Int
    rejected_generation : Int
    recovery_count : Int
    recovery_failures : Int
    readback_count : Int
    resource_cache_bytes : Int64
    worker_thread_id : Int
    fail_next_recovery : Bool
    }

    GpuRenderWorker::diagnostics

    GpuRenderWorker::drain_present_completions

    GpuRenderWorker::fail_next_context_recovery

    fn GpuRenderWorker::fail_next_context_recovery(self : GpuRenderWorker) -> Unit

    Make the next context recreation fail. This is intentionally test-only in spirit but public so platform providers can model a failed native probe.

    GpuRenderWorker::gpu_context_generation

    fn GpuRenderWorker::gpu_context_generation(self : GpuRenderWorker) -> Int

    GpuRenderWorker::new

    fn GpuRenderWorker::new(surface_generation? : Int, worker_thread_id? : Int) -> GpuRenderWorker

    GpuRenderWorker::poll

    fn GpuRenderWorker::poll(self : GpuRenderWorker, completed_at_ms? : Double) -> Unit

    Process controls first, then at most one frame. Native workers call this from their event loop; fallback-safe providers call it from the host tick.

    GpuRenderWorker::state

    GpuRenderWorker::submit_control

    GpuRenderWorker::surface_generation

    fn GpuRenderWorker::surface_generation(self : GpuRenderWorker) -> Int

    GpuRenderWorkerDiagnostics

    pub(all) struct GpuRenderWorkerDiagnostics {
    state : GpuRenderWorkerState
    submitted : Int
    started : Int
    completed : Int
    dropped : Int
    replaced_pending : Int
    rejected_generation : Int
    surface_generation : Int
    gpu_context_generation : Int
    recovery_count : Int
    recovery_failures : Int
    readback_count : Int
    resource_cache_bytes : Int64
    in_flight : Bool
    pending : Bool
    control_pending : Int
    worker_thread_id : Int
    } derive(Eq, ToJson,
    Debug
    )

    GpuRenderWorkerDiagnostics::equal

    GpuRenderWorkerDiagnostics::not_equal

    GpuRenderWorkerDiagnostics::to_json

    GpuRenderWorkerFrame

    pub(all) struct GpuRenderWorkerFrame {
    token :
    FrameToken

    submitted_at_ms : Double
    input :
    RenderFrameInput

    } derive(
    Debug
    )

    GpuRenderWorkerState

    pub(all) enum GpuRenderWorkerState {
    Idle
    Lost
    Recovering
    Recovered
    FallbackToRaster
    Shutdown
    } derive(Eq, ToJson,
    Debug
    )

    Renderer-worker protocol lifecycle. This value-level model exercises queue, generation, and recovery behavior; it does not prove a platform present.

    GpuRenderWorkerState::equal

    GpuRenderWorkerState::not_equal

    GpuRenderWorkerState::to_json

    ImageCropAxis

    pub enum ImageCropAxis {
    None
    Horizontal
    Vertical
    }

    Which source axis is cropped by visible (the fraction of the source that remains visible). None means the full source is sampled.

    ImagePlacement

    pub struct ImagePlacement {
    frame :
    Rect

    crop_axis : ImageCropAxis
    visible : Double
    }

    ImageResourceLifecycle

    pub struct ImageResourceLifecycle {
    // private fields
    } derive(Eq,
    Debug
    )

    ImageResourceLifecycle::apply_load_completion

    ImageResourceLifecycle::dispose

    fn ImageResourceLifecycle::dispose(self : ImageResourceLifecycle, source : String) -> Bool

    ImageResourceLifecycle::equal

    ImageResourceLifecycle::evict_disposed

    fn ImageResourceLifecycle::evict_disposed(self : ImageResourceLifecycle) -> Int

    ImageResourceLifecycle::mark_failed

    fn ImageResourceLifecycle::mark_failed(self : ImageResourceLifecycle, source : String, diagnostic~ : String) -> Bool

    ImageResourceLifecycle::mark_loading

    fn ImageResourceLifecycle::mark_loading(self : ImageResourceLifecycle, source : String) -> Bool

    ImageResourceLifecycle::mark_ready

    fn ImageResourceLifecycle::mark_ready(self : ImageResourceLifecycle, source : String, width~ : Int, height~ : Int) -> Bool

    ImageResourceLifecycle::new

    ImageResourceLifecycle::not_equal

    PathMesh

    pub struct PathMesh {
    // private fields
    } derive(Eq, ToJson,
    Debug
    )

    PathMesh::diagnostics

    fn PathMesh::diagnostics(self : PathMesh) -> Array[String]

    PathMesh::equal

    fn PathMesh::equal(PathMesh, PathMesh) -> Bool

    PathMesh::not_equal

    fn PathMesh::not_equal(x : PathMesh, y : PathMesh) -> Bool

    PathMesh::to_json

    fn PathMesh::to_json(PathMesh) -> Json

    PathMesh::to_repr

    PathMesh::vertices

    fn PathMesh::vertices(self : PathMesh) -> Array[PathVertex]

    PathVertex

    pub struct PathVertex {
    // private fields
    } derive(Eq, ToJson,
    Debug
    )

    PathVertex::components

    fn PathVertex::components(self : PathVertex) -> Array[Double]

    PathVertex::equal

    fn PathVertex::equal(PathVertex, PathVertex) -> Bool

    PathVertex::not_equal

    fn PathVertex::not_equal(x : PathVertex, y : PathVertex) -> Bool

    PathVertex::to_json

    fn PathVertex::to_json(PathVertex) -> Json

    PlanOp

    Neutral plan operation. Mirrors @core.DrawCommand payloads exactly so every renderer can map ops to its native backend without semantic re-interpretation.

    PlanOp::equal

    fn PlanOp::equal(PlanOp, PlanOp) -> Bool

    PlanOp::not_equal

    fn PlanOp::not_equal(x : PlanOp, y : PlanOp) -> Bool

    PlanOp::to_json

    fn PlanOp::to_json(PlanOp) -> Json

    PlanOp::to_repr

    PlanScopeKind

    pub(all) enum PlanScopeKind {
    Clip
    RoundedClip
    Transform
    Opacity
    Layer
    Filter
    } derive(Eq)

    The scope kinds tracked for balance validation. Mirrors the state stacks every renderer used to maintain independently.

    PlanScopeKind::equal

    PlanScopeKind::not_equal

    fn PlanScopeKind::not_equal(x : PlanScopeKind, y : PlanScopeKind) -> Bool

    RenderFrameMailbox

    pub struct RenderFrameMailbox {
    surface_generation : Int
    next_sequence : Int
    in_flight : RenderFramePacket?
    pending : RenderFramePacket?
    submitted : Int
    started : Int
    completed : Int
    replaced_pending : Int
    rejected_generation : Int
    control_queue : Array[
    RendererControlMessage
    ]
    control_submitted : Int
    control_drained : Int
    }

    RenderFrameMailbox::begin_next

    RenderFrameMailbox::complete

    fn RenderFrameMailbox::complete(self : RenderFrameMailbox, sequence : Int) -> Bool

    RenderFrameMailbox::control_pending

    fn RenderFrameMailbox::control_pending(self : RenderFrameMailbox) -> Int

    Returns the number of pending control messages without draining.

    RenderFrameMailbox::diagnostics

    RenderFrameMailbox::drain_control

    Drains all pending control messages in submission order. The renderer thread must process every returned message; none are dropped. A Shutdown in the returned array signals loop termination.

    RenderFrameMailbox::has_control

    fn RenderFrameMailbox::has_control(self : RenderFrameMailbox) -> Bool

    Returns true when at least one control message is pending. The renderer thread should drain control messages before beginning the next frame: a Resize may invalidate the current surface, and Shutdown terminates the loop.

    RenderFrameMailbox::new

    fn RenderFrameMailbox::new(surface_generation? : Int) -> RenderFrameMailbox

    RenderFrameMailbox::replace_surface_generation

    fn RenderFrameMailbox::replace_surface_generation(self : RenderFrameMailbox, generation : Int) -> Unit

    RenderFrameMailbox::submit

    RenderFrameMailbox::submit_control

    Appends a control message to the ordered queue. Control messages are never dropped and are drained FIFO by the renderer thread before consuming the next frame. Returns the queue depth after submission so callers can detect backpressure (e.g. a host that keeps submitting resize without draining).

    RenderFrameMailboxDiagnostics

    pub(all) struct RenderFrameMailboxDiagnostics {
    submitted : Int
    started : Int
    completed : Int
    replaced_pending : Int
    rejected_generation : Int
    surface_generation : Int
    in_flight : Bool
    pending : Bool
    control_pending : Int
    control_submitted : Int
    control_drained : Int
    } derive(Eq, ToJson,
    Debug
    )

    RenderFrameMailboxDiagnostics::not_equal

    RenderFrameMailboxDiagnostics::to_json

    RenderFramePacket

    pub(all) struct RenderFramePacket {
    sequence : Int
    surface_generation : Int
    input :
    RenderFrameInput

    } derive(Eq, ToJson,
    Debug
    )

    RenderFramePacket::equal

    RenderFramePacket::new

    fn RenderFramePacket::new(sequence~ : Int, surface_generation~ : Int, input :
    RenderFrameInput
    ) -> RenderFramePacket

    RenderFramePacket::not_equal

    fn RenderFramePacket::not_equal(x : RenderFramePacket, y : RenderFramePacket) -> Bool

    RenderFramePacket::to_json

    RendererProviderRegistry

    pub struct RendererProviderRegistry {
    // private fields
    }

    ShaderRegistryResult

    pub struct ShaderRegistryResult {
    // private fields
    } derive(Eq, ToJson,
    Debug
    )

    ShaderRegistryResult::diagnostic

    fn ShaderRegistryResult::diagnostic(self : ShaderRegistryResult) -> String

    ShaderRegistryResult::equal

    ShaderRegistryResult::fallback

    ShaderRegistryResult::name

    fn ShaderRegistryResult::name(self : ShaderRegistryResult) -> String

    ShaderRegistryResult::not_equal

    ShaderRegistryResult::status

    ShaderRegistryResult::to_json

    ShaderRegistryStatus

    pub(all) enum ShaderRegistryStatus {
    ShaderReady
    ShaderFallback
    } derive(Eq, ToJson,
    Debug
    )

    ShaderRegistryStatus::equal

    ShaderRegistryStatus::not_equal

    ShaderRegistryStatus::to_json

    SvgImportResult

    pub struct SvgImportResult {
    // private fields
    } derive(Eq, ToJson,
    Debug
    )

    SvgImportResult::diagnostics

    fn SvgImportResult::diagnostics(self : SvgImportResult) -> Array[String]

    SvgImportResult::equal

    SvgImportResult::not_equal

    fn SvgImportResult::not_equal(x : SvgImportResult, y : SvgImportResult) -> Bool

    SvgImportResult::to_json

    SvgTextAnchor

    pub(all) enum SvgTextAnchor {
    Start
    Middle
    End
    } derive(Eq,
    Debug
    )

    Anchor semantics of an SVG <text> run, resolved from the text-anchor attribute (with group inheritance) at scan time.

    SvgTextAnchor::equal

    SvgTextAnchor::not_equal

    fn SvgTextAnchor::not_equal(x : SvgTextAnchor, y : SvgTextAnchor) -> Bool

    SvgTextRun

    pub(all) struct SvgTextRun {
    text : String
    font_size : Double
    x : Double
    baseline_y : Double
    anchor : SvgTextAnchor
    text_length : Double
    } derive(
    Debug
    )

    One SVG <text> run, in the node's own user space. x/baseline_y carry the anchor point and baseline; text and font_size are the element's literal content.

    SvgTextRunOutline

    pub(all) struct SvgTextRunOutline {
    width : Double
    polygons : Array[Array[(Double, Double)]]
    } derive(
    Debug
    )

    Glyph outlines for one SvgTextRun, in text-local space: the origin is the run's left edge on the baseline (Start anchoring), width is the laid-out advance, and polygons are closed contours ready for a nonzero fill. Returning None keeps the bitmap fallback for that run.

    async_image_read_i32_le

    fn async_image_read_i32_le(data : Bytes, offset : Int) -> Int

    Read a little-endian i32 from data at offset.

    Single shared implementation for decoding async image load-completion payloads; platform providers (skia/sun on macos/linux/windows) used to carry six identical private copies.

    builtin_shader_names

    fn builtin_shader_names() -> Array[String]

    clear_svg_text_path_resolver

    fn clear_svg_text_path_resolver() -> Unit

    Drop the installed resolver; SVG text falls back to the bitmap font.

    codepoint_is_cjk

    fn codepoint_is_cjk(codepoint : Int) -> Bool

    codepoint_is_cjk_ideograph

    fn codepoint_is_cjk_ideograph(codepoint : Int) -> Bool

    codepoint_is_emoji_hint

    fn codepoint_is_emoji_hint(codepoint : Int) -> Bool

    codepoint_is_hangul_cluster_codepoint

    fn codepoint_is_hangul_cluster_codepoint(codepoint : Int) -> Bool

    codepoint_is_hangul_compatibility_jamo

    fn codepoint_is_hangul_compatibility_jamo(codepoint : Int) -> Bool

    codepoint_is_hangul_l

    fn codepoint_is_hangul_l(codepoint : Int) -> Bool

    codepoint_is_hangul_lv

    fn codepoint_is_hangul_lv(codepoint : Int) -> Bool

    codepoint_is_hangul_lvt

    fn codepoint_is_hangul_lvt(codepoint : Int) -> Bool

    codepoint_is_hangul_syllable

    fn codepoint_is_hangul_syllable(codepoint : Int) -> Bool

    codepoint_is_hangul_t

    fn codepoint_is_hangul_t(codepoint : Int) -> Bool

    codepoint_is_hangul_v

    fn codepoint_is_hangul_v(codepoint : Int) -> Bool

    codepoint_is_kana

    fn codepoint_is_kana(codepoint : Int) -> Bool

    codepoint_is_rtl_script

    fn codepoint_is_rtl_script(codepoint : Int) -> Bool

    env_flag

    fn env_flag(name : String) -> Bool

    True when the environment variable name is set to exactly "1".

    Single shared implementation for platform-entrypoint feature switches; the skia providers (macos/linux/windows) used to carry three identical private copies.

    host_surface_metrics_error

    fn host_surface_metrics_error(surface :
    HostSurface
    ) -> String?

    Validate the neutral metrics every provider receives before it attempts to inspect CPU or native-surface capabilities.

    image_decoder_plugin_chain

    Build a decoder that tries every registered plugin, then any builtin decoder, and finally delegates to fallback.

    builtin carries decoders the framework ships with — formats the backend codec library cannot handle but which need no host support. They rank below app-registered plugins, so an application can still override them, and above fallback, which stays the backend's own codec.

    image_decoder_plugin_clear

    fn image_decoder_plugin_clear() -> Unit

    Drop every registered decoder, restoring the untouched fallback path.

    image_decoder_plugin_count

    fn image_decoder_plugin_count() -> Int

    Number of currently registered decoders, for diagnostics and tests.

    image_decoder_plugin_register

    fn image_decoder_plugin_register(decoder :
    RendererImageDecoder
    ) -> Unit

    Register an additional decoder. Plugins registered later are consulted after those registered earlier, and always before the fallback decoder.

    image_source_provider_clear

    fn image_source_provider_clear() -> Unit

    Drop every registered reader, restoring the untouched fallback path.

    image_source_provider_count

    fn image_source_provider_count() -> Int

    Number of currently registered readers, for diagnostics and tests.

    image_source_provider_read

    fn image_source_provider_read(source : String) -> Bytes?

    Read source through the registered providers in registration order. Returns None when no prefix matches, or when the matching reader cannot produce bytes, leaving the caller free to fall back.

    image_source_provider_register

    fn image_source_provider_register(prefix~ : String, read~ : (String) -> Bytes?) -> Unit

    Register a reader for every source beginning with prefix.

    import_svg

    fn import_svg(svg : String) -> SvgImportResult

    lower_draw_commands

    fn lower_draw_commands(commands : Array[
    DrawCommand
    ]) -> DrawPlan

    The single interpretation of a DrawCommand stream: match every variant once, maintain the transform/clip/opacity/layer/filter state stack, and emit neutral ops plus balance diagnostics.

    plan_renderer_command_fallbacks

    plan_scope_name

    fn plan_scope_name(kind : PlanScopeKind) -> String

    plan_scope_pop_command

    fn plan_scope_pop_command(kind : PlanScopeKind) -> String

    plan_scope_push_command

    fn plan_scope_push_command(kind : PlanScopeKind) -> String

    rect_shader_wgsl

    fn rect_shader_wgsl() -> String

    renderer_feature_capability_report

    Aggregate the capability declarations supplied by the providers registered in a composition root. Reports are indexed by @render.RendererProvider.id; the optional backend classification inside a capability is diagnostic metadata only and is never used to select or group providers.

    renderer_features

    Canonical feature ordering for a provider report. This is a feature catalogue, not a renderer/backend selection matrix.

    renderer_provider_capabilities

    Build one provider-owned capability row per renderer feature. Providers supply the status and note functions; render only preserves the common feature ordering and carries the provider id into the report.

    representative_fallback_codepoint

    fn representative_fallback_codepoint(text : String, skip_joiners? : Bool) -> Int

    Representative codepoint for fallback planning: the first emoji-hint codepoint (optionally skipping ZWJ/VS16 joiners), else the first non-ASCII codepoint, else the first codepoint.

    resolve_renderer

    Bind providers in registration order and return the first live session. Rejected providers are required to leave no persistent resources behind.

    resolve_shader_effect

    set_svg_text_path_resolver

    fn set_svg_text_path_resolver(resolver : (SvgTextRun) -> SvgTextRunOutline?) -> Unit

    Install (replace) the process-wide text resolver. Call once at application startup, before SVG assets decode; later calls swap the implementation for subsequent documents.

    svg_image_decoder

    The SVG decoder plugin. Sources that are not SVG produce a failed completion so a decoder chain can continue to a raster codec; SVG sources either rasterize or fail with a diagnostic the renderer can surface.

    svg_intrinsic_size

    fn svg_intrinsic_size(svg_text : String) ->
    Size
    ?

    Intrinsic size of an SVG document: viewBox when present, otherwise the root element's width/height. Returns None when neither is usable, which lets callers keep their own placeholder sizing.

    svg_intrinsic_size_from_bytes

    fn svg_intrinsic_size_from_bytes(bytes : Bytes) ->
    Size
    ?

    Intrinsic size of bytes when they hold an SVG document, otherwise None.

    Size probes that only have raw bytes — the markdown intrinsic-size reader, for example — route SVG through the same detection the image decoder uses, so a vector asset reserves the right box instead of a placeholder ratio.

    svg_raster_target_size

    fn svg_raster_target_size(intrinsic :
    Size
    ) -> (Int, Int)

    Rasterized pixel size for an intrinsic size, preserving aspect ratio while respecting the oversampling preference and the memory budget.

    svg_rasterize_rgba

    fn svg_rasterize_rgba(svg_text : String, pixel_width : Int, pixel_height : Int) -> Bytes?

    Rasterize svg_text into premultiplied RGBA8888 pixels with row_bytes = pixel_width * 4. Returns None when the document cannot be parsed or the requested size is degenerate.

    The premultiplied layout matches what raster backends expect from a decoded image payload, so the result is interchangeable with a codec's output.

    svg_source_is_svg

    fn svg_source_is_svg(source : String, bytes : Bytes) -> Bool

    True when source should be treated as SVG: either its path carries an .svg/.svgz suffix, or its leading bytes contain an <svg root tag. The suffix alone is not enough — plenty of sources are served without one — and the tag scan is bounded so a large binary payload is never walked whole.

    tessellate_path

    fn tessellate_path(spec :
    PathSpec
    ) -> PathMesh

    text_bidi_visual_clusters

    fn text_bidi_visual_clusters(text : String) -> Array[String]

    Split text into grapheme clusters via the shared @core UAX-style boundary scanner, then order runs visually (RTL runs reversed).

    text_grapheme_clusters

    fn text_grapheme_clusters(text : String) -> Array[String]

    Split text into grapheme clusters using @core.TextGraphemeBoundaries.

    text_join_clusters

    fn text_join_clusters(clusters : Array[String]) -> String

    Join grapheme clusters back into a single string.

    text_mixed_segments

    fn text_mixed_segments(text : String) -> Array[String]

    Split mixed-script text into grapheme-safe fallback segments in visual order, one segment per contiguous same-class run.

    text_segment_class

    fn text_segment_class(text : String) -> Int

    Classify a text segment for fallback planning: 1 emoji, 2 CJK, 3 Hangul, 4 RTL script, 5 combining marks, 0 other.

    text_string_arrays_equal

    fn text_string_arrays_equal(left : Array[String], right : Array[String]) -> Bool