Text-Renderer/src/Bitmap.hpp

69 lines
1.3 KiB
C++
Raw Permalink Normal View History

2020-01-07 13:23:25 +01:00
#ifndef TEXTRENDERER_BITMAP_HPP
#define TEXTRENDERER_BITMAP_HPP
#include <string>
2019-10-22 15:34:51 +02:00
#include <vector>
/**
* @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);
/**
* @author: Julian Hinxlage
* @since: v0.0.0
* @brief: Used to load a Bitmap from a file.
*/
void load(const std::string &file);
/**
* @author: Julian Hinxlage
* @since: v0.0.0
* @return: the width of the image.
*/
int getWidth();
/**
* @author: Julian Hinxlage
* @since: v0.0.0
* @return: the height of the image
*/
int getHeight();
/**
* @author: Julian Hinxlage
* @since: v0.0.0
* @return: the pixel data as an byte array
*/
char *getData();
/**
* @author: Julian Hinxlage
* @since: v0.0.0
* @return: the number of bits uses per pixel
*/
int getBitsPerPixel();
/**
* @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);
private:
int width;
int height;
int offset;
int bpp;
2019-10-22 15:34:51 +02:00
std::vector<char> data;
};
2020-01-07 13:23:25 +01:00
#endif //TEXTRENDERER_BITMAP_HPP