10#include "filesystem.hpp"
21 #define BitsType uint8_t
22 template <
class ImageBits>
49 bool LoadImage(
const std::string& Path = ImgDir);
85 unsigned i = Path.length();
87 while (Path[i] !=
'.')
89 Type.push_back(Path[i]);
99 img.read((
char*)&_d,
sizeof(rgb_t));
103 else if (Type ==
"jpeg")
107 else if(Type ==
"png")
120 return extcode =
false;
127 if (size.x == 0 && size.y == 0)
132 rgb_t *buff = (rgb_t*)malloc(
_size.x *
_size.y *
sizeof(rgb_t));
134 for (
unsigned i = 0; i <
_size.x *
_size.y; i++)
136 buff[i].red = _d[i].red;
137 buff[i].green = _d[i].green;
138 buff[i].blue = _d[i].blue;
141 _ksys_draw_bitmap(buff, coord.x, coord.y, size.x, size.y);
Класс для работы с изображениями
Definition image.hpp:38
bool LoadImage(const std::string &Path=ImgDir)
Загрузить изображение из файла
Definition image.hpp:76
void Render(point< unsigned > coord={0, 0}, point< unsigned > size={0, 0})
Вывести изображение
Definition image.hpp:125
point< unsigned > GetSize()
Получить размеры изображения
Definition image.hpp:144
Элемент интерфейса
Definition UI.hpp:26
point< unsigned > _size
Размер
Definition UI.hpp:33
bool Exist(const std::string &Path)
проверяет существует ли файл или папки
Definition filesystem.hpp:112
Основное пространство имён
Definition image.hpp:12
Битность цвета. Варианты <ImageBits>:
Definition image.hpp:29
Просто точка
Definition small.hpp:28