Rezi
    Preparing search index...

    Interface DrawApi

    Low-level draw API for raw mode rendering.

    This interface is used via the app.draw(g => ...) escape hatch and corresponds to the DrawlistBuilder operations.

    All coordinates are in cell units (column, row). All methods validate inputs and fail deterministically on invalid parameters.

    interface DrawApi {
        addBlob(bytes: Uint8Array, stableKey?: string): number | null;
        addTextRunBlob(
            segments: readonly Readonly<
                {
                    style?: Readonly<
                        {
                            bg?: number;
                            blink?: boolean;
                            bold?: boolean;
                            dim?: boolean;
                            fg?: number;
                            inverse?: boolean;
                            italic?: boolean;
                            overline?: boolean;
                            strikethrough?: boolean;
                            underline?: boolean;
                            underlineColor?: string
                            | number;
                            underlineStyle?: UnderlineStyle;
                        },
                    >;
                    text: string;
                },
            >[],
            stableKey?: string,
        ): number | null;
        clear(): void;
        clearTo(
            cols: number,
            rows: number,
            style?: Readonly<
                {
                    bg?: number;
                    blink?: boolean;
                    bold?: boolean;
                    dim?: boolean;
                    fg?: number;
                    inverse?: boolean;
                    italic?: boolean;
                    overline?: boolean;
                    strikethrough?: boolean;
                    underline?: boolean;
                    underlineColor?: string
                    | number;
                    underlineStyle?: UnderlineStyle;
                },
            >,
        ): void;
        drawText(
            x: number,
            y: number,
            text: string,
            style?: Readonly<
                {
                    bg?: number;
                    blink?: boolean;
                    bold?: boolean;
                    dim?: boolean;
                    fg?: number;
                    inverse?: boolean;
                    italic?: boolean;
                    overline?: boolean;
                    strikethrough?: boolean;
                    underline?: boolean;
                    underlineColor?: string
                    | number;
                    underlineStyle?: UnderlineStyle;
                },
            >,
        ): void;
        drawTextRun(x: number, y: number, blobId: number): void;
        fillRect(
            x: number,
            y: number,
            w: number,
            h: number,
            style?: Readonly<
                {
                    bg?: number;
                    blink?: boolean;
                    bold?: boolean;
                    dim?: boolean;
                    fg?: number;
                    inverse?: boolean;
                    italic?: boolean;
                    overline?: boolean;
                    strikethrough?: boolean;
                    underline?: boolean;
                    underlineColor?: string
                    | number;
                    underlineStyle?: UnderlineStyle;
                },
            >,
        ): void;
        popClip(): void;
        pushClip(x: number, y: number, w: number, h: number): void;
    }
    Index

    Methods

    • Append/lookup a blob payload and return its resource id (for advanced ZRDL use).

      Parameters

      • bytes: Uint8Array
      • OptionalstableKey: string

      Returns number | null

    • Encode and append a DRAW_TEXT_RUN blob payload from segments.

      Parameters

      • segments: readonly Readonly<
            {
                style?: Readonly<
                    {
                        bg?: number;
                        blink?: boolean;
                        bold?: boolean;
                        dim?: boolean;
                        fg?: number;
                        inverse?: boolean;
                        italic?: boolean;
                        overline?: boolean;
                        strikethrough?: boolean;
                        underline?: boolean;
                        underlineColor?: string
                        | number;
                        underlineStyle?: UnderlineStyle;
                    },
                >;
                text: string;
            },
        >[]
      • OptionalstableKey: string

      Returns number | null

    • Clear and fill the viewport with a style.

      Why: ZRDL v1 CLEAR carries no style payload. This helper emits CLEAR + FILL_RECT and is the recommended way to apply a background color in raw mode.

      Parameters

      • cols: number
      • rows: number
      • Optionalstyle: Readonly<
            {
                bg?: number;
                blink?: boolean;
                bold?: boolean;
                dim?: boolean;
                fg?: number;
                inverse?: boolean;
                italic?: boolean;
                overline?: boolean;
                strikethrough?: boolean;
                underline?: boolean;
                underlineColor?: string
                | number;
                underlineStyle?: UnderlineStyle;
            },
        >

      Returns void

    • Draw text at a position with an optional style.

      Parameters

      • x: number

        Column position (int32)

      • y: number

        Row position (int32)

      • text: string

        Text to draw (UTF-8 encoded internally)

      • Optionalstyle: Readonly<
            {
                bg?: number;
                blink?: boolean;
                bold?: boolean;
                dim?: boolean;
                fg?: number;
                inverse?: boolean;
                italic?: boolean;
                overline?: boolean;
                strikethrough?: boolean;
                underline?: boolean;
                underlineColor?: string
                | number;
                underlineStyle?: UnderlineStyle;
            },
        >

        Optional text style

      Returns void

    • Draw a DRAW_TEXT_RUN command referencing a blob resource id.

      Parameters

      • x: number
      • y: number
      • blobId: number

      Returns void

    • Fill a rectangle with an optional style.

      Parameters

      • x: number

        Left column (int32)

      • y: number

        Top row (int32)

      • w: number

        Width in columns (>= 0)

      • h: number

        Height in rows (>= 0)

      • Optionalstyle: Readonly<
            {
                bg?: number;
                blink?: boolean;
                bold?: boolean;
                dim?: boolean;
                fg?: number;
                inverse?: boolean;
                italic?: boolean;
                overline?: boolean;
                strikethrough?: boolean;
                underline?: boolean;
                underlineColor?: string
                | number;
                underlineStyle?: UnderlineStyle;
            },
        >

        Optional style for the fill

      Returns void

    • Pop the most recent clip rectangle from the clip stack.

      Must be balanced with pushClip calls.

      Returns void

    • Push a clip rectangle onto the clip stack.

      All subsequent draw operations will be clipped to this rectangle (intersected with any existing clip).

      Parameters

      • x: number

        Left column (int32)

      • y: number

        Top row (int32)

      • w: number

        Width in columns (>= 0)

      • h: number

        Height in rows (>= 0)

      Returns void