g

package
v0.0.0-...-b9826c4 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Unlicense Imports: 11 Imported by: 0

Documentation

Overview

Package g provides graphics helpers.

Index

Constants

This section is empty.

Variables

View Source
var (
	White  = color.NRGBA{0xFF, 0xFF, 0xFF, 0xFF}
	Black  = color.NRGBA{0x00, 0x00, 0x00, 0xFF}
	Red    = color.NRGBA{0xFF, 0x00, 0x00, 0xFF}
	Green  = color.NRGBA{0x00, 0xFF, 0x00, 0xFF}
	Blue   = color.NRGBA{0x00, 0x00, 0xFF, 0xFF}
	Yellow = color.NRGBA{0xFF, 0xFF, 0x00, 0xFF}

	Transparent = color.NRGBA{0xFF, 0xFF, 0xFF, 0x00}
)

Functions

func Abs

func Abs(v float32) float32

func Circle

func Circle(ops *op.Ops, at f32.Point, r float32) clip.PathSpec

func Clamp

func Clamp(p, min, max float32) float32

func Cos

func Cos(v float32) float32

func Dot

func Dot(a, b f32.Point) float32

func FillCircle

func FillCircle(ops *op.Ops, at f32.Point, r float32) clip.Op

func FillRect

func FillRect(ops *op.Ops, x, y, w, h float32) clip.Op

func FillText

func FillText(th *material.Theme, gtx layout.Context, s string, at f32.Point)

func HSL

func HSL(h, s, l float32) color.NRGBA

HSL returns color based on HSL in range 0..1

func HSLA

func HSLA(h, s, l, a float32) color.NRGBA

HSLA returns color based on HSLA in range 0..1

func HexRGB

func HexRGB(v uint32) color.NRGBA

HexRGB takes number of 0xRRGGBB and converts to color.NRGBA.

func HexRGB1

func HexRGB1(v uint16) color.NRGBA

HexRGB1 takes number of 0xRGB and converts to color.NRGBA.

func HexRGBA

func HexRGBA(v uint32) color.NRGBA

HexRGBA takes number of 0xRRGGBBAA and converts to color.NRGBA.

func HexRGBA1

func HexRGBA1(v uint16) color.NRGBA

HexRGBA1 takes number of 0xRGBA and converts to color.NRGBA.

func Len

func Len(p f32.Point) float32

func Lerp

func Lerp(p, min, max float32) float32

func LerpClamp

func LerpClamp(p, min, max float32) float32

func Map

func Map(v, min, max, toMin, toMax float32) float32

func Mod

func Mod(x, y float32) float32

func Normal

func Normal(a f32.Point) f32.Point

func PtLerp

func PtLerp(p float32, a, b f32.Point) f32.Point

func PtLerpClamp

func PtLerpClamp(p float32, a, b f32.Point) f32.Point

func RGB

func RGB(r, g, b float32) color.NRGBA

RGB is a helper for creating color.NRGBA.

func RGBA

func RGBA(r, g, b, a float32) color.NRGBA

RGBA is a helper for creating color.NRGBA.

func RGBAFloat

func RGBAFloat(c color.NRGBA) (r, g, b, a float32)

RGBAFloat returns RGBA scaled to 0..1

func RGBALerp

func RGBALerp(a, b color.NRGBA, p float32) color.NRGBA

Lerp linearly interpolates each RGBA component separately

func Rand

func Rand() float32

func RandPt

func RandPt() f32.Point

func RandRange

func RandRange(min, max float32) float32

func RandUnitPt

func RandUnitPt() f32.Point

func Rect

func Rect(ops *op.Ops, x, y, w, h float32) clip.PathSpec

func Round

func Round(v float32) float32

func Sat8

func Sat8(v float32) uint8

Sat8 converts 0..1 float to 0..255 uint8

func Sign

func Sign(v float32) float32

func Sin

func Sin(v float32) float32

func Sincos

func Sincos(v float32) (sn, cs float32)

func Sqrt

func Sqrt(v float32) float32

func Unit

func Unit(p f32.Point) f32.Point

Types

type Log

type Log struct {
	Theme *material.Theme
	Size  unit.Sp
	Lines []string
}

func (*Log) Layout

func (log *Log) Layout(gtx layout.Context) layout.Dimensions

func (*Log) Print

func (log *Log) Print(a ...any)

func (*Log) Printf

func (log *Log) Printf(format string, a ...any)

type Offset

type Offset struct {
	Pos f32.Point
}

func (Offset) Layout

func (at Offset) Layout(gtx layout.Context, w layout.Widget) layout.Dimensions

Jump to

Keyboard shortcuts

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