#include <QPainter>
#include <QPainterPath>
#include <QDebug>
#include "taskbarmask.h"

TaskbarMask::TaskbarMask(QQuickPaintedItem *parent) : QQuickPaintedItem(parent)
{

}

void TaskbarMask::paint(QPainter *painter)
{
    QPainterPath rect;
    rect.addRect(0, 0, 10, 64);

    const qreal radius = 15;
    QRect rectR = QRect(2, 0, 20, 64);
    QPainterPath path;
    path.moveTo(rectR.bottomRight() - QPointF(0, radius));
    path.lineTo(rectR.topRight() + QPointF(0, radius));
    path.arcTo(QRectF(QPointF(rectR.topRight() - QPointF(radius * 2, 0)), QSize(radius * 2, radius *2)), 0, 90);
    path.lineTo(rectR.topLeft() + QPointF(radius, 0));
    path.arcTo(QRectF(QPointF(rectR.topLeft()), QSize(radius * 2, radius * 2)), 90, 90);
    path.lineTo(rectR.bottomLeft() - QPointF(0, radius));
    path.arcTo(QRectF(QPointF(rectR.bottomLeft() - QPointF(0, radius * 2)), QSize(radius * 2, radius * 2)), 180, 90);
    path.lineTo(rectR.bottomLeft() + QPointF(radius, 0));
    path.arcTo(QRectF(QPointF(rectR.bottomRight() - QPointF(radius * 2, radius * 2)), QSize(radius * 2, radius * 2)), 270, 90);


    painter->fillPath(path, QColor(Qt::transparent));
    painter->fillPath(rect - path, QBrush(QColor(240,243,247,35)));//216//
    painter->setRenderHint(QPainter::Antialiasing);
}
