#include "image.h"
#include <fstream>
#include <iostream>
Go to the source code of this file.
|
bool | saveToBitmap (string filename, int width, int height, const unsigned char *imageData) |
|
bool | loadFromBitmap (const string filename, int *const width, int *const height, unsigned char **imageData) |
|
bool | luminanceToRGB (const unsigned char *luminanceData, unsigned char *rgbData, int width, int height) |
| Convert 8-bits per pixel luminance data to 24-bits per pixel RGB data.
|
|
bool | RGBToLuminance (const unsigned char *const rgbData, unsigned char *const luminanceData, int width, int height) |
| Convert 24-bits per pixel RGB data to 8-bits per pixel luminance data.
|
|
bool | RGBToRGBA (const unsigned char *const rgbData, unsigned char *const rgbaData, int width, int height) |
| Convert 24-bits per pixel RGB data to 32-bits per pixel RGBA data.
|
|
bool | RGBAToRGB (const unsigned char *const rgbaData, unsigned char *const rgbData, int width, int height) |
| Convert 32-bits per pixel RGBA data to 24-bits per pixel RGB data.
|
|
bool loadFromBitmap |
( |
const string |
filename, |
|
|
int *const |
width, |
|
|
int *const |
height, |
|
|
unsigned char ** |
imageData |
|
) |
| |
bool luminanceToRGB |
( |
const unsigned char * |
luminanceData, |
|
|
unsigned char * |
rgbData, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
Convert 8-bits per pixel luminance data to 24-bits per pixel RGB data.
Each RGB pixel is created using the luminance value for each component. For example, a pixel with luminance of 125 will convert into an RGB pixel with values R = 125, G = 125, and B = 125.
- Parameters
-
[in] | luminanceData | Pointer to a block of 8-bits per pixel luminance data. Must be width * height bytes in size. |
[out] | rgbData | Pointer to a data block containing the 24-bits per pixel RGB data. The data block must be initialised with a size of 3 * width * height bytes. |
[in] | width | The width of the image. |
[in] | height | The height of the image. |
- Returns
- False if an error occurred, true otherwise.
Definition at line 243 of file image.cpp.
bool RGBAToRGB |
( |
const unsigned char * |
rgbaData, |
|
|
unsigned char * |
rgbData, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
Convert 32-bits per pixel RGBA data to 24-bits per pixel RGB data.
The alpha values are discarded.
- Parameters
-
[in] | rgbaData | Pointer to a block of 32-bits per pixel RGBA data. Must be 4 * width * height bytes in size. |
[out] | rgbData | Pointer to a data block containing the 24-bits per pixel RGB data. The data block must be initialised with a size of 3 * width * height bytes. |
[in] | width | The width of the image. |
[in] | height | The height of the image. |
- Returns
- False if an error occurred, true otherwise.
Definition at line 318 of file image.cpp.
bool RGBToLuminance |
( |
const unsigned char * |
rgbData, |
|
|
unsigned char * |
luminanceData, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
Convert 24-bits per pixel RGB data to 8-bits per pixel luminance data.
Each luminance pixel is created using a weighted sum of the RGB values. The weightings are 0.2126R, 0.7152G, and 0.0722B.
- Parameters
-
[in] | rgbData | Pointer to a block of 24-bits per pixel RGB data. Must be 3 * width * height bytes in size. |
[out] | luminanceData | Pointer to a data block containing the 8-bits per pixel luminanceData data. The data block must be initialised with a size of width * height bytes. |
[in] | width | The width of the image. |
[in] | height | The height of the image. |
- Returns
- False if an error occurred, true otherwise.
Definition at line 267 of file image.cpp.
bool RGBToRGBA |
( |
const unsigned char * |
rgbData, |
|
|
unsigned char * |
rgbaData, |
|
|
int |
width, |
|
|
int |
height |
|
) |
| |
Convert 24-bits per pixel RGB data to 32-bits per pixel RGBA data.
The alpha values are all set to 255.
- Parameters
-
[in] | rgbData | Pointer to a block of 24-bits per pixel RGB data. Must be 3 * width * height bytes in size. |
[out] | rgbaData | Pointer to a data block containing the 32-bits per pixel RGBA data. The data block must be initialised with a size of 4 * width * height bytes. |
[in] | width | The width of the image. |
[in] | height | The height of the image. |
- Returns
- False if an error occurred, true otherwise.
Definition at line 291 of file image.cpp.
bool saveToBitmap |
( |
string |
filename, |
|
|
int |
width, |
|
|
int |
height, |
|
|
const unsigned char * |
imageData |
|
) |
| |