Skip to content
FutureBlitz

    Install

    Import std.image.hdr

    HdrImage

    std.image.hdr

    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)

    std/image/hdr.fb, line 29

    • @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.

    Report an issue with this page or with FutureBlitz on GitHub.