Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

misc/image.h File Reference

Image utility routines. More...

#include <glt/config.h>
#include <misc/config.h>
#include <string>
#include <iosfwd>
#include <vector>

Include dependency graph for image.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

bool isGreyscale (const std::string &rgb)
 Is an RGB buffer greyscale?

bool is256Colors (const std::string &rgb)
 Is an RGB buffer 256 colors or less?

void getChannel (std::string &dest, const std::string &src, const uint32 size, const uint32 channel)
 Extract channel from image buffer.

void rgb2Indexed (std::string &dest, const std::string &rgb)
 Convert RGB data to indexed.

void indexed2rgb (std::string &dest, const std::string &indexed)
 Convert indexed data to RGB.

void flipImage (std::string &dest, const std::string &src, const int width, const int height)
 Flip image vertically.

void mirrorImage (std::string &dest, const std::string &src, const int width, const int height)
 Mirror image horizontally.

void adjustGamma (std::string &image, const double gamma)
 Adjust image gamma.

void adjustHSV (std::string &image, const int width, const int height, const real hue, const real saturation, const real value)
 Adjust image hue, saturation and brightness.

bool stitchImages (std::string &image, const int dx, const int dy, const std::vector< std::string > &src, const int lineSize)
 Stitch tiled images.

bool decode (uint32 &width, uint32 &height, std::string &image, const std::string &data)
 Decode image data from PPM, BMP, TGA and PNG.

bool decodePPM (std::string &type, uint32 &width, uint32 &height, std::string &image, const std::string &data)
 Decode image data from PPM.

bool decodeBMP (uint32 &width, uint32 &height, std::string &image, const std::string &data)
 Decode image data from BMP.

bool decodeTGA (uint32 &width, uint32 &height, std::string &image, const std::string &data)
 Decode image data from TGA.

bool encodePPM (std::string &data, const uint32 width, const uint32 height, const std::string &image)
 Encode image data as RGB unix PPM or PGM.

bool encodeBMP (std::string &data, const uint32 width, const uint32 height, const std::string &image)
 Encode image data as RGB Windows BMP.

bool encodeTGA (std::string &data, const uint32 width, const uint32 height, const std::string &image)
 Encode image data as RGB TGA.


Detailed Description

Image utility routines.

Author:
Nigel Stewart, RMIT (nigels.com@gmail.com)
Todo:
Image test program(s)

These routines are not intended as a general-purpose image viewing, output or image-processing package. The priority here is to support image formats that are most likely to be used in the context of OpenGL texture mapping.

Here are a few notes about the relative advantages of each type of image encoding.

PPM is simple to read and write - greyscale and RGB variants are useful for input and output, commonly used on the UNIX platform. PPM's are not compressed, and are not lossy.

TGA come in uncompressed or compressed variants, and support indexed, greyscale, or 16/24/32 bit RGB and RGBA pixel data. TGA's support an alpha (transparency) channel.

BMP is the standard image format for the Windows platform. The structure of BMP files is relatively convoluted, but similar to TGA.

Definition in file image.h.


Function Documentation

void mirrorImage std::string &    dest,
const std::string &    src,
const int    width,
const int    height
 

Mirror image horizontally.

Parameters:
dest  Destination buffer
src  Source buffer
width  Width of image (pixels)
height  Height of image (pixels)

Definition at line 167 of file image.cpp.

void adjustGamma std::string &    image,
const double    gamma
 

Adjust image gamma.

Parameters:
image  Image
gamma  Gamma co-efficient

Definition at line 189 of file image.cpp.

References byte.

Referenced by GltTexture::init().

void adjustHSV std::string &    image,
const int    width,
const int    height,
const real    hue,
const real    saturation,
const real    value
 

Adjust image hue, saturation and brightness.

Parameters:
image  Image
width  Width of image (pixels)
height  Height of image (pixels)
hue  Hue adjustment
saturation  Saturation adjustment
value  Value adjustment

Definition at line 204 of file image.cpp.

References GltColor::blue(), byte, GltColor::fromHSV(), GltColor::green(), real, GltColor::red(), and GltColor::toHSV().

Referenced by GltTexture::init().

bool decode uint32   width,
uint32   height,
std::string &    image,
const std::string &    data
 

Decode image data from PPM, BMP, TGA and PNG.

Parameters:
width  Image width
height  Image height
image  Raw image data
data  Source data buffer

Definition at line 277 of file image.cpp.

References decodeBMP(), decodePPM(), decodeTGA(), and uint32.


Generated on Tue Nov 5 11:11:28 2002 for GLT by doxygen1.2.18