func (p *Painter) DrawHorizontalLine(x1, x2, y int) {
	for x := x1; x < x2; x++ {
		p.DrawRune(x, y, '─')
	}
}
DrawHorizontalLine paints a horizontal line using box characters.
package tui
import (
	"image"
)
type Surface interface {
	SetCell(x, y int, ch rune, s Style)
	SetCursor(x, y int)
	HideCursor()
	Begin()
	End()
	Size() image.Point
}
type Painter struct {
	theme *Theme
	surface Surface
	style Style
	transforms []image.Point
	mask image.Rectangle
}
func NewPainter(s Surface, p *Theme) *Painter {
	return &Painter{
		theme:   p,
		surface: s,
		style:   p.Style("normal"),
		mask: image.Rectangle{
			Min: image.ZP,
			Max: s.Size(),
		},
	}
}
func (p *Painter) Translate(x, y int) {
	p.transforms = append(p.transforms, image.Point{x, y})
}
func (p *Painter) Restore() {
	if len(p.transforms) > 0 {
		p.transforms = p.transforms[:len(p.transforms)-1]
	}
}
func (p *Painter) Begin() {
	p.surface.Begin()
}
func (p *Painter) End() {
	p.surface.End()
}
func (p *Painter) Repaint(w Widget) {
	p.mask = image.Rectangle{
		Min: image.ZP,
		Max: p.surface.Size(),
	}
	p.surface.HideCursor()
	w.Resize(p.surface.Size())
	p.Begin()
	w.Draw(p)
	p.End()
}
func (p *Painter) DrawCursor(x, y int) {
	wp := p.mapLocalToWorld(image.Point{x, y})
	p.surface.SetCursor(wp.X, wp.Y)
}
func (p *Painter) DrawRune(x, y int, r rune) {
	wp := p.mapLocalToWorld(image.Point{x, y})
	if (p.mask.Min.X <= wp.X) && (wp.X < p.mask.Max.X) && (p.mask.Min.Y <= wp.Y) && (wp.Y < p.mask.Max.Y) {
		p.surface.SetCell(wp.X, wp.Y, r, p.style)
	}
}
func (p *Painter) DrawText(x, y int, text string) {
	for _, r := range text {
		p.DrawRune(x, y, r)
		x += runeWidth(r)
	}
}