paint

– import “gomatcha.io/matcha/paint”

Package paint implements view display properties.

func (v *View) Build(ctx view.Context) view.Model {
    return view.Model{
        Painter: &paint.Style{
            BackgroundColor: colornames.Green,
            CornerRadius: 3,
        },
    }
}

type AnimatedStyle

type AnimatedStyle struct {
	Style           Style
	Transparency    comm.Float64Notifier
	BackgroundColor comm.ColorNotifier
	BorderColor     comm.ColorNotifier
	BorderWidth     comm.Float64Notifier
	CornerRadius    comm.Float64Notifier
	ShadowRadius    comm.Float64Notifier
	ShadowOffset    layout.PointNotifier
	ShadowColor     comm.ColorNotifier
}

AnimatedStyle is the animated version of Style.

func (*AnimatedStyle) Notify

func (as *AnimatedStyle) Notify(f func()) comm.Id

Notify implements the Painter interface.

func (*AnimatedStyle) PaintStyle

func (as *AnimatedStyle) PaintStyle() Style

PaintStyle implements the Painter interface.

func (*AnimatedStyle) Unnotify

func (as *AnimatedStyle) Unnotify(id comm.Id)

Unnotify implements the Painter interface.

type Painter

type Painter interface {
	PaintStyle() Style
	comm.Notifier
}

Painter is the interface that describes how a view should be drawn on screen.

type Style

type Style struct {
	Transparency    float64
	BackgroundColor color.Color
	BorderColor     color.Color
	BorderWidth     float64
	// CornerRadius is only supported for imageview on android.
	CornerRadius float64
	// Shadows are not supported on android. And do not work with corner radius on iOS (https://stackoverflow.com/q/11437750).
	ShadowRadius float64
	ShadowOffset layout.Point
	ShadowColor  color.Color
}

Style is a list of display properties of that views can set.

func (*Style) MarshalProtobuf

func (s *Style) MarshalProtobuf() *paint.Style

func (*Style) Notify

func (s *Style) Notify(func()) comm.Id

Notify implements the Painter interface. This is a no-op.

func (*Style) PaintStyle

func (s *Style) PaintStyle() Style

PaintStyle implements the Painter interface.

func (*Style) String

func (s *Style) String() string

func (*Style) Unnotify

func (s *Style) Unnotify(id comm.Id)

Unnotify implements the Painter interface. This is a no-op.