15#include "filesystem.hpp"
25 inline void DrawLine(
const point& a,
const point& b,
const ksys_color_t color =
OS::sys_color_table.work_graph)
27 _ksys_draw_line(a.x, a.y, b.x, b.y, color);
33 inline void DrawPixel(
const point& position,
const ksys_color_t color =
OS::sys_color_table.work_text)
35 _ksys_draw_pixel(position.x, position.y, color);
44 void DrawCircle(point coord,
unsigned Radius,
unsigned detalization = 36, ksys_color_t color =
OS::sys_color_table.work_graph)
49 for (
unsigned angle = 1; angle <= detalization * 10; angle += (36 / detalization))
51 buff = {coord.x + b, coord.y + c};
52 b = Radius * cos(angle);
53 c = sqrt((Radius*Radius) - (b*b));
54 point n = {coord.x + b, coord.y + c};
63 void DrawRectangleFill(point position,
const point& size,
const ksys_color_t color =
OS::sys_color_table.work_graph)
67 ::
"a"(13),
"b"((position.x << 16) + size.x),
"c"((position.y << 16) + size.y),
"d"(color));
74 void DrawCircleFill(point coord,
unsigned Radius, ksys_color_t color =
OS::sys_color_table.work_graph)
76 DrawCircle(coord, Radius, color);
77 unsigned b = Radius * cos(90+45);
78 unsigned c = sqrt((Radius * Radius) - (b * b));
79 point n = {coord.x + b, coord.y + c};
80 DrawRectangleFill(n, {(coord.x - n.x) * 2, c * 2}, color);
81 for (
unsigned i = Radius; i > (Radius -(coord.x - n.x)); i--)
83 DrawCircle(coord, i, NULL, color);
93 void DrawPoint(
const point& position,
const unsigned& Radius,
const ksys_color_t& color =
OS::sys_color_table.work_graph,
bool fill =
false)
101 DrawCircleFill(position, Radius, color);
105 DrawCircle(position, Radius, color);
108 DrawPixel(position, color);
117 void DrawRectangleLines(point a, point b, ksys_color_t color =
OS::sys_color_table.work_graph)
119 DrawLine(a, {b.x, a.y}, color);
120 DrawLine(a, {a.x, b.y}, color);
121 DrawLine({b.x, a.y}, b, color);
122 DrawLine({a.x, b.y}, b, color);
132 inline void DrawTriangle(point a, point b, point c, ksys_color_t color =
OS::sys_color_table.work_graph)
134 DrawLine(a, b, color);
135 DrawLine(a, c, color);
136 DrawLine(b, c, color);
145 std::vector<rgb_t> _img;
148 Image(std::string Path);
163 Image::Image(std::string Path)
181 unsigned i = Path.length();
183 while (Path[i] !=
'.')
185 Type.push_back(Path[i]);
192 img.open(Path.c_str(), std::ios::binary);
196 for(
unsigned i = 0; i < 8; i++)
205 else if (Type ==
"jpeg")
219 return extcode =
false;
226 if(size.x == 0 && size.y == 0)
231 rgb_t *d = (rgb_t*)malloc(_img.size() *
sizeof(rgb_t));
233 for(
unsigned i = 0; i < _img.size(); i++)
238 _ksys_draw_bitmap(d,coord.x, coord.y, size.x, size.y);
Класс для работы с изображениями
Definition graphic.hpp:143
void DrawImage(point coord={0, 0}, point size={0, 0})
Вывести изображение
Definition graphic.hpp:224
bool LoadImage(std::string Path)
Загрузить изображение из файла
Definition graphic.hpp:172
ksys_colors_table_t sys_color_table
Таблица стандартных(системных) цветов
Definition base.hpp:36
bool Exist(const std::string &Path)
проверяет существует ли файл или папки
Definition filesystem.hpp:109
Основное пространство имён
Definition base.hpp:17
Просто точка
Definition base.hpp:26