Warning, file /graphics/washipad/src/strokeitem.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // This file is part of Washi Pad
0002 // SPDX-FileCopyrightText: 2018 Kevin Ottens <ervin@kde.org>
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #include "strokeitem.h"
0006 
0007 #include <QPainter>
0008 
0009 #include "strokepainter.h"
0010 
0011 StrokeItem::StrokeItem(QQuickItem *parent)
0012     : QQuickPaintedItem(parent)
0013 {
0014     setAntialiasing(true);
0015     setRenderTarget(FramebufferObject);
0016 }
0017 
0018 Stroke StrokeItem::stroke() const
0019 {
0020     return m_stroke;
0021 }
0022 
0023 void StrokeItem::setStroke(const Stroke &stroke)
0024 {
0025     m_stroke = stroke;
0026     emit strokeChanged(stroke);
0027     update();
0028 }
0029 
0030 void StrokeItem::addSample(const StrokeSample &sample)
0031 {
0032     m_stroke.addSample(sample);
0033     emit strokeChanged(m_stroke);
0034     update();
0035 }
0036 
0037 void StrokeItem::paint(QPainter *painter)
0038 {
0039     StrokePainter::render(m_stroke, painter);
0040 }