Documentation ¶
Overview ¶
Package colorf provides a floating-point color implementation.
Index ¶
- Variables
- func EV(exp float64) float64
- func LinearToSRGB(c float64) float64
- func SRGBSlope(c float64) float64
- func SRGBToLinear(s float64) float64
- type Color
- func (c Color) Add(b Color) Color
- func (c Color) At(_ geom.Vec) Color
- func (c Color) AtUV(u, v float64) Color
- func (c Color) EV(ev float64) Color
- func (c Color) Gray() float64
- func (a Color) IsNaN() bool
- func (c Color) MAdd(a float64, b Color) Color
- func (c *Color) Max() float64
- func (c Color) Mul(a float64) Color
- func (c Color) Mul3(b Color) Color
- func (c Color) RGBA() (r, g, b, a uint32)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func LinearToSRGB ¶
linear to sRGB conversion https://en.wikipedia.org/wiki/SRGB
func SRGBToLinear ¶
sRGB to linear conversion https://en.wikipedia.org/wiki/SRGB TODO: Look-up table for bytes
Types ¶
type Color ¶
type Color struct {
R, G, B float64
}
Color represents either a reflectivity or intensity.
In case of reflectivity, values should be [0..1], 1 meaning 100% reflectivity for that color.
The color space is linear.
func (Color) EV ¶
Multiplies the color by 2^ev. E.g.:
RED.EV(-1) // 50% reflective red, i.e. dark red.
func (Color) Mul ¶
Multiplies the color, making it darker (s<1) or brighter (s>1). E.g.:
RED.Mul(0.5) // 50% reflective red, i.e. dark red.
Click to show internal directories.
Click to hide internal directories.