Documentation ¶
Overview ¶
Painter is a simple image.RGBA utility packages which helps you with drawing on images.
Index ¶
- func Clamp(x, minVal, maxVal float64) float64
- func MixRGBA(a float64, x, y color.RGBA) color.RGBA
- func New(width, height int) *image.RGBA
- func Radians(angle float64) float64
- func Render(img *image.RGBA, renderer Renderer)
- func SaveJPEG(img image.Image, path string, o *jpeg.Options) error
- func SavePNG(img image.Image, path string) error
- func SmoothStep(edge0, edge1, x float64) float64
- type Renderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a new image.RGBA in the specified width and height.
func Render ¶
Render calls the renderer in each pixel of the image in NumCPU*2 goroutines for better performance.
func SmoothStep ¶
SmoothStep performs smooth Hermite interpolation between 0 and 1 when edge0 < x < edge1. This is useful in cases where a threshold function with a smooth transition is desired.
more: https://thebookofshaders.com/glossary/?search=smoothstep
Types ¶
type Renderer ¶
Renderer is a function which gets the image.Image and the current image.Point, and returns a image/color.RGBA for that point.
func LinearGradient ¶
LinearGradient is a Renderer which draws a linear gradient on the image from startColor to endColor with in the passed angle in degrees.