Loading...
Searching...
No Matches
BindRectangle.hpp
1#ifndef __BINDRECTANGLE_HPP
2#define __BINDRECTANGLE_HPP
3#include "BindView.hpp"
4#include "BindUtils.hpp"
28 class BindRectangle : public BindView
29{
30 public:
31 BindRectangle();
32 int16_t x = 0;
33 int16_t y = 0;
34 uint8_t cmdId = 0;
35 int16_t width = 200;
36 int16_t height = 100;
37 int32_t fillColor = WHITE;
38 int32_t borderColor = DKGRAY;
39 int16_t borderWidth = 2;
40 int16_t cornersRadius = 5;
41
51 uint16_t getBytes(uint8_t *out) override
52 {
53 offset = 0;
54 copyAndOffset(out, &offset, &objID, sizeof(objID));
55 copyAndOffset(out, &offset, &x, sizeof(x));
56 copyAndOffset(out, &offset, &y, sizeof(y));
57 copyAndOffset(out, &offset, &tag, sizeof(tag));
58 copyAndOffset(out, &offset, &cmdId, sizeof(cmdId));
59 copyAndOffset(out, &offset, &width, sizeof(width));
60 copyAndOffset(out, &offset, &height, sizeof(height));
61 copyAndOffset(out, &offset, &fillColor, sizeof(fillColor));
62 copyAndOffset(out, &offset, &borderColor, sizeof(borderColor));
63 copyAndOffset(out, &offset, &borderWidth, sizeof(borderWidth));
64 copyAndOffset(out, &offset, &cornersRadius, sizeof(cornersRadius));
65 return offset;
66 }
67
68 private:
69 uint8_t objID = BIND_ID_RECTANGLE;
70 uint16_t offset = 0;
71 static int16_t tagIndex;
72};
73
74#endif /* __BINDRECTANGLE_HPP */
BindRectangle
Represents a Rectangle Object for BindCanvas.
Definition BindRectangle.hpp:29
BindRectangle::cornersRadius
int16_t cornersRadius
Radius of the rectangle's rounded corners.
Definition BindRectangle.hpp:40
BindRectangle::y
int16_t y
Y-coordinate position of the rectangle.
Definition BindRectangle.hpp:33
BindRectangle::getBytes
uint16_t getBytes(uint8_t *out) override
Get the serialized bytes of the BindRectangle object.
Definition BindRectangle.hpp:51
BindRectangle::width
int16_t width
Width of the rectangle.
Definition BindRectangle.hpp:35
BindRectangle::x
int16_t x
X-coordinate position of the rectangle.
Definition BindRectangle.hpp:32
BindRectangle::height
int16_t height
Height of the rectangle.
Definition BindRectangle.hpp:36
BindRectangle::cmdId
uint8_t cmdId
Command identifier for the rectangle. See the notes for possible cmdId values.
Definition BindRectangle.hpp:34
BindRectangle::borderWidth
int16_t borderWidth
Border (Stroke) width of the rectangle.
Definition BindRectangle.hpp:39
BindRectangle::fillColor
int32_t fillColor
Fill color of the rectangle.
Definition BindRectangle.hpp:37
BindRectangle::borderColor
int32_t borderColor
Border (Stroke) color of the rectangle.
Definition BindRectangle.hpp:38
BindView
Definition BindView.hpp:26