Import std.image.hdr
HdrImage
class
Public Class HdrImage
A picture's pixels as light, linear, each RGBA as Floats, past 1 where they're brighter than white.
Examples
Local sky = HdrImage(2, 1)
sky[0, 0] = Color(4, 4, 4, 1)
Expect(sky[0, 0].r == 4.0)
// Brighter than white is white in 8 bits.
Expect(sky.ToImage()[0, 0] == Color32.White)
Local back = Try Hdr.Decode(Hdr.Encode(sky))
Expect(back[0, 0].r == 4.0)-
An image of
widthbyheightpixels, each transparent black. Panics when either is negative, or there'd be more pixels than an HdrImage holds, 134217727, as many as stb_image reads of an HDR image. -
@PanicsAtCaller Public Static Method FromFloats(width: Int, height: Int, values: Float32[]): HdrImagestatic method #An image of
widthbyheightpixels whose Floats, 4 for each pixel, red, green, blue, and alpha, are a copy ofvalues. Panics when there aren't that many, or the size is one New panics for. -
@PanicsAtCaller Public Static Method Over(width: Int, height: Int, pixels: Buffer<Float32>): HdrImagestatic method #An image of
widthbyheightpixelswhose Floats, 4 for each pixel, red, green, blue, and alpha, are the Buffer's own, not a copy. Panics when the Buffer doesn't have that many, or the size is one New panics for. -
Its pixels' Floats, 4 for each, red, green, blue, and alpha, in rows from the top: the image's own, not a copy, which C code can read and write through its Pointer.
-
How many pixels wide it is.
-
How many pixels high it is.
-
The pixel
xfrom the left andyfrom the top. Panics when it's outside the image. -
Gives the pixel
xfrom the left andyfrom the top a color. Panics when it's outside the image. -
A copy of its pixels' Floats, 4 for each, red, green, blue, and alpha.
-
A new image of the same pixels, in a Buffer of its own.
-
An image's pixels in linear light, through sRGB's gamma, as Color32's ToColor gives them. Panics when the
imagehas more pixels than an HdrImage holds. -
Its pixels in sRGB bytes, through sRGB's gamma, as Color's ToColor32 gives them: each kept from 0 to 255, so what's brighter than white is white, and NaN taken as 0.
Report an issue with this page or with FutureBlitz on GitHub.