graphics

package
v0.0.0-...-6123f87 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusIndicatorShapeCircle = iota
	StatusIndicatorShapeSquare
)

Variables

This section is empty.

Functions

func SetMaterialSymbolsCacheDir

func SetMaterialSymbolsCacheDir(dir string)

SetMaterialSymbolsCacheDir set the cache directory for Material Symbols fonts. If not set, the system temporary directory will be used. The fonts cache file is named "materialSymbolsCache.json".

Types

type GainFader

type GainFader struct {
	Color struct {
		Background              color.Color
		Boarder                 color.Color
		ForegroundNormal        color.Color
		ForegroundOveramplified color.Color
	}
	Width                    int
	Height                   int
	RoundedCorners           bool
	BoarderWidth             int
	BoarderColorIsForeground bool
	DbMin                    float64
	DbMax                    float64
}

func NewGainFader

func NewGainFader() *GainFader

func (*GainFader) RenderHorizontal

func (g *GainFader) RenderHorizontal(db float64) image.Image

type LevelMeter

type LevelMeter struct {
	DbMin             float64
	DbGood            float64
	DbMax             float64
	PeakHold          LevelMeterPeakHold
	PeakDecayDbPerSec float64
	Image             struct {
		Width   int
		Height  int
		Padding struct {
			Top    int
			Right  int
			Bottom int
			Left   int
		}
		BackgroundColor color.Color
	}
	Cell struct {
		Length int
		Margin struct {
			X int
			Y int
		}
		Color struct {
			Normal     color.Color
			Good       color.Color
			Clipped    color.Color
			NormalOff  color.Color
			GoodOff    color.Color
			ClippedOff color.Color
		}
	}
	// contains filtered or unexported fields
}

func NewLevelMeter

func NewLevelMeter(channelCount int) *LevelMeter

func (*LevelMeter) RenderHorizontal

func (p *LevelMeter) RenderHorizontal(db []float64) (image.Image, error)

func (*LevelMeter) RenderVertical

func (p *LevelMeter) RenderVertical(db []float64) (image.Image, error)

render with RenderHorizontal and rotate 90 degrees

type LevelMeterPeakHold

type LevelMeterPeakHold int
const (
	LevelMeterPeakHoldNone LevelMeterPeakHold = iota
	LevelMeterPeakHoldShowPeak
	LevelMeterPeakHoldFillPeak
	LevelMeterPeakHoldFillPeakShowCurrent
)

type MaterialSymbolsFontParams

type MaterialSymbolsFontParams struct {
	Style string `json:"style"` // "Outlined" | "Rounded" | "Sharp"
	Opsz  string `json:"opsz"`  // "20" | "24" | "40" | "48"
	Wght  string `json:"wght"`  // "100" | "200" | "300" | "400" | "500" | "600" | "700"
	Fill  string `json:"fill"`  // "0" | "1"
	Grad  string `json:"grad"`  // "-25" | "-0" | "200"
}

func (*MaterialSymbolsFontParams) Assert

func (p *MaterialSymbolsFontParams) Assert() error

func (*MaterialSymbolsFontParams) FillEmptyWithDefault

func (p *MaterialSymbolsFontParams) FillEmptyWithDefault()

func (*MaterialSymbolsFontParams) GetIconPath

func (p *MaterialSymbolsFontParams) GetIconPath(codePoint string, size int) (*canvas.Path, error)

func (*MaterialSymbolsFontParams) RenderIcon

func (p *MaterialSymbolsFontParams) RenderIcon(codePoint string, iconSize, imgSize, offsetX, offsetY int, iconColor, borderColor, bgColor color.Color, borderWidth int) (*image.RGBA, error)

func (*MaterialSymbolsFontParams) RenderIconCanvas

func (p *MaterialSymbolsFontParams) RenderIconCanvas(codePoint string, iconSize, imgSize, offsetX, offsetY int, iconColor, borderColor, bgColor color.Color, borderWidth int) (*canvas.Canvas, error)

func (*MaterialSymbolsFontParams) RenderIconSVG

func (p *MaterialSymbolsFontParams) RenderIconSVG(codePoint string, iconSize, imgSize, offsetX, offsetY int, iconColor, borderColor, bgColor color.Color, borderWidth int) (string, error)

func (*MaterialSymbolsFontParams) RenderIconWithShadow

func (p *MaterialSymbolsFontParams) RenderIconWithShadow(codePoint string, iconSize, imgSize, offsetX, offsetY int, iconColor, bgColor, shadowColor color.Color, shadowBlurRadius int) (image.Image, error)

func (*MaterialSymbolsFontParams) String

func (p *MaterialSymbolsFontParams) String() string

type StatusIndicator

type StatusIndicator struct {
	Width, Height int
	Rows          []StatusIndicatorRowStyle
}

func (*StatusIndicator) Render

func (s *StatusIndicator) Render(flags [][]bool) (image.Image, error)

type StatusIndicatorRowStyle

type StatusIndicatorRowStyle struct {
	ColorsTrue       []color.Color
	ColorsFalse      []color.Color
	Shape            StatusIndicatorShape
	ItemMargin       float64
	ItemSize         float64
	ItemCornerRadius float64
	MarginTop        float64
	MarginLeft       float64 // only used if Rtl is false
	MarginRight      float64 // only used if Rtl is true
	Rtl              bool
}

type StatusIndicatorShape

type StatusIndicatorShape int

Jump to

Keyboard shortcuts

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