- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# GhulbusUtil::gbImageLoader Class Reference

Used for loading image files. More...

`#include <gbImageLoader.hpp>`

List of all members.

## Public Member Functions
| gbImageLoader (char const *fname, gbImageType *img_type)
| Constructor.
| ~gbImageLoader ()
| Destructor.
int | GetWidth () const
| Get the image's width.
int | GetHeight () const
| Get the image's height.
int | GetBpp () const
| Get the image's color depth.
bool | HasPalette () const
| Check whether the image has a palette.
void | GetImageData (unsigned char *pData) const
| Get the image data as read from the file.
void | GetImageData32 (GhulbusGraphics::GBCOLOR *pData) const
| Get the image data in unmapped GBCOLORs.
void | GetPaletteData (GhulbusGraphics::GBCOLOR *pPal) const
| Get the palette data.
void | FlipV ()
| Flips the image vertically.
## Classes
class | gbImageType
| Interface for image file loaders. More...

## Detailed Description

Used for loading image files.

## Constructor & Destructor Documentation

GhulbusUtil::gbImageLoader::gbImageLoader | ( | char const * | fname,
|  | gbImageType * | img_type |
| ) |  |  |

Constructor.

Parameters:

  `[in]` | fname | Full path to the image file that is to be loaded
  `[in,out]` | img_type | The image type loading strategy, specified as gbImageType object;

Exceptions:

  | Ghulbus::gbException | GB_FAILED usually indicates a file read error; GB_NOTIMPLEMENTED;
  | std::bad_alloc |

## Member Function Documentation

int GhulbusUtil::gbImageLoader::GetWidth | ( |  | ) | const

Get the image's width.

Returns:
  Image width in pixels

int GhulbusUtil::gbImageLoader::GetHeight | ( |  | ) | const

Get the image's height.

Returns:
  Image height in pixels

int GhulbusUtil::gbImageLoader::GetBpp | ( |  | ) | const

Get the image's color depth.

Returns:
  Bits per pixel in the image

bool GhulbusUtil::gbImageLoader::HasPalette | ( |  | ) | const

Check whether the image has a palette.

Returns:
  True if a palette is present, false otherwise

void GhulbusUtil::gbImageLoader::GetImageData | ( | unsigned char * | pData | ) | const

Get the image data as read from the file.

Parameters:

  `[out]` | pData | A field of at least size width*height*bpp

void GhulbusUtil::gbImageLoader::GetImageData32 | ( | GhulbusGraphics::GBCOLOR * | pData | ) | const

Get the image data in unmapped GBCOLORs.

Parameters:

  `[out]` | pData | A field of at least size width*height

Exceptions:

  | Ghulbus::gbException | GB_FAILED indicates an unexpected color depth

Todo:
  alpha channel

  dithering(?)

Todo:
  dithering(?)

void GhulbusUtil::gbImageLoader::GetPaletteData | ( | GhulbusGraphics::GBCOLOR * | pPal | ) | const

Get the palette data.

Parameters:

  `[out]` | pPal | A field of at least size (2^bpp)

Exceptions:

  | Ghulbus::gbException | GB_FAILED indicates that no palette data is present

The documentation for this class was generated from the following files:

- gbLib/include/gbImageLoader.hpp
- gbLib/src/gbImageLoader.cpp