render

package
v0.0.0-...-5f9e87e Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

package render provides several routines for drawing simple shapes and gradients. It also makes an attempt at unifying colors with the Color type.

Index

Constants

View Source
const (
	BorderTop = 1 << iota
	BorderRight
	BorderBottom
	BorderLeft
)
View Source
const (
	GradientHorz = iota
	GradientVert
)
View Source
const (
	GradientRegular = iota
	GradientReverse
)
View Source
const (
	DiagTopLeft = iota
	DiagTopRight
	DiagBottomLeft
	DiagBottomRight
)

Variables

View Source
var NoColor = Color{}

Functions

This section is empty.

Types

type Color

type Color struct {
	// contains filtered or unexported fields
}

func NewColor

func NewColor(clr int) Color

func NewGradient

func NewGradient(start, end int) Color

func NewImageColor

func NewImageColor(clr color.Color) Color

func NewImageGradient

func NewImageGradient(startClr, endClr color.Color) Color

func (*Color) ColorSet

func (c *Color) ColorSet(clr int)

func (*Color) GradientSet

func (c *Color) GradientSet(start, end int)

func (Color) ImageColor

func (c Color) ImageColor() color.RGBA

func (Color) Int

func (c Color) Int() int

func (Color) IsGradient

func (c Color) IsGradient() bool

IsGradient returns whether the theme color is a gradient or not. Basically, a themeColor can either be a regular color (like an int) or a gradient when both 'start' and 'end' have valid color values.

func (Color) RGB

func (c Color) RGB() (r, g, b int)

func (Color) RGB8

func (c Color) RGB8() (r, g, b uint8)

func (Color) Steps

func (c Color) Steps(size int) []color.RGBA

steps returns a slice of colors corresponding to the gradient of colors from start to end. The size is determined by the 'size' parameter. The first and last colors in the slice are guaranteed to be c.start and c.end. (Unless the size is 1, in which case, the first and only color in the slice is c.start.) XXX: Optimize.

func (Color) String

func (c Color) String() string

func (Color) Uint32

func (c Color) Uint32() uint32

type Image

type Image struct {
	*xgraphics.Image
}

func New

func New(ximg *xgraphics.Image) *Image

func NewBorder

func NewBorder(X *xgbutil.XUtil, borderType int, borderColor,
	bgColor Color, width, height, gradientType, gradientDir int) *Image

func NewCorner

func NewCorner(X *xgbutil.XUtil, borderType int, borderColor,
	bgColor Color, width, height, diagonal int) *Image

func NewSolid

func NewSolid(X *xgbutil.XUtil, bgColor Color, width, height int) *Image

func (*Image) Gradient

func (img *Image) Gradient(gradientType, gradientDir int, clr Color)

func (*Image) GradientFunc

func (img *Image) GradientFunc(gradientType, gradientDir int, clr Color,
	pixel func(x, y int) bool)

XXX: Optimize.

func (*Image) ThinBorder

func (img *Image) ThinBorder(borderType int, borderColor Color)

XXX: Optimize.

Jump to

Keyboard shortcuts

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