15#include "filesystem.hpp"
27 _ksys_draw_line(a.x, a.y, b.x, b.y, color);
33 inline void DrawPixel(point position, ksys_color_t color)
35 _ksys_draw_pixel(position.x, position.y, color);
43 void DrawCircle(point coord,
unsigned Radius,
unsigned detalization = 36, ksys_color_t color =
OS::sys_color_table.work_graph)
48 for (
unsigned angle = 1; angle <= detalization * 10; angle += 36 / detalization)
50 buff = {coord.x + b, coord.y + c};
51 b = Radius * cos(angle);
52 c = sqrt((Radius*Radius) - (b*b));
53 point n = {coord.x + b, coord.y + c};
62 void DrawRectangleFill(point position, point size, ksys_color_t color =
OS::sys_color_table.work_graph)
64 position.x *= AAANUMBER;
65 position.y *= AAANUMBER;
68 "int $0x40" ::
"a"(13),
"b"(position.x + size.x),
"c"(position.y + size.y),
"d"(color));
75 void DrawCircleFill(point coord,
unsigned Radius, ksys_color_t color =
OS::sys_color_table.work_graph)
77 DrawCircle(coord, Radius, color);
78 unsigned b = Radius * cos(90+45);
79 unsigned c = sqrt((Radius * Radius) - (b * b));
80 point n = {coord.x + b, coord.y + c};
81 DrawRectangleFill(n, {(coord.x - n.x) * 2, c * 2}, color);
82 for (
unsigned i = Radius; i > (Radius -(coord.x - n.x)); i--)
84 DrawCircle(coord, i, NULL, color);
93 void DrawPoint(point position,
unsigned size, ksys_color_t color =
OS::sys_color_table.work_graph,
bool a =
false)
101 DrawCircle(position, size, color);
105 DrawCircleFill(position, size, color);
113 void DrawRectangleLines(point a, point b, ksys_color_t color =
OS::sys_color_table.work_graph)
115 DrawLine(a, {b.x, a.y}, color);
116 DrawLine(a, {a.x, b.y}, color);
117 DrawLine({b.x, a.y}, b, color);
118 DrawLine({a.x, b.y}, b, color);
128 inline void DrawTriangle(point a, point b, point c, ksys_color_t color =
OS::sys_color_table.work_graph)
130 DrawLine(a, b, color);
131 DrawLine(a, c, color);
132 DrawLine(b, c, color);
141 std::vector<rgb_t> _img;
144 Image(std::string Path);
159 Image::Image(std::string Path)
175 unsigned i = Path.length();
177 while (Path[i] !=
'.')
179 Type.push_back(Path[i]);
186 img.open(Path.c_str(), std::ios::binary);
190 for(
unsigned i = 0; i < 8; i++)
210 if(size.x == 0 && size.y == 0)
215 rgb_t *d = (rgb_t*)malloc(_img.size() *
sizeof(rgb_t));
217 for(
unsigned i = 0; i < _img.size(); i++)
222 _ksys_draw_bitmap(d,coord.x, coord.y, size.x, size.y);
Класс для работы с изображениями
Definition graphic.hpp:139
void DrawImage(point coord={0, 0}, point size={0, 0})
Вывести изображение
Definition graphic.hpp:208
bool LoadImage(std::string Path)
Загрузить изображение из файла
Definition graphic.hpp:168
ksys_colors_table_t sys_color_table
Таблица стандартных(системных) цветов
Definition base.hpp:37
bool Exist(const std::string Path)
проверяет существует ли файл или папки
Definition filesystem.hpp:108
Основное пространство имён
Definition base.hpp:17
Просто точка
Definition base.hpp:22