Import std.image.hdr
std.image.hdr
HDR: an HdrImage's pixels are light, linear, each RGBA as Floats, past 1 where they're brighter
than white, in a Buffer<Float32>, which Hdr reads from Radiance's RGBE files, as stb_image
reads them, and writes to them, run-length encoded, as stb_image_write does. RGBE has no alpha:
what Hdr.Decode gives is opaque, and Encode leaves the alpha out.
std/image/hdr.fb
Types
HdrImage
class
Public Class HdrImage
A picture's pixels as light, linear, each RGBA as Floats, past 1 where they're brighter than white.
-
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.
Hdr
struct
Public Struct Hdr
What reads and writes Radiance's RGBE files, in its Static Methods.
-
@PanicsAtCaller Public Static Method Decode(data: UInt8[], limit: Int = MOST_PIXELS): HdrImage Throws IOErrorstatic method #The image in
data, Radiance's RGBE, each pixel opaque. Throws an IOError of INVALID_DATA when thedataisn't an HDR image or is broken, and OTHER when the image has more pixels thanlimit. Panics when thelimitis negative. -
The
imagein Radiance's RGBE, run-length encoded, without its alpha: a channel that's negative or NaN is 0, and one past the most RGBE holds, 255 times 2^119, about 1.69e38, is that most. Panics when it has no pixels.
Report an issue with this page or with FutureBlitz on GitHub.