2019-10-15 16:12:56 +02:00
|
|
|
#ifndef TEXTRENDERER_BITMAP_H
|
|
|
|
#define TEXTRENDERER_BITMAP_H
|
|
|
|
|
|
|
|
#include <string>
|
2019-10-22 15:34:51 +02:00
|
|
|
#include <vector>
|
2019-10-15 16:12:56 +02:00
|
|
|
|
2019-10-16 15:44:13 +02:00
|
|
|
/**
|
2019-10-15 16:12:56 +02:00
|
|
|
* @author: Julian Hinxlage
|
|
|
|
* @since: v0.0.0
|
|
|
|
* @brief: Used to load a Bitmap from a file.
|
|
|
|
*/
|
|
|
|
class Bitmap {
|
|
|
|
public:
|
|
|
|
Bitmap();
|
2019-10-22 15:34:51 +02:00
|
|
|
explicit Bitmap(const std::string &file);
|
2019-10-15 16:12:56 +02:00
|
|
|
|
2019-10-16 15:44:13 +02:00
|
|
|
/**
|
2019-10-15 16:12:56 +02:00
|
|
|
* @author: Julian Hinxlage
|
|
|
|
* @since: v0.0.0
|
|
|
|
* @brief: Used to load a Bitmap from a file.
|
|
|
|
*/
|
2019-11-14 13:12:48 +01:00
|
|
|
void load(const std::string &file);
|
2019-10-15 16:12:56 +02:00
|
|
|
|
2019-10-16 15:44:13 +02:00
|
|
|
/**
|
2019-10-15 16:12:56 +02:00
|
|
|
* @author: Julian Hinxlage
|
|
|
|
* @since: v0.0.0
|
|
|
|
* @return: the width of the image.
|
|
|
|
*/
|
|
|
|
int getWidth();
|
|
|
|
|
2019-10-16 15:44:13 +02:00
|
|
|
/**
|
2019-10-15 16:12:56 +02:00
|
|
|
* @author: Julian Hinxlage
|
|
|
|
* @since: v0.0.0
|
|
|
|
* @return: the height of the image
|
|
|
|
*/
|
|
|
|
int getHeight();
|
|
|
|
|
2019-10-16 15:44:13 +02:00
|
|
|
/**
|
2019-10-15 16:12:56 +02:00
|
|
|
* @author: Julian Hinxlage
|
|
|
|
* @since: v0.0.0
|
|
|
|
* @return: the pixel data as an byte array
|
|
|
|
*/
|
|
|
|
char *getData();
|
|
|
|
|
2019-10-16 15:44:13 +02:00
|
|
|
/**
|
2019-10-15 16:12:56 +02:00
|
|
|
* @author: Julian Hinxlage
|
|
|
|
* @since: v0.0.0
|
|
|
|
* @return: the number of bits uses per pixel
|
|
|
|
*/
|
|
|
|
int getBitsPerPixel();
|
|
|
|
|
2019-10-16 15:44:13 +02:00
|
|
|
/**
|
2019-10-15 16:12:56 +02:00
|
|
|
* @author: Julian Hinxlage
|
|
|
|
* @since: v0.0.0
|
|
|
|
* @return: the pixel value by coordinates, (0,0) is on the top left
|
|
|
|
*/
|
2019-10-22 15:34:51 +02:00
|
|
|
unsigned int getPixel(int x, int y);
|
2019-10-15 16:12:56 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int offset;
|
|
|
|
int bpp;
|
2019-10-22 15:34:51 +02:00
|
|
|
std::vector<char> data;
|
2019-10-15 16:12:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //TEXTRENDERER_BITMAP_H
|