paint

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 4 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 {
	Revision          uint64
	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
	BackdropColor   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
	Filters         []stylemodel.Filter
	BackdropFilters []stylemodel.Filter
	BlendMode       stylemodel.BlendMode
	Cursor          stylemodel.Cursor
	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 DrawButton added in v0.8.0

type DrawButton struct {
	NodeID      dom.NodeID
	Label       string
	X           float32
	Y           float32
	Top         float32
	Width       float32
	Height      float32
	Color       uint32
	Opacity     float32
	Clip        *layout.Rect
	Disabled    bool
	Appearance  stylemodel.Appearance
	AccentColor uint32
	Cursor      stylemodel.Cursor
}

DrawButton paints a submit button.

type DrawCheckable added in v0.8.0

type DrawCheckable struct {
	NodeID      dom.NodeID
	InputType   string
	Checked     bool
	X           float32
	Y           float32
	Top         float32
	Width       float32
	Height      float32
	Color       uint32
	Opacity     float32
	Clip        *layout.Rect
	Disabled    bool
	Appearance  stylemodel.Appearance
	AccentColor uint32
	Cursor      stylemodel.Cursor
}

DrawCheckable paints a checkbox or radio control.

type DrawImage added in v0.15.0

type DrawImage struct {
	NodeID     dom.NodeID
	URL, Alt   string
	X, Y, Top  float32
	Width      float32
	Height     float32
	ImageRect  layout.Rect
	ImageClip  layout.Rect
	Failed     bool
	Color      uint32
	Background uint32
	Opacity    float32
	Clip       *layout.Rect
	Clips      []layout.ClipRegion
	Border     stylemodel.Borders
	Radius     layout.BorderRadii
	Transform  stylemodel.Matrix
	Cursor     stylemodel.Cursor
}

DrawImage paints one decoded replaced image or its alt fallback.

type DrawInput

type DrawInput struct {
	NodeID      dom.NodeID
	Value       string
	InputType   string
	Multiline   bool
	Disabled    bool
	ReadOnly    bool
	X           float32
	Y           float32
	Top         float32
	Width       float32
	Height      float32
	Color       uint32
	Opacity     float32
	Clip        *layout.Rect
	Appearance  stylemodel.Appearance
	AccentColor uint32
	Cursor      stylemodel.Cursor
}

DrawInput は編集可能な単一行または複数行のテキスト入力を描画する。

type DrawSelect added in v0.8.0

type DrawSelect struct {
	NodeID      dom.NodeID
	Options     []forms.Option
	Selected    int
	Label       string
	X           float32
	Y           float32
	Top         float32
	Width       float32
	Height      float32
	Color       uint32
	Opacity     float32
	Clip        *layout.Rect
	Disabled    bool
	Appearance  stylemodel.Appearance
	AccentColor uint32
	Cursor      stylemodel.Cursor
}

DrawSelect paints one single-selection control.

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
	FontFamilies    []string
	FontStyle       string
	FontStretch     string
	LetterSpacing   float32
	WordSpacing     float32
	VerticalOffset  float32
	Color           uint32
	Background      uint32
	Decoration      stylemodel.TextDecorationLine
	DecorationColor uint32
	Opacity         float32
	Runs            []TextRun
	TextShadows     []stylemodel.Shadow
	Transform       stylemodel.Matrix
	Cursor          stylemodel.Cursor
}

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
	FontFamilies    []string
	FontStyle       string
	FontStretch     string
	LetterSpacing   float32
	WordSpacing     float32
	VerticalOffset  float32
	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