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 DesaturationDelegate : public Qul::PaintedItemDelegate
{
public:
    Qul::Property<double> saturation;
    Qul::Property<Qul::SharedImage> source;

    void saturationChanged();

    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 bool m_initialized = false;
#ifdef QUL_TVIIC_PLATFORM
    mutable CSurface<1> m_source;
#endif
};