C

Qt Quick Ultralite traveo_t2g_effects Example

// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial

#include <qul/painteditemdelegate.h>
#include <qul/image.h>

#include <platforminterface/drawingdevice.h>
#include <platforminterface/rect.h>
#include <platforminterface/rgba32.h>

#ifdef QUL_TVIIC_PLATFORM
#include <ut_class_surface.h>
#endif

class NeedleTrailDelegate : public Qul::PaintedItemDelegate
{
public:
    Qul::Property<double> rotation;
    Qul::Property<Qul::SharedImage> mask;

    void rotationChanged();

    Qul::PlatformInterface::Rect boundingRect(Qul::PlatformInterface::Size size) const override;

    void paint(Qul::PlatformInterface::DrawingDevice *device,
               const Qul::PlatformInterface::Rect &clip,
               const Qul::PlatformInterface::Transform &transform,
               Qul::PlatformInterface::Size size,
               float opacity) const override;

private:
    mutable float m_trailAngle = 0.f;
    mutable bool m_initialized = false;
#ifdef QUL_TVIIC_PLATFORM
    mutable CSurface<1> m_trailMask;
#endif
};