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