engine

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package engine implements the bounded manager-side HTML rendering profile. It never imports MCU, panel, transport or credential packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MonochromeMode added in v0.1.1

type MonochromeMode uint8

MonochromeMode controls conversion after all color/alpha composition.

const (
	// Threshold preserves solid text and UI fills without a halftone grid.
	Threshold MonochromeMode = iota
	// OrderedDither approximates gray tones with a display-anchored 4x4 pattern.
	OrderedDither
)

type Options

type Options struct {
	// Reserved is a white, protected metadata rectangle in logical pixels.
	// The zero rectangle disables reservation; it does not reduce the viewport.
	Reserved image.Rectangle
}

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer owns its embedded fonts and serializes their mutable shaping caches. Documents cannot read host fonts/files or issue network/subprocess requests.

func New

func New() (*Renderer, error)

func (*Renderer) Render

func (r *Renderer) Render(ctx context.Context, size display.Size, html []byte) (display.Frame, error)

Render satisfies the manager's ScreenRenderer contract without depending on manager, transports or a particular panel. Logical size precedes rasterization.

func (*Renderer) RenderDetailed

func (r *Renderer) RenderDetailed(ctx context.Context, size display.Size, html []byte) (display.Frame, []renderdiag.Warning, error)

RenderDetailed adds source-free warnings without coupling the engine to a manager implementation. Returned warnings and frame belong to the caller.

func (*Renderer) RenderRGBA

func (r *Renderer) RenderRGBA(ctx context.Context, size display.Size, source []byte) (Result, error)

RenderRGBA returns independently owned pixels, composited before any device quantization. Admission is context-aware; callers cannot race the font cache.

func (*Renderer) RenderRGBAWithOptions

func (r *Renderer) RenderRGBAWithOptions(ctx context.Context, size display.Size, source []byte, options Options) (Result, error)

RenderRGBAWithOptions reserves only explicitly configured device metadata pixels. CSS viewport dimensions remain the complete logical display size.

func (*Renderer) RenderReserved

func (r *Renderer) RenderReserved(ctx context.Context, size display.Size, html []byte, area image.Rectangle) (display.Frame, []renderdiag.Warning, error)

RenderReserved clears only the protected metadata corner before quantization and preserves composition warnings. The manager paints its timestamp later.

func (*Renderer) ValidateDocument

func (r *Renderer) ValidateDocument(ctx context.Context, source []byte) error

ValidateDocument checks the complete scene and embedded asset bounds before an atomic authoring edit commits. It does not paint or touch the font cache; layout failures still report asynchronously through render diagnostics.

type Result

type Result struct {
	Image    *image.RGBA
	Warnings []renderdiag.Warning
}

func (Result) Frame

func (r Result) Frame(ctx context.Context) (display.Frame, error)

Frame quantizes the completed preview into independently owned canonical packed pixels. It never scales, rotates or mutates the preview.

func (Result) FrameWithMode added in v0.1.1

func (r Result) FrameWithMode(ctx context.Context, mode MonochromeMode) (display.Frame, error)

FrameWithMode lets image-oriented callers explicitly select halftoning. Both modes are pixel-local: an edit cannot propagate error into other rows.

Directories

Path Synopsis
Package dom owns the engine's single validated HTML5 tree.
Package dom owns the engine's single validated HTML5 tree.
Package geometry computes bounded CSS boxes without fonts, images or hardware.
Package geometry computes bounded CSS boxes without fonts, images or hardware.
Package style parses the engine's bounded inline CSS profile into typed values.
Package style parses the engine's bounded inline CSS profile into typed values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL