Documentation
¶
Overview ¶
Package paint converts layout output into renderer-independent commands.
Index ¶
Constants ¶
const MinimumCommandAdvance float32 = 1
MinimumCommandAdvance keeps fully backtracked paint commands addressable by the virtualized viewport. Later signed offsets compensate this bookkeeping slot, so it does not move command geometry in document coordinates.
Variables ¶
This section is empty.
Functions ¶
func ApplyAnimatedLayout ¶ added in v0.16.0
func ApplyAnimatedLayout(list *DisplayList, tree *layout.Tree)
ApplyAnimatedLayout copies only frame-varying paint and composite state from a geometry-compatible tree into an existing display list. The command slice, static visual resources, and text metrics remain allocated once.
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
CommandIDs []uint64
CompositingLayers []layout.StackingContext
Layers []layout.CompositingLayer
DamageRegions []layout.Rect
// contains filtered or unexported fields
}
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.
func BuildIncremental ¶ added in v0.17.0
func BuildIncremental(previous *DisplayList, tree *layout.Tree, dirty map[dom.NodeID]bool) (*DisplayList, int)
BuildIncremental reuses immutable command values for stable, unaffected fragments while rebuilding changed commands from the current 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
Padding stylemodel.Edges
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
WritingMode stylemodel.WritingMode
Direction stylemodel.Direction
}
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
Background uint32
Opacity float32
Clip *layout.Rect
Clips []layout.ClipRegion
Transform stylemodel.Matrix
Disabled bool
Appearance stylemodel.Appearance
AccentColor uint32
Cursor stylemodel.Cursor
WritingMode stylemodel.WritingMode
Direction stylemodel.Direction
}
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
Clips []layout.ClipRegion
Transform stylemodel.Matrix
Disabled bool
Appearance stylemodel.Appearance
AccentColor uint32
Cursor stylemodel.Cursor
WritingMode stylemodel.WritingMode
Direction stylemodel.Direction
}
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
WritingMode stylemodel.WritingMode
Direction stylemodel.Direction
}
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
Clips []layout.ClipRegion
Transform stylemodel.Matrix
Appearance stylemodel.Appearance
AccentColor uint32
Cursor stylemodel.Cursor
WritingMode stylemodel.WritingMode
Direction stylemodel.Direction
}
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
Clips []layout.ClipRegion
Transform stylemodel.Matrix
Disabled bool
Appearance stylemodel.Appearance
AccentColor uint32
Cursor stylemodel.Cursor
WritingMode stylemodel.WritingMode
Direction stylemodel.Direction
}
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
WritingMode stylemodel.WritingMode
Direction stylemodel.Direction
}
DrawText paints one pre-laid-out line of text.
type TextRun ¶
type TextRun struct {
NodeID dom.NodeID
Tag string
Text string
Width float32
Atomic bool
OffsetX float32
OffsetY float32
CrossSize 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
WritingMode stylemodel.WritingMode
Direction stylemodel.Direction
TextShadows []stylemodel.Shadow
}
TextRun is one styled fragment within a DrawText line.