1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKCANVASCONTEXT_P_H
5#define QQUICKCANVASCONTEXT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <private/qtquickglobal_p.h>
19
20QT_REQUIRE_CONFIG(quick_canvas);
21
22#include <QtQuick/qquickitem.h>
23#include <QtQml/private/qv4staticvalue_p.h>
24
25QT_BEGIN_NAMESPACE
26
27namespace QV4 {
28 struct ExecutionEngine;
29}
30
31class QQuickCanvasItem;
32class QSGLayer;
33
34class QQuickCanvasContext : public QObject
35{
36 Q_OBJECT
37
38public:
39 QQuickCanvasContext(QObject *parent = nullptr);
40 ~QQuickCanvasContext();
41
42 virtual QStringList contextNames() const = 0;
43
44 // Init (ignore options if necessary)
45 virtual void init(QQuickCanvasItem *canvasItem, const QVariantMap &args) = 0;
46
47 virtual void prepare(const QSize& canvasSize, const QSize& tileSize, const QRect& canvasWindow, const QRect& dirtyRect, bool smooth, bool antialiasing);
48 virtual void flush();
49
50 virtual QV4::ExecutionEngine *v4Engine() const = 0;
51 virtual void setV4Engine(QV4::ExecutionEngine *engine) = 0;
52 virtual QV4::ReturnedValue v4value() const = 0;
53
54 virtual QImage toImage(const QRectF& bounds) = 0;
55
56Q_SIGNALS:
57 void textureChanged();
58};
59
60QT_END_NAMESPACE
61
62#endif //QQUICKCANVASCONTEXT_P_H
63

source code of qtdeclarative/src/quick/items/context2d/qquickcanvascontext_p.h