File indexing completed on 2024-06-02 04:29:55

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2009 Boudewijn Rempt <boud@valdyas.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #include "kis_tool_ellipse_base.h"
0008 
0009 #include <KoPointerEvent.h>
0010 #include <KoCanvasBase.h>
0011 #include <KoCanvasController.h>
0012 #include <KoViewConverter.h>
0013 #include "KisViewManager.h"
0014 
0015 #include "kis_canvas2.h"
0016 
0017 KisToolEllipseBase::KisToolEllipseBase(KoCanvasBase * canvas, KisToolEllipseBase::ToolType type, const QCursor & cursor)
0018     : KisToolRectangleBase(canvas, type, cursor)
0019 {
0020 }
0021 
0022 void KisToolEllipseBase::paintRectangle(QPainter &gc, const QRectF &imageRect)
0023 {
0024     KIS_ASSERT_RECOVER_RETURN(canvas());
0025 
0026     QRect viewRect = pixelToView(imageRect).toRect();
0027 
0028     QPainterPath path;
0029     path.addEllipse(viewRect);
0030     getRotatedPath(path, viewRect.center(), getRotationAngle());
0031     path.addPath(drawX(pixelToView(m_dragStart)));
0032     path.addPath(drawX(pixelToView(m_dragCenter)));
0033     paintToolOutline(&gc, path);
0034 }
0035 
0036 bool KisToolEllipseBase::showRoundCornersGUI() const
0037 {
0038     return false;
0039 }