image - ICE 0.1 API documentation

ICE 0.1 API documentation

# image

2D image struct.

struct Image;

  Image object capable of storing images in various color formats.

  this(const(uint) width, const(uint) height, const(ColorFormat) format = cast(ColorFormat)2);

    Construct an image.

    Parameters:

    const(uint) width | Width in pixels.
    const(uint) height | Height in pixels.
    const(ColorFormat) format | Color format of the image.

  const pure @property ColorFormat format();

    Get color format of the image.

  const pure @property Vector2u size();

    Get size of the image in pixels.

  const pure @property uint width();

    Get image width in pixels.

  const pure @property uint height();

    Get image height in pixels.

  const pure @property const(ubyte[]) data();

    Get direct read-only access to image data.

  pure @property ubyte[] dataUnsafe();

    Get direct read-write access to image data.

  pure void setPixelRGBA8(const uint x, const uint y, const Color color);

    Set RGBA pixel color.

    Only valid on RGBA_8 images.

    Parameters:

    uint x | X coordinate of the pixel.
    uint y | Y coordinate of the pixel.
    Color color | Color to set.

  pure void setPixelGray8(const uint x, const uint y, const ubyte color);

    Set grayscale pixel color.

    Only valid on GRAY_8 images.

    Parameters:

    uint x | X coordinate of the pixel.
    uint y | Y coordinate of the pixel.
    ubyte color | Color to set.

  const pure Color getPixel(const uint x, const uint y);

    Get RGBA color of a pixel.

    Only supported on RGBA_8 images (can be improved).

    Parameters:

    uint x | X coordinate of the pixel.
    uint y | Y coordinate of the pixel.

    Returns:
    Color of the pixel.
  pure void generateCheckers(const uint size);

    Generate a black/transparent-white/opague checker pattern.

    Parameters:

    uint size | Size of one checker square.

  pure void generateStripes(const uint distance);

    Generate a black/transparent-white/opague stripe pattern

    Parameters:

    uint distance | Distance between 1 pixel wide stripes.

  pure void gammaCorrect(const real factor);

    Gamma correct the image with specified factor.

  void flipVertical();

    Flip the image vertically.

Copyright © Ferdinand Majerech 2011. | Page generated by AutoDDoc and Ddoc.