summaryrefslogtreecommitdiffstats
path: root/shapes/shapesplugin/shapesplugin.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-05-26 20:31:40 +0200
committerGunnar Sletta <gunnar.sletta@digia.com>2013-05-28 09:29:08 +0200
commit1837bafc23d252fc7a7e9b86618d6e688063b17f (patch)
treef7c03c3e1cb5062b6dad1668770e0aeaaa45c4c6 /shapes/shapesplugin/shapesplugin.cpp
parentbaaa6d691a1820c80670ee7cfd727fb1c2c7b832 (diff)
Say hello to Qt.labs.shapes 0.1
The shapes plugin provies three element types. 1. TriangleSet - which encapsulates a set of triangles including read/save logic to a very basic textual format. Binary can of course be added later... It also contains a set of path commands and uses Qt's triangulator internally to convert a path into triangles. 2. Polygon - Renders a flat shaded triangle set. 3. MaskedImage - Reads two triangle sets in addition to an image and splits the image into a opaque and blended part, making it possible to greatly reduce the blending needed for drawing large bitmaps which are largely opaque. There is also a maskmaker tool in the tools subdirectory which provides a simple means of generating masks for the MaskedImage Change-Id: Ia00f059fb81872e6ca1dca78baf3073c9581acab Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'shapes/shapesplugin/shapesplugin.cpp')
-rw-r--r--shapes/shapesplugin/shapesplugin.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/shapes/shapesplugin/shapesplugin.cpp b/shapes/shapesplugin/shapesplugin.cpp
new file mode 100644
index 0000000..248ad85
--- /dev/null
+++ b/shapes/shapesplugin/shapesplugin.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Scene Graph Playground module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QQmlExtensionPlugin>
+
+#include "qsgmaskedimage.h"
+#include "qsgpolygon.h"
+#include "qsgtriangleset.h"
+
+class MaskedimagepluginPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+ void registerTypes(const char *uri)
+ {
+ qmlRegisterType<QSGMaskedImage>(uri, 1, 0, "MaskedImage");
+ qmlRegisterType<QSGPolygon>(uri, 1, 0, "Polygon");
+ qmlRegisterType<QSGTriangleSet>(uri, 1, 0, "TriangleSet");
+ }
+};
+
+#include "shapesplugin.moc"