| 1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies). |
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 4 | |
| 5 | #include "qdithering.h" |
| 6 | #include "qrenderstate_p.h" |
| 7 | #include <private/qnode_p.h> |
| 8 | |
| 9 | QT_BEGIN_NAMESPACE |
| 10 | |
| 11 | namespace Qt3DRender { |
| 12 | |
| 13 | /*! |
| 14 | \class Qt3DRender::QDithering |
| 15 | \since 5.7 |
| 16 | \inmodule Qt3DRender |
| 17 | \brief Enable dithering. |
| 18 | |
| 19 | A Qt3DRender::QDithering class enables dithering. Dithering adds noise to the |
| 20 | color values to randomize quantization error in order to prevent large scale |
| 21 | patterns in the final image, such as banding. Dithering is most useful when |
| 22 | rendering to a surface with low color bit depth, such as RGB565 or RGBA4444. |
| 23 | */ |
| 24 | |
| 25 | /*! |
| 26 | \qmltype Dithering |
| 27 | \since 5.7 |
| 28 | \inqmlmodule Qt3D.Render |
| 29 | \inherits RenderState |
| 30 | \nativetype Qt3DRender::QDithering |
| 31 | \brief Enable dithering. |
| 32 | |
| 33 | A Dithering type enables dithering. Dithering adds noise to the |
| 34 | color values to randomize quantization error in order to prevent large scale |
| 35 | patterns in the final image, such as banding. Dithering is most useful when |
| 36 | rendering to a surface with low color bit depth, such as RGB565 or RGBA4444. |
| 37 | */ |
| 38 | |
| 39 | class QDitheringPrivate : public QRenderStatePrivate |
| 40 | { |
| 41 | public: |
| 42 | QDitheringPrivate() |
| 43 | : QRenderStatePrivate(Render::DitheringStateMask) |
| 44 | {} |
| 45 | |
| 46 | Q_DECLARE_PUBLIC(QDithering) |
| 47 | }; |
| 48 | |
| 49 | /*! |
| 50 | The constructor creates a new QDithering::QDithering instance with |
| 51 | the specified \a parent. |
| 52 | */ |
| 53 | QDithering::QDithering(QNode *parent) |
| 54 | : QRenderState(*new QDitheringPrivate, parent) |
| 55 | { |
| 56 | } |
| 57 | |
| 58 | /*! \internal */ |
| 59 | QDithering::~QDithering() |
| 60 | { |
| 61 | } |
| 62 | |
| 63 | } // namespace Qt3DRender |
| 64 | |
| 65 | QT_END_NAMESPACE |
| 66 | |
| 67 | #include "moc_qdithering.cpp" |
| 68 | |