-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrectangle.cpp
More file actions
29 lines (23 loc) · 808 Bytes
/
rectangle.cpp
File metadata and controls
29 lines (23 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "rectangle.h"
bool operator!=(const NVGcolor& lhs, const NVGcolor& rhs) {
return memcmp(lhs.rgba, rhs.rgba, sizeof(float) *4) != 0;
}
Rectangle::Rectangle(Item *parent, float x, float y, float width, float hieght)
: Item (parent, x, y, width, hieght)
{
}
void Rectangle::drawRect(NVGcontext* ctx, float x, float y, float width, float hieght, float radius, Color color) {
nvgBeginPath(ctx);
nvgRoundedRect(ctx, x, y, width, hieght, radius);
nvgFillColor(ctx, color.vgColor());
nvgFill(ctx);
}
void Rectangle::draw(NVGcontext* vg) {
drawRect(vg, x(), y(), width(), hieght(), m_radius, m_color);
if (borderWidth()) {
nvgStrokeColor(vg, m_borderColor.vgColor());
nvgStrokeWidth(vg, m_borderWidth);
nvgStroke(vg);
}
Item::draw(vg);
}