Draw storage avatars as clear cylinders with curved bands
This commit is contained in:
1 parent
383d429051
commit
25cea8ca4c
2 files changed
+18
-14
No files matched your search
@@ -82,22 +82,26 @@ void FlagPainter::drawShield(QPainter* p, int x, int y, int sz) {
|
||||
p->restore();
|
||||
}
|
||||
|
||||
// Цилиндр хранилища: верхний эллипс и дуги обручей целиком помещаются внутри значка.
|
||||
void FlagPainter::drawStorage(QPainter* p, int x, int y, int sz) {
|
||||
p->save();
|
||||
p->setRenderHint(QPainter::Antialiasing);
|
||||
qreal cx = x + sz / 2.0, t = y + 1.0, b = y + sz - 1.0;
|
||||
qreal w = sz * 0.36, gap = sz * 0.20;
|
||||
QPainterPath path;
|
||||
path.moveTo(cx - w, t);
|
||||
path.lineTo(cx + w, t);
|
||||
path.lineTo(cx + w, b);
|
||||
path.lineTo(cx - w, b);
|
||||
path.closeSubpath();
|
||||
p->setPen(QPen(QColor("#37474F"), 0.8));
|
||||
p->translate(x, y);
|
||||
p->scale(sz / 24.0, sz / 24.0);
|
||||
QPainterPath body;
|
||||
body.moveTo(3, 5); body.lineTo(3, 19);
|
||||
body.cubicTo(3, 23, 21, 23, 21, 19);
|
||||
body.lineTo(21, 5); body.closeSubpath();
|
||||
p->setPen(QPen(QColor("#37474F"), 1.2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||
p->setBrush(QColor("#78909C"));
|
||||
p->drawPath(path);
|
||||
p->setBrush(QColor("#ECEFF1"));
|
||||
p->drawEllipse(QPointF(cx, t), w, gap);
|
||||
p->drawEllipse(QPointF(cx, b), w, gap);
|
||||
p->drawPath(body);
|
||||
p->setBrush(Qt::NoBrush);
|
||||
for (int level : {10, 15}) {
|
||||
QPainterPath hoop;
|
||||
hoop.moveTo(3, level); hoop.cubicTo(3, level + 4, 21, level + 4, 21, level);
|
||||
p->drawPath(hoop);
|
||||
}
|
||||
p->setBrush(QColor("#CFD8DC"));
|
||||
p->drawEllipse(QRectF(3, 2, 18, 6));
|
||||
p->restore();
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
// Общая ширина при n>0: n*sz+(n-1)*2; flags без этих битов не рисует ничего.
|
||||
static void draw(QPainter* p, uint8_t flags, int x, int y, int sz);
|
||||
static void drawServer(QPainter* p, int x, int y, int sz); // серверная стойка в квадрате sz×sz
|
||||
static void drawStorage(QPainter* p, int x, int y, int sz); // серый значок диска в квадрате sz×sz
|
||||
static void drawStorage(QPainter* p, int x, int y, int sz); // цилиндр с обручами, целиком внутри квадрата sz×sz
|
||||
static void drawRadio(QPainter* p, int x, int y, int sz, const QColor& color); // контур рации заданного цвета, без заливки
|
||||
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user