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 #include "fill.hpp"
0008 
0009 GLAXNIMATE_OBJECT_IMPL(glaxnimate::model::Fill)
0010 
0011 void glaxnimate::model::Fill::on_paint(QPainter* p, glaxnimate::model::FrameTime t, glaxnimate::model::VisualNode::PaintMode, glaxnimate::model::Modifier* modifier) const
0012 {
0013     p->setBrush(brush(t));
0014     p->setOpacity(p->opacity() * opacity.get_at(t));
0015     p->setPen(Qt::NoPen);
0016 
0017     math::bezier::MultiBezier bez;
0018     if ( modifier )
0019         bez = modifier->collect_shapes_from(affected(), t, {});
0020     else
0021         bez = collect_shapes(t, {});
0022 
0023     QPainterPath path = bez.painter_path();
0024 
0025     path.setFillRule(Qt::FillRule(fill_rule.get()));
0026     p->drawPath(path);
0027 }
0028 
0029 QPainterPath glaxnimate::model::Fill::to_painter_path_impl(glaxnimate::model::FrameTime t) const
0030 {
0031     return collect_shapes(t, {}).painter_path();
0032 }
0033