Documentation ¶
Index ¶
- Variables
- func ImgColorFilter(img *image.NRGBA, from, to color.NRGBA) *image.NRGBA
- func NewPrideImage(p color.Palette, bounds image.Rectangle) image.Image
- func ReadImage(path string) (*image.NRGBA, error)
- func RenderText(text string, scale float64, texture, bgTex image.Image) *image.NRGBA
- func RotateImage90(img *image.NRGBA) (rotated *image.NRGBA)
- func ScaleImage(img image.Image, factorX, factorY float64, highQuality bool) (scaled *image.NRGBA)
- func WriteImage(path string, img image.Image) error
- type DynamicPattern
- type Pattern
- type StripePattern
Constants ¶
This section is empty.
Variables ¶
View Source
var DynPatterns = map[string]image.Image{ "rbow": &DynamicPattern{ Color: func(x, y int, p *DynamicPattern) (float64, float64, float64) { xx := float64(x) / 26.0 yy := float64(y) / 13.0 r := 0.5 + 0.5*math.Cos(xx+p.Phase) g := 0.5 + 0.5*math.Sin(yy+p.Phase) b := 0.5 + 0.5*math.Sin(xx+p.Phase)*math.Cos(yy+p.Phase) return r, g, b }, }, "pastel": &DynamicPattern{ Brightness: 0.5, ColFactor: 0.5, Freq: 5.0, Color: func(x, y int, p *DynamicPattern) (float64, float64, float64) { offset := 0.0 v := math.Atan2(float64(x)-offset, float64(y)-offset) + p.Phase r := 0.5 + 0.5*math.Sin(v*p.Freq) g := 0.5 + 0.5*math.Cos(v*p.Freq) b := 0.5 + 0.5*math.Sin(v*p.Freq+6.28318/p.Luma) return r, g, b }, }, }
View Source
var PrideFlags = map[string]color.Palette{ "lgbti": color.Palette{ color.NRGBA{0xe4, 0x03, 0x03, 0xff}, color.NRGBA{0xff, 0x8c, 0x00, 0xff}, color.NRGBA{0xff, 0xed, 0x00, 0xff}, color.NRGBA{0x00, 0x80, 0x26, 0xff}, color.NRGBA{0x00, 0x4d, 0xff, 0xff}, color.NRGBA{0x75, 0x07, 0x87, 0xff}, }, "nonbinary": color.Palette{ color.NRGBA{0x9c, 0x5c, 0xd4, 0xff}, color.NRGBA{0xfc, 0xfc, 0xfc, 0xff}, color.NRGBA{0xfc, 0xf4, 0x34, 0xff}, color.NRGBA{0x2c, 0x2c, 0x2c, 0xff}, }, "trans": color.Palette{ color.NRGBA{0x5b, 0xde, 0xfa, 0xff}, color.NRGBA{0xf5, 0xa9, 0xb8, 0xff}, color.NRGBA{0xff, 0xff, 0xff, 0xff}, color.NRGBA{0xf5, 0xa9, 0xb8, 0xff}, color.NRGBA{0x5b, 0xde, 0xfa, 0xff}, }, }
Functions ¶
func ImgColorFilter ¶
ImgColorFilter replaces `from` with `to` in `img`, and sets all other pixels to color.Transparent
func RenderText ¶
func ScaleImage ¶
Types ¶
type DynamicPattern ¶
type DynamicPattern struct { Pattern Color func(x, y int, p *DynamicPattern) (float64, float64, float64) // should return rgb in [0,1] range Luma float64 // color parameter Freq float64 // frequency parameter Phase float64 // phase parameter Brightness float64 // additive base brightness ColFactor float64 // Pattern intensity }
Click to show internal directories.
Click to hide internal directories.