File indexing completed on 2025-02-02 04:11:05
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 <QBrush> 0010 #include <QPainter> 0011 0012 #include "styler.hpp" 0013 #include "model/animation/animatable.hpp" 0014 0015 namespace glaxnimate::model { 0016 0017 class Fill : public StaticOverrides<Fill, Styler> 0018 { 0019 GLAXNIMATE_OBJECT(Fill) 0020 0021 public: 0022 enum Rule 0023 { 0024 NonZero = Qt::WindingFill, 0025 EvenOdd = Qt::OddEvenFill, 0026 }; 0027 0028 private: 0029 Q_ENUM(Rule); 0030 0031 GLAXNIMATE_PROPERTY(Rule, fill_rule, NonZero, nullptr, nullptr, PropertyTraits::Visual) 0032 0033 public: 0034 using Ctor::Ctor; 0035 0036 QRectF local_bounding_rect(FrameTime t) const override 0037 { 0038 return collect_shapes(t, {}).bounding_box(); 0039 } 0040 0041 static QIcon static_tree_icon() 0042 { 0043 return QIcon::fromTheme("format-fill-color"); 0044 } 0045 0046 static QString static_type_name_human() 0047 { 0048 return i18n("Fill"); 0049 } 0050 0051 protected: 0052 QPainterPath to_painter_path_impl(FrameTime t) const override; 0053 0054 void on_paint(QPainter* p, FrameTime t, PaintMode, model::Modifier* modifier) const override; 0055 }; 0056 0057 0058 } // namespace glaxnimate::model