paint

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package paint converts layout output into renderer-independent commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyAnimatedStyles

func ApplyAnimatedStyles(list *DisplayList, styles stylemodel.Map)

ApplyAnimatedStyles updates paint-only properties on an existing display list. Geometry and text metrics are intentionally left untouched, so a frame containing only v0.7 animatable properties does not require layout.

Types

type Command

type Command interface {
	// contains filtered or unexported methods
}

Command is implemented by every display-list operation.

type DisplayList

type DisplayList struct {
	Width             float32
	Height            float32
	ScrollWidth       float32
	ScrollHeight      float32
	Background        uint32
	Commands          []Command
	CompositingLayers []layout.StackingContext
}

DisplayList is an ordered collection of page painting commands.

func Build

func Build(tree *layout.Tree) *DisplayList

Build creates a display list from a layout tree.

type DrawBox

type DrawBox struct {
	NodeID        dom.NodeID
	X             float32
	Y             float32
	Top           float32
	Width         float32
	Height        float32
	Color         uint32
	Image         stylemodel.BackgroundImage
	Layers        []stylemodel.BackgroundLayer
	Repeat        stylemodel.BackgroundRepeat
	Position      stylemodel.BackgroundPosition
	Size          stylemodel.BackgroundSize
	Border        stylemodel.Borders
	Radius        layout.BorderRadii
	Opacity       float32
	Clip          *layout.Rect
	Clips         []layout.ClipRegion
	BoxShadows    []stylemodel.Shadow
	Outline       stylemodel.BorderSide
	OutlineOffset float32
	Transform     stylemodel.Matrix
}

DrawBox paints an element background without advancing by its painted height. Its Top value only moves the list cursor to the element's document position.

type DrawInput

type DrawInput struct {
	NodeID  dom.NodeID
	Value   string
	X       float32
	Y       float32
	Top     float32
	Width   float32
	Height  float32
	Color   uint32
	Opacity float32
	Clip    *layout.Rect
}

DrawInput は編集可能な1行テキスト入力を描画する。

type DrawText

type DrawText struct {
	NodeID dom.NodeID
	Text   string

	X        float32
	Y        float32
	Top      float32
	Width    float32
	Height   float32
	Baseline float32
	Clip     *layout.Rect
	Clips    []layout.ClipRegion

	FontSize        float32
	Bold            bool
	Color           uint32
	Background      uint32
	Decoration      stylemodel.TextDecorationLine
	DecorationColor uint32
	Opacity         float32
	Runs            []TextRun
	TextShadows     []stylemodel.Shadow
	Transform       stylemodel.Matrix
}

DrawText paints one pre-laid-out line of text.

type TextRun

type TextRun struct {
	NodeID dom.NodeID
	Tag    string
	Text   string
	Width  float32

	FontSize        float32
	Bold            bool
	Color           uint32
	Background      uint32
	Baseline        float32
	Decoration      stylemodel.TextDecorationLine
	DecorationColor uint32
	Opacity         float32
	TextShadows     []stylemodel.Shadow
}

TextRun is one styled fragment within a DrawText line.

Jump to

Keyboard shortcuts

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