File indexing completed on 2025-02-02 04:11:07

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include "shape.hpp"
0010 
0011 namespace glaxnimate::model {
0012 
0013 
0014 class Rect : public Shape
0015 {
0016     GLAXNIMATE_OBJECT(Rect)
0017     GLAXNIMATE_ANIMATABLE(QPointF, position, QPointF())
0018     GLAXNIMATE_ANIMATABLE(QSizeF, size, QSizeF())
0019     GLAXNIMATE_ANIMATABLE(float, rounded, 0, {}, 0)
0020 
0021 public:
0022     using Shape::Shape;
0023 
0024     QIcon tree_icon() const override
0025     {
0026         return QIcon::fromTheme("draw-rectangle");
0027     }
0028 
0029     QString type_name_human() const override
0030     {
0031         return i18n("Rectangle");
0032     }
0033 
0034     math::bezier::Bezier to_bezier(FrameTime t) const override;
0035 
0036     QRectF local_bounding_rect(FrameTime t) const override
0037     {
0038         QSizeF sz = size.get_at(t);
0039         return QRectF(position.get_at(t) - QPointF(sz.width()/2, sz.height()/2), sz);
0040     }
0041 };
0042 
0043 } // namespace glaxnimate::model