![]() |
Mali OpenCL SDK v1.1.0
|
Functions for working with bitmap images. More...
#include <CL/cl.h>
#include <string>
Go to the source code of this file.
Classes | |
struct | bitmapMagic |
Bitmap magic file header numbers. More... | |
struct | bitmapHeader |
Bitmap header. More... | |
struct | bitmapInformationHeader |
Bitmap information header. More... | |
Functions | |
bool | saveToBitmap (std::string filename, int width, int height, const unsigned char *imageData) |
Save data as a bitmap image. | |
bool | loadFromBitmap (std::string filename, int *width, int *height, unsigned char **imageData) |
Load data from a bitmap image. | |
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 *rgbData, unsigned char *luminanceData, int width, int height) |
Convert 24-bits per pixel RGB data to 8-bits per pixel luminance data. | |
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. | |
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. | |
Functions for working with bitmap images.
Definition in file image.h.
bool loadFromBitmap | ( | std::string | filename, |
int * | width, | ||
int * | height, | ||
unsigned char ** | imageData | ||
) |
Load data from a bitmap image.
Load a block of 24-bits per pixel RGB image data from a bitmap image. Only supports uncompressed bitmaps.
[in] | filename | The filename of the bitmap to load. |
[out] | width | Pointer to where the width of the image (in pixels) will be stored. |
[out] | height | Pointer to where the height of the image (in pixels) will be stored. |
[out] | imageData | Pointer to the data block loaded. Data is loaded as 8-bits per component RGB and in row-major format. The size of the data block is 3 * width * height bytes. Data must be deleted by the calling application. |
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.
[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. |
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.
[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. |
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.
[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. |
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.
[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. |
bool saveToBitmap | ( | std::string | filename, |
int | width, | ||
int | height, | ||
const unsigned char * | imageData | ||
) |
Save data as a bitmap image.
Save a block of 24-bits per pixel RGB image data out as a bitmap image. Output bitmap is uncompressed.
[in] | filename | The filename to use for the bitmap (should typically have the extension .bmp). |
[in] | width | The width of the image to save (in pixels). |
[in] | height | The height of the image to save (in pixels). |
[in] | imageData | Pointer to the data block to save. Data must be 8-bits per component RGB and be in row-major format. The size of the data block must be 3 * width * height bytes. |