14#ifndef NSBACI_SERVICES_DRAWINGSERVICE_H
15#define NSBACI_SERVICES_DRAWINGSERVICE_H
44class DrawingService :
public QObject {
48 explicit DrawingService(QObject* parent =
nullptr);
49 ~DrawingService() =
default;
52 DrawingService(
const DrawingService&) =
delete;
53 DrawingService& operator=(
const DrawingService&) =
delete;
54 DrawingService(DrawingService&&) =
delete;
55 DrawingService& operator=(DrawingService&&) =
delete;
65 void setColor(uint8_t r, uint8_t g, uint8_t b);
74 void setColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
153 void drawCircle(int32_t centerX, int32_t centerY, int32_t radius,
154 bool filled =
false);
164 void drawRectangle(int32_t x, int32_t y, int32_t width, int32_t height,
165 bool filled =
false);
174 void drawTriangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3,
175 int32_t y3,
bool filled =
false);
182 void drawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2);
192 void drawEllipse(int32_t centerX, int32_t centerY, int32_t radiusX,
193 int32_t radiusY,
bool filled =
false);
209 void drawText(int32_t x, int32_t y,
const std::string& text,
210 int32_t fontSize = 12);
281 int32_t lineWidth_ = 1;
nsbaci::types::Color getCurrentColor() const
Get the current drawing color.
Definition drawingService.h:86
void clearRequested(const nsbaci::types::Color &backgroundColor)
Emitted when the canvas should be cleared.
void drawRequested(const nsbaci::types::Drawable &drawable)
Emitted when a shape should be drawn.
void drawCommandReceived(const nsbaci::types::DrawCommand &command)
Emitted when a drawing command should be executed.
void setColor(uint8_t r, uint8_t g, uint8_t b)
Set the current drawing color using RGB values.
Definition drawingService.cpp:20
void processCommand(const nsbaci::types::DrawCommand &command)
Process a drawing command from the runtime.
Definition drawingService.cpp:153
void clear()
Clear the canvas with optional background color.
Definition drawingService.cpp:49
void drawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
Draw a line between two points.
Definition drawingService.cpp:101
void setPosition(int32_t x, int32_t y)
Set the current drawing position.
Definition drawingService.cpp:37
void drawRectangle(int32_t x, int32_t y, int32_t width, int32_t height, bool filled=false)
Draw a rectangle at the specified position.
Definition drawingService.cpp:84
nsbaci::types::Size getCanvasSize() const
Get the canvas size.
Definition drawingService.h:224
int32_t getLineWidth() const
Get the current line width.
Definition drawingService.h:142
void reset()
Reset the drawing service to initial state.
Definition drawingService.cpp:145
void drawText(int32_t x, int32_t y, const std::string &text, int32_t fontSize=12)
Draw text at the specified position.
Definition drawingService.cpp:124
void drawEllipse(int32_t centerX, int32_t centerY, int32_t radiusX, int32_t radiusY, bool filled=false)
Draw an ellipse at the specified position.
Definition drawingService.cpp:108
void drawShape(const nsbaci::types::Shape &shape)
Draw a generic shape.
Definition drawingService.cpp:132
void setCanvasSize(int32_t width, int32_t height)
Set the canvas size.
Definition drawingService.cpp:140
void drawCircle(int32_t centerX, int32_t centerY, int32_t radius, bool filled=false)
Draw a circle at the specified position.
Definition drawingService.cpp:76
void refresh()
Request a canvas refresh/redraw.
Definition drawingService.cpp:64
void canvasSizeChanged(const nsbaci::types::Size &size)
Emitted when canvas size changes.
void setLineWidth(int32_t width)
Set the line thickness for subsequent drawings.
Definition drawingService.cpp:69
void drawPixel(int32_t x, int32_t y)
Draw a single pixel at the specified position.
Definition drawingService.cpp:117
void drawTriangle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x3, int32_t y3, bool filled=false)
Draw a triangle with three vertices.
Definition drawingService.cpp:92
void refreshRequested()
Emitted when the canvas should refresh.
nsbaci::types::Point getCurrentPosition() const
Get the current drawing position.
Definition drawingService.h:107
void fill()
Fill the entire canvas with the current color.
Definition drawingService.cpp:60
Type definitions for drawing-related operations.
Services namespace containing all backend service implementations.
Definition compilerService.cpp:15
std::variant< Circle, Rectangle, Triangle, Line, Ellipse, Pixel, DrawText > Shape
Variant type for all drawable shapes.
Definition drawingTypes.h:203
RGB color representation with values from 0-255.
Definition drawingTypes.h:31
Represents a single drawing command to be executed.
Definition drawingTypes.h:241
Complete drawable object with shape, color, and visibility.
Definition drawingTypes.h:210
2D point/position representation.
Definition drawingTypes.h:69
2D size representation.
Definition drawingTypes.h:93