Documentation ¶
Index ¶
- Constants
- Variables
- func MaskFactor(pt image.Point, mask Mask) (factor float32)
- func ParseLength(dimen string) (px int, percent float64, err error)
- func TranslateCoords(x, y int, b image.Rectangle, h EdgeHandler) (mx, my int)
- type Channel
- type ColorValue
- type EdgeHandler
- type FloatColor
- type FloatImage
- func (p *FloatImage) At(x, y int) color.Color
- func (p *FloatImage) Bounds() image.Rectangle
- func (p *FloatImage) ColorModel() color.Model
- func (p *FloatImage) FloatAt(x, y int) FloatColor
- func (p *FloatImage) Opaque() bool
- func (p *FloatImage) PixOffset(x, y int) int
- func (p *FloatImage) Set(x, y int, c color.Color)
- func (p *FloatImage) SetColor(x, y int, c FloatColor)
- func (p *FloatImage) SubImage(r image.Rectangle) image.Image
- func (p *FloatImage) UnsafeFloatAt(x, y int) FloatColor
- func (p *FloatImage) UnsafeSetColor(x, y int, c FloatColor)
- type Graph
- type LinearRectangleIterator
- type Mask
- type Meta
- type ParallelRectangleIterator
- type Processor
- type RectangleIterator
- type Result
Constants ¶
const ( RGB Channel = iota Red = 1 << iota Green Blue Alpha )
Variables ¶
var (
ErrOutOfBounds = errors.New("out of bounds")
)
var (
FloatColorModel color.Model = color.ModelFunc(floatColorModel)
)
Functions ¶
func ParseLength ¶
ParseLength parses a string containing a number an an optional unit of length. The supported units are '%' for a percentage, 'px' or none for a pixel. It returns both pixel and percentage, as well as any possible error that might have occured during parsing.
func TranslateCoords ¶
func TranslateCoords(x, y int, b image.Rectangle, h EdgeHandler) (mx, my int)
Types ¶
type Channel ¶
type Channel int
func (Channel) MarshalJSON ¶
func (Channel) Normalize ¶
Normalize returns a normalized version a channel value. If the value is the composite RGB value, it is transformed to Red | Green | Blue. If includeAlpha is given and true, the alpha is also added to the channel
func (*Channel) UnmarshalJSON ¶
type ColorValue ¶
type ColorValue float32
func (ColorValue) Clamped ¶
func (v ColorValue) Clamped() ColorValue
Clamped returns a clamped color value, with a range 0-1
type FloatColor ¶
type FloatColor struct {
R, G, B, A ColorValue
}
func MaskColor ¶
func MaskColor(dst FloatColor, src FloatColor, c Channel, f float32, op draw.Op) FloatColor
func (FloatColor) ApproxEqual ¶
func (c FloatColor) ApproxEqual(o FloatColor) bool
ApproxEqual is used by tests to check whether a color is approximately equal to another
type FloatImage ¶
type FloatImage struct { // Pix holds the image's pixels, in R, G, B, A order and big-endian format. The pixel at // (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*4]. Pix []ColorValue // Stride is the Pix stride (in bytes) between vertically adjacent pixels. Stride int // Rect is the image's bounds. Rect image.Rectangle }
func ConvertImage ¶
func ConvertImage(img image.Image) *FloatImage
func CopyImage ¶
func CopyImage(img *FloatImage) *FloatImage
func NewFloatImage ¶
func NewFloatImage(r image.Rectangle) *FloatImage
NewFloatImage returns a new FloatImage with the given bounds.
func (*FloatImage) Bounds ¶
func (p *FloatImage) Bounds() image.Rectangle
func (*FloatImage) ColorModel ¶
func (p *FloatImage) ColorModel() color.Model
func (*FloatImage) FloatAt ¶
func (p *FloatImage) FloatAt(x, y int) FloatColor
func (*FloatImage) Opaque ¶
func (p *FloatImage) Opaque() bool
Opaque scans the entire image and reports whether it is fully opaque.
func (*FloatImage) PixOffset ¶
func (p *FloatImage) PixOffset(x, y int) int
PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).
func (*FloatImage) SetColor ¶
func (p *FloatImage) SetColor(x, y int, c FloatColor)
func (*FloatImage) SubImage ¶
func (p *FloatImage) SubImage(r image.Rectangle) image.Image
SubImage returns an image representing the portion of the image p visible through r. The returned value shares pixels with the original image.
func (*FloatImage) UnsafeFloatAt ¶
func (p *FloatImage) UnsafeFloatAt(x, y int) FloatColor
func (*FloatImage) UnsafeSetColor ¶
func (p *FloatImage) UnsafeSetColor(x, y int, c FloatColor)
type LinearRectangleIterator ¶
func (LinearRectangleIterator) Iterate ¶
func (rect LinearRectangleIterator) Iterate(mask Mask, fn func(pt image.Point, factor float32))
func (LinearRectangleIterator) VerticalIterate ¶
func (rect LinearRectangleIterator) VerticalIterate(mask Mask, fn func(pt image.Point, factor float32))
type Mask ¶
type ParallelRectangleIterator ¶
func (ParallelRectangleIterator) Iterate ¶
func (rect ParallelRectangleIterator) Iterate(mask Mask, fn func(pt image.Point, factor float32))
func (ParallelRectangleIterator) VerticalIterate ¶
func (rect ParallelRectangleIterator) VerticalIterate(mask Mask, fn func(pt image.Point, factor float32))
type RectangleIterator ¶
type RectangleIterator interface { // Iterate iterates over the image buffer, calling the fn function for each // point. The cycle order is row -> column. Implementations must ensure // that all columns of a given row are received in a single goroutine Iterate(mask Mask, fn func(pt image.Point, factor float32)) // VerticalIterate iterates over the image buffer, calling the fn function // for each point. The cycle order is column -> row. Implementations must // ensure that all rows of a given column are received in a single // goroutine VerticalIterate(mask Mask, fn func(pt image.Point, factor float32)) }
func DefaultRectangleIterator ¶
func DefaultRectangleIterator(rect image.Rectangle, forceLinear ...bool) RectangleIterator
type Result ¶
type Result struct { Id graph.Id Buffer *FloatImage NamedBuffers map[graph.ConnectorName]*FloatImage Meta Meta Error error }