Documentation
¶
Overview ¶
Package raster is the shared pixel-buffer substrate of go-gfx: a densely packed 8-bit RGBA image the higher layers (resample, color, and the fleet's image-processing and rendering libraries) read and write.
Image.Pix is row-major, four bytes (R, G, B, A) per pixel, with NO row padding — stride is always 4*W. The bytes are STRAIGHT (non-premultiplied): a pixel's colour is stored as-is, independent of its alpha, which is the representation image processing wants. This differs from the standard library's image.RGBA, whose bytes are premultiplied; FromImage and ToRGBA convert across that boundary correctly rather than copying bytes blindly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Image ¶
Image is a densely packed, straight-alpha 8-bit RGBA pixel buffer of W by H pixels. Pix has length 4*W*H.
func FromImage ¶
FromImage converts any image.Image into a straight-alpha Image. An *image.NRGBA (already straight) is copied directly; anything else is converted pixel by pixel through the non-premultiplied colour model, so a premultiplied *image.RGBA source is un-premultiplied rather than mis-read.
func New ¶
New returns a zeroed Image of w by h pixels (fully transparent black). w and h must be non-negative.