Documentation ¶
Overview ¶
Package hdrimage provides a float32 image implementation with a built-in divisor (for easy averaging of images), which conforms to Go's image.Image interface (by conversion to sRGB)
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Image ¶
Image is a stuct which will display images via its 2D colour array, wich represents the screen
func (*Image) Add ¶
Add adds another image to this one
Example ¶
im1 := New(2, 2) for j := 0; j < im1.Height; j++ { for i := 0; i < im1.Width; i++ { im1.Pixels[i][j].SetColour(4, 5, 6) } } im2 := New(2, 2) for j := 0; j < im2.Height; j++ { for i := 0; i < im2.Width; i++ { im2.Pixels[i][j].SetColour(1, 2, 3) } } im1.Add(im2) fmt.Printf("%s\n", im1)
Output: {5, 7, 9}, {5, 7, 9} {5, 7, 9}, {5, 7, 9}
func (*Image) At ¶
At returns the sRGB Colour of the pixel at [x][y (scaled by the divisor)]
Example ¶
im := New(2, 2) for j := 0; j < im.Height; j++ { for i := 0; i < im.Width; i++ { im.Pixels[i][j].SetColour(float32(i), float32(j), 0) } } fmt.Printf("%s\n", im.At(0, 0)) fmt.Printf("%s\n", im.At(1, 0)) fmt.Printf("%s\n", im.At(0, 1)) fmt.Printf("%s\n", im.At(1, 1))
Output: [0, 0, 0] [65535, 0, 0] [0, 65535, 0] [65535, 65535, 0]
func (*Image) Bounds ¶
Bounds returns a rectangle as big as the image
Example ¶
im := New(640, 480) bounds := im.Bounds() fmt.Printf("%s\n", bounds)
Output: (0,0)-(640,480)
func (*Image) ColorModel ¶
ColorModel returns the image's color model (as used by Go's image interface)
Example ¶
im := New(640, 480) if im.ColorModel() == color.RGBAModel { fmt.Printf("Model is RGBA\n") }
Output: Model is RGBA
Click to show internal directories.
Click to hide internal directories.