Skip to content
FutureBlitz

    Install

    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.

    std/image/hdr.fb, line 14

    • @PanicsAtCaller Public New(width: Int, height: Int) constructor #

      An image of width by height pixels, 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[]): HdrImage static method #

      An image of width by height pixels whose Floats, 4 for each pixel, red, green, blue, and alpha, are a copy of values. 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>): HdrImage static method #

      An image of width by height pixels whose 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.

    • Public Property Pixels: Buffer<Float32> property #

      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.

    • Public Property Width: Int property #

      How many pixels wide it is.

    • Public Property Height: Int property #

      How many pixels high it is.

    • @PanicsAtCaller Operator [](x: Int, y: Int): Color operator #

      The pixel x from the left and y from the top. Panics when it's outside the image.

    • @PanicsAtCaller Operator []=(x: Int, y: Int, color: Color) operator #

      Gives the pixel x from the left and y from the top a color. Panics when it's outside the image.

    • Public Method ToFloats(): Float32[] method #

      A copy of its pixels' Floats, 4 for each, red, green, blue, and alpha.

    • Public Method Clone(): HdrImage method #

      A new image of the same pixels, in a Buffer of its own.

    • @PanicsAtCaller Public Static Method FromImage(image: Image): HdrImage static method #

      An image's pixels in linear light, through sRGB's gamma, as Color32's ToColor gives them. Panics when the image has more pixels than an HdrImage holds.

    • Public Method ToImage(): Image method #

      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.

    std/image/hdr.fb, line 171

    • @PanicsAtCaller Public Static Method Decode(data: UInt8[], limit: Int = MOST_PIXELS): HdrImage Throws IOError static method #

      The image in data, Radiance's RGBE, each pixel opaque. Throws an IOError of INVALID_DATA when the data isn't an HDR image or is broken, and OTHER when the image has more pixels than limit. Panics when the limit is negative.

    • @PanicsAtCaller Public Static Method Encode(image: HdrImage): UInt8[] static method #

      The image in 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.