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"
28class BindRectangle : public BindView
29{
30public:
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
68private:
69 uint8_t objID = BIND_ID_RECTANGLE;
70 uint16_t offset = 0;
71 static int16_t tagIndex;
72};
73
74#endif /* __BINDRECTANGLE_HPP */
Represents a Rectangle Object for BindCanvas.
Definition BindRectangle.hpp:29
int16_t cornersRadius
Radius of the rectangle's rounded corners.
Definition BindRectangle.hpp:40
int16_t y
Y-coordinate position of the rectangle.
Definition BindRectangle.hpp:33
uint16_t getBytes(uint8_t *out) override
Get the serialized bytes of the BindRectangle object.
Definition BindRectangle.hpp:51
int16_t width
Width of the rectangle.
Definition BindRectangle.hpp:35
int16_t x
X-coordinate position of the rectangle.
Definition BindRectangle.hpp:32
int16_t height
Height of the rectangle.
Definition BindRectangle.hpp:36
uint8_t cmdId
Command identifier for the rectangle. See the notes for possible cmdId values.
Definition BindRectangle.hpp:34
int16_t borderWidth
Border (Stroke) width of the rectangle.
Definition BindRectangle.hpp:39
int32_t fillColor
Fill color of the rectangle.
Definition BindRectangle.hpp:37
int32_t borderColor
Border (Stroke) color of the rectangle.
Definition BindRectangle.hpp:38
Definition BindView.hpp:22