diff options
author | Kim Gronholm <kim.1.gronholm@nokia.com> | 2011-12-27 13:06:36 +0200 |
---|---|---|
committer | Kim Gronholm <kim.1.gronholm@nokia.com> | 2011-12-27 13:06:36 +0200 |
commit | a9baa55456aff95e7797dbe1f9b19d2afb5034e1 (patch) | |
tree | 0ba8d0f606b632231796bd8f65b4c6d02d591d16 /tools/pngdumper |
Initial commit
Diffstat (limited to 'tools/pngdumper')
-rw-r--r-- | tools/pngdumper/ItemModel.qml | 783 | ||||
-rw-r--r-- | tools/pngdumper/pngdumper.cpp | 69 | ||||
-rw-r--r-- | tools/pngdumper/pngdumper.h | 63 | ||||
-rw-r--r-- | tools/pngdumper/pngdumper.pro | 45 | ||||
-rw-r--r-- | tools/pngdumper/pngdumper.qml | 235 | ||||
-rw-r--r-- | tools/pngdumper/pngdumper_plugin.cpp | 53 | ||||
-rw-r--r-- | tools/pngdumper/pngdumper_plugin.h | 56 | ||||
-rw-r--r-- | tools/pngdumper/qmldir | 2 |
8 files changed, 1306 insertions, 0 deletions
diff --git a/tools/pngdumper/ItemModel.qml b/tools/pngdumper/ItemModel.qml new file mode 100644 index 0000000..8b627fe --- /dev/null +++ b/tools/pngdumper/ItemModel.qml @@ -0,0 +1,783 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtGraphicalEffects 0.1 + +VisualItemModel { + Blend { + width: size + height: size + backgroundSource: bug + foregroundSource: butterfly + mode: "normal" + property string __name: "Blend" + property variant __properties: ["mode"] + property string __varyingProperty: "mode" + property variant __values: ["normal", "addition", "darken", "difference", "divide", "lighten", "multiply", "screen", "subtract"] + } + + BrightnessContrast { + width: size + height: size + source: bug + property string __name: "BrightnessContrast" + property variant __properties: ["brightness", "contrast"] + property string __varyingProperty: "brightness" + property variant __values: [-0.25, 0.0, 0.5] + } + BrightnessContrast { + width: size + height: size + source: bug + property string __name: "BrightnessContrast" + property variant __properties: ["brightness", "contrast"] + property string __varyingProperty: "contrast" + property variant __values: [-0.5, 0.0, 0.5] + } + + Colorize { + width: size + height: size + source: bug + property string __name: "Colorize" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "hue" + property variant __values: [0.2, 0.5, 0.8] + } + Colorize { + width: size + height: size + source: bug + property string __name: "Colorize" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "saturation" + property variant __values: [0.0, 0.5, 1.0] + } + Colorize { + width: size + height: size + source: bug + property string __name: "Colorize" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "lightness" + property variant __values: [-0.75, 0.0, 0.75] + } + + ColorOverlay { + width: size + height: size + source: bug + property string __name: "ColorOverlay" + property variant __properties: ["color"] + property string __varyingProperty: "color" + property variant __values: ["#80ff0000", "#8000ff00", "#800000ff"] + } + + ConicalGradient { + function init() { checkerboard = true } + + width: size + height: size + property string __name: "ConicalGradient" + property variant __properties: ["angle", "horizontalOffset", "verticalOffset", "gradient"] + property string __varyingProperty: "angle" + property variant __values: [0, 45, 185] + } + ConicalGradient { + width: size + height: size + property string __name: "ConicalGradient" + property variant __properties: ["angle", "horizontalOffset", "verticalOffset", "gradient"] + property string __varyingProperty: "horizontalOffset" + property variant __values: [-50, 0, 50] + } + ConicalGradient { + width: size + height: size + property string __name: "ConicalGradient" + property variant __properties: ["angle", "horizontalOffset", "verticalOffset", "gradient"] + property string __varyingProperty: "gradient" + property variant __values: [firstGradient, secondGradient, thirdGradient] + } + ConicalGradient { + width: size + height: size + property string __name: "ConicalGradient" + property variant __properties: ["angle", "horizontalOffset", "verticalOffset", "gradient", "maskSource"] + property string __varyingProperty: "maskSource" + property variant __values: [undefined, butterfly] + + function uninit() { checkerboard = false } + } + + Desaturate { + width: size + height: size + source: butterfly + property string __name: "Desaturate" + property variant __properties: ["desaturation"] + property string __varyingProperty: "desaturation" + property variant __values: ["0.0", "0.5", "1.0"] + } + + // TODO: Update the displacement texture + Displace { + width: size + height: size + source: bug + displacementSource: ShaderEffectSource {sourceItem: displacementMapSource; visible: false } + property string __name: "Displace" + property variant __properties: ["displacement"] + property string __varyingProperty: "displacement" + property variant __values: ["-0.3", "0.0", "0.3"] + } + + DropShadow { + function init() { butterfly.visible = true } + + width: size + height: size + source: butterfly + horizontalOffset: 0 + verticalOffset: 20 + maximumRadius: 8 + property string __name: "DropShadow" + property variant __properties: ["radius", "maximumRadius", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "radius" + property variant __values: [0, 6, 12] + } + DropShadow { + function init() { checkerboard = true } + width: size + height: size + source: butterfly + horizontalOffset: 0 + verticalOffset: 20 + radius: 8 + maximumRadius: 8 + property string __name: "DropShadow" + property variant __properties: ["radius", "maximumRadius", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "color" + property variant __values: ["#000000", "#0000ff", "#aa000000"] + + function uninit() { checkerboard = false } + } + DropShadow { + width: size + height: size + source: butterfly + //verticalOffset: 3 + radius: 4 + maximumRadius: 8 + property string __name: "DropShadow" + property variant __properties: ["radius", "maximumRadius", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "horizontalOffset" + property variant __values: ["-20", "0", "20"] + } + DropShadow { + width: size + height: size + source: butterfly + //horizontalOffset: 3 + radius: 4 + maximumRadius: 8 + property string __name: "DropShadow" + property variant __properties: ["radius", "maximumRadius", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "verticalOffset" + property variant __values: ["-20", "0", "20"] + } + DropShadow { + width: size + height: size + source: butterfly + //horizontalOffset: 3 + verticalOffset: 20 + radius: 8 + maximumRadius: 8 + property string __name: "DropShadow" + property variant __properties: ["radius", "maximumRadius", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.5", "1.0"] + } + + FastDropShadow { + function init() { checkerboard = true } + + width: size + height: size + source: butterfly + //horizontalOffset: 3 + verticalOffset: 20 + blur: 0.5 + property string __name: "FastDropShadow" + property variant __properties: ["blur", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "color" + property variant __values: ["#000000", "#0000ff", "#aa000000"] + + function uninit() { checkerboard = false } + } + FastDropShadow { + width: size + height: size + source: butterfly + //verticalOffset: 3 + blur: 0.5 + property string __name: "FastDropShadow" + property variant __properties: ["blur", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "horizontalOffset" + property variant __values: [-20, 0, 20] + } + FastDropShadow { + width: size + height: size + source: butterfly + //horizontalOffset: 3 + blur: 0.5 + property string __name: "FastDropShadow" + property variant __properties: ["blur", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "verticalOffset" + property variant __values: [-20, 0, 20] + } + FastDropShadow { + width: size + height: size + source: butterfly + //horizontalOffset: 3 + verticalOffset: 20 + blur: 0.5 + property string __name: "FastDropShadow" + property variant __properties: ["blur", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.5", "0.8"] + } + FastDropShadow { + width: size + height: size + source: butterfly + //horizontalOffset: 3 + verticalOffset: 20 + blur: 0.5 + property string __name: "FastDropShadow" + property variant __properties: ["blur", "color", "horizontalOffset", "verticalOffset", "spread"] + property string __varyingProperty: "blur" + property variant __values: ["0.0", "0.5", "0.8"] + } + + Glow { + function init() { background = "black" } + + width: size + height: size + source: butterfly + maximumRadius: 8 + property string __name: "Glow" + property variant __properties: ["radius", "maximumRadius", "color", "spread"] + property string __varyingProperty: "radius" + property variant __values: [0, 6, 12] + } + Glow { + width: size + height: size + source: butterfly + radius: 8 + spread: 0.5 + maximumRadius: 8 + property string __name: "Glow" + property variant __properties: ["radius", "maximumRadius", "color", "spread"] + property string __varyingProperty: "color" + property variant __values: ["#ffffff", "#00ff00", "#aa00ff00"] + } + Glow { + width: size + height: size + source: butterfly + radius: 8 + maximumRadius: 8 + property string __name: "Glow" + property variant __properties: ["radius", "maximumRadius", "color", "spread"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.5", "1.0"] + } + + FastGlow { + width: size + height: size + source: butterfly + property string __name: "FastGlow" + property variant __properties: ["blur", "color", "spread"] + property string __varyingProperty: "blur" + property variant __values: ["0.0", "0.5", "1.0"] + } + FastGlow { + width: size + height: size + source: butterfly + blur: 0.5 + spread: 0.25 + property string __name: "FastGlow" + property variant __properties: ["blur", "color", "spread"] + property string __varyingProperty: "color" + property variant __values: ["#ffffff", "#00ff00", "#aa00ff00"] + } + FastGlow { + width: size + height: size + source: butterfly + blur: 0.5 + property string __name: "FastGlow" + property variant __properties: ["blur", "color", "spread"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.5", "0.9"] + + function uninit() { + butterfly.visible = false + background = "white" + } + } + + FastBlur { + width: size + height: size + source: bug + property string __name: "FastBlur" + property variant __properties: ["blur"] + property string __varyingProperty: "blur" + property variant __values: ["0.0", "0.5", "1.0"] + } + FastBlur { + function init() { checkerboard = true } + width: size + height: size + source: bug + blur: 1.0 + property string __name: "FastBlur" + property variant __properties: ["blur", "transparentBorder"] + property string __varyingProperty: "transparentBorder" + property variant __values: [false, true] + function uninit() { checkerboard = false } + } + + GammaAdjust { + width: size + height: size + source: bug + property string __name: "GammaAdjust" + property variant __properties: ["gamma"] + property string __varyingProperty: "gamma" + property variant __values: ["0.5", "1.0", "1.5"] + } + + GaussianBlur { + width: size + height: size + source: bug + maximumRadius: 8 + deviation: 3 + property string __name: "GaussianBlur" + property variant __properties: ["radius", "maximumRadius", "deviation"] + property string __varyingProperty: "radius" + property variant __values: [0, 4, 8] + } + GaussianBlur { + width: size + height: size + source: bug + maximumRadius: 8 + radius: 8 + property string __name: "GaussianBlur" + property variant __properties: ["radius", "maximumRadius", "deviation"] + property string __varyingProperty: "deviation" + property variant __values: [1, 2, 4] + } + GaussianBlur { + function init() { checkerboard = true } + width: size + height: size + source: bug + maximumRadius: 8 + radius: 8 + property string __name: "GaussianBlur" + property variant __properties: ["radius", "maximumRadius", "deviation", "transparentBorder"] + property string __varyingProperty: "transparentBorder" + property variant __values: [false, true] + function uninit() { checkerboard = false } + } + + HueSaturation { + width: size + height: size + source: bug + property string __name: "HueSaturation" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "hue" + property variant __values: ["-0.3", "0.0", "0.3"] + } + HueSaturation { + width: size + height: size + source: bug + property string __name: "HueSaturation" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "saturation" + property variant __values: ["-0.8", "0.0", "1.0"] + } + HueSaturation { + width: size + height: size + source: bug + property string __name: "HueSaturation" + property variant __properties: ["hue", "saturation", "lightness"] + property string __varyingProperty: "lightness" + property variant __values: ["-0.5", "0.0", "0.5"] + } + + LinearGradient { + function init() { checkerboard = true } + + width: size + height: size + start: Qt.point(0,0) + end: Qt.point(width, height) + property string __name: "LinearGradient" + property variant __properties: ["start", "end", "gradient"] + property string __varyingProperty: "gradient" + property variant __values: [firstGradient, secondGradient, thirdGradient] + } + LinearGradient { + width: size + height: size + end: Qt.point(width, height) + property string __name: "LinearGradient" + property variant __properties: ["start", "end", "gradient"] + property string __varyingProperty: "start" + property variant __values: [Qt.point(0,0), Qt.point(width / 2, height / 2), Qt.point(width, 0)] + } + LinearGradient { + width: size + height: size + start: Qt.point(0,0) + property string __name: "LinearGradient" + property variant __properties: ["start", "end", "gradient"] + property string __varyingProperty: "end" + property variant __values: [Qt.point(width, height), Qt.point(width / 2, height / 2), Qt.point(width, 0)] + } + LinearGradient { + width: size + height: size + start: Qt.point(0,0) + end: Qt.point(width, height) + property string __name: "LinearGradient" + property variant __properties: ["start", "end", "gradient", "maskSource"] + property string __varyingProperty: "maskSource" + property variant __values: [undefined, butterfly] + } + + OpacityMask { + width: size + height: size + source: bug + property string __name: "OpacityMask" + property variant __properties: ["maskSource"] + property string __varyingProperty: "maskSource" + property variant __values: [butterfly] + } + + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "horizontalOffset" + property variant __values: [-width / 2, 0, width / 2] + } + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "verticalOffset" + property variant __values: [-height / 2, 0, height / 2] + } + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "horizontalRadius" + property variant __values: [width, width / 3] + } + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "verticalRadius" + property variant __values: [height, height / 3] + } + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "gradient" + property variant __values: [firstGradient, secondGradient, thirdGradient] + } + RadialGradient { + width: size + height: size + horizontalRadius: width / 3 + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient"] + property string __varyingProperty: "angle" + property variant __values: [0, 45, 90] + } + RadialGradient { + width: size + height: size + property string __name: "RadialGradient" + property variant __properties: ["horizontalOffset", "verticalOffset", "horizontalRadius", "verticalRadius", "angle", "gradient", "maskSource"] + property string __varyingProperty: "maskSource" + property variant __values: [undefined, butterfly] + + function uninit() { checkerboard = false } + } + + RectangularGlow { + function init() { + background = "black" + rect.visible = true + } + width: rect.width + height: rect.height + x: rect.x + property string __name: "RectangularGlow" + property variant __properties: ["glowRadius", "spread", "color", "cornerRadius"] + property string __varyingProperty: "glowRadius" + property variant __values: [10, 20, 40] + cornerRadius: 25 + } + RectangularGlow { + width: rect.width + height: rect.height + x: rect.x + property string __name: "RectangularGlow" + property variant __properties: ["glowRadius", "spread", "color", "cornerRadius"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.5", "1.0"] + cornerRadius: 25 + glowRadius: 20 + } + RectangularGlow { + width: rect.width + height: rect.height + x: rect.x + property string __name: "RectangularGlow" + property variant __properties: ["glowRadius", "spread", "color", "cornerRadius"] + property string __varyingProperty: "color" + property variant __values: ["#ffffff", "#55ff55", "#5555ff"] + cornerRadius: 25 + glowRadius: 20 + } + RectangularGlow { + width: rect.width + height: rect.height + x: rect.x + property string __name: "RectangularGlow" + property variant __properties: ["glowRadius", "spread", "color", "cornerRadius"] + property string __varyingProperty: "cornerRadius" + property variant __values: [0, 25, 50] + glowRadius: 20 + + function uninit() { + background = "white" + rect.visible = false + } + } + + RecursiveBlur { + function init() { + timer.interval = 2000 + checkerboard = true + } + + width: size + height: size + source: bug + radius: 7.5 + property string __name: "RecursiveBlur" + property variant __properties: ["loops", "radius"] + property string __varyingProperty: "loops" + property variant __values: [4, 20, 70] + } + RecursiveBlur { + width: size + height: size + source: bug + loops: 20 + property string __name: "RecursiveBlur" + property variant __properties: ["loops", "radius"] + property string __varyingProperty: "radius" + property variant __values: [2.5, 4.5, 7.5] + } + RecursiveBlur { + width: size + height: size + source: bug + loops: 20 + radius: 7.5 + property string __name: "RecursiveBlur" + property variant __properties: ["loops", "radius", "transparentBorder"] + property string __varyingProperty: "transparentBorder" + property variant __values: [false, true] + + function uninit() { + timer.interval = timerInterval + checkerboard = false + } + } + + ThresholdMask { + width: size + height: size + source: bug + maskSource: fog + threshold: 0.4 + property string __name: "ThresholdMask" + property variant __properties: ["spread", "threshold"] + property string __varyingProperty: "spread" + property variant __values: ["0.0", "0.2", "0.8"] + function init() { checkerboard = true } + } + ThresholdMask { + width: size + height: size + source: bug + maskSource: fog + spread: 0.2 + property string __name: "ThresholdMask" + property variant __properties: ["spread", "threshold"] + property string __varyingProperty: "threshold" + property variant __values: ["0.0", "0.5", "0.7"] + function uninit() { checkerboard = false } + } + + RadialBlur { + width: size + height: size + source: butterfly + samples: 32 + property string __name: "RadialBlur" + property variant __properties: ["samples", "angle", "horizontalOffset", "verticalOffset"] + property string __varyingProperty: "angle" + property variant __values: ["0.0", "15.0", "30.0"] + function uninit() { checkerboard = false } + } + + RadialBlur { + width: size + height: size + source: butterfly + samples: 32 + angle: 20 + property string __name: "RadialBlur" + property variant __properties: ["samples", "angle", "horizontalOffset", "verticalOffset"] + property string __varyingProperty: "horizontalOffset" + property variant __values: ["75.0", "0.0", "-75.0"] + function uninit() { checkerboard = false } + } + + DirectionalBlur { + width: size + height: size + source: butterfly + samples: 32 + length: 32 + property string __name: "DirectionalBlur" + property variant __properties: ["samples", "angle", "length"] + property string __varyingProperty: "angle" + property variant __values: ["0.0", "45.0", "90.0"] + function uninit() { checkerboard = false } + } + + DirectionalBlur { + width: size + height: size + source: butterfly + samples: 32 + property string __name: "DirectionalBlur" + property variant __properties: ["samples", "angle", "length"] + property string __varyingProperty: "length" + property variant __values: ["0.0", "32.0", "48.0"] + function uninit() { checkerboard = false } + } + + ZoomBlur { + width: size + height: size + source: butterfly + samples: 32 + length: 32 + property string __name: "ZoomBlur" + property variant __properties: ["samples", "length", "horizontalOffset", "verticalOffset"] + property string __varyingProperty: "horizontalOffset" + property variant __values: ["100.0", "0.0", "-100.0"] + function uninit() { checkerboard = false } + } + + ZoomBlur { + width: size + height: size + source: butterfly + samples: 32 + property string __name: "ZoomBlur" + property variant __properties: ["samples", "length", "horizontalOffset", "verticalOffset"] + property string __varyingProperty: "length" + property variant __values: ["0.0", "32.0", "48.0"] + function uninit() { checkerboard = false } + } + + Item { + id: theEnd + width: size + height: size + function init() { Qt.quit() } + } +} diff --git a/tools/pngdumper/pngdumper.cpp b/tools/pngdumper/pngdumper.cpp new file mode 100644 index 0000000..598eb25 --- /dev/null +++ b/tools/pngdumper/pngdumper.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "pngdumper.h" + +#include <QtDeclarative/qdeclarative.h> + +ItemCapturer::ItemCapturer(QQuickItem *parent): + QQuickItem(parent) +{ +} + +ItemCapturer::~ItemCapturer() +{ +} + +void ItemCapturer::grabItem(QQuickItem *item, QString filename) +{ + QImage img = canvas()->grabFrameBuffer(); + QQuickItem *rootItem = canvas()->rootItem(); + QRectF rectf = rootItem->mapRectFromItem(item, QRectF(0, 0, item->width(), item->height())); + QDir pwd = QDir().dirName(); + pwd.mkdir("output"); + img = img.copy(rectf.toRect()); + img.save("output/" + filename); +} + +void ItemCapturer::document(QString s) +{ + printf(s.toAscii().data()); +} diff --git a/tools/pngdumper/pngdumper.h b/tools/pngdumper/pngdumper.h new file mode 100644 index 0000000..b08befb --- /dev/null +++ b/tools/pngdumper/pngdumper.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ITEMCAPTURER_H +#define ITEMCAPTURER_H + +#include <QtQuick> + +class ItemCapturer : public QQuickItem +{ + Q_OBJECT + Q_DISABLE_COPY(ItemCapturer) + +public: + ItemCapturer(QQuickItem *parent = 0); + ~ItemCapturer(); + + Q_INVOKABLE void grabItem(QQuickItem *item, QString filename); + Q_INVOKABLE void document(QString s); +}; + +QML_DECLARE_TYPE(ItemCapturer) + +#endif // ITEMCAPTURER_H + diff --git a/tools/pngdumper/pngdumper.pro b/tools/pngdumper/pngdumper.pro new file mode 100644 index 0000000..1677049 --- /dev/null +++ b/tools/pngdumper/pngdumper.pro @@ -0,0 +1,45 @@ +TEMPLATE = lib +TARGET = pngdumper +QT += core quick +CONFIG += qt plugin + +TARGET = $$qtLibraryTarget($$TARGET) +uri = com.nokia.mt.pngdumper + +# Input +SOURCES += \ + pngdumper_plugin.cpp \ + pngdumper.cpp + +HEADERS += \ + pngdumper_plugin.h \ + pngdumper.h + +OTHER_FILES = qmldir \ + pngdumper.qml \ + ItemModel.qml + +!equals(_PRO_FILE_PWD_, $$OUT_PWD) { + copy_qmldir.target = $$OUT_PWD/qmldir + copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir + copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" + QMAKE_EXTRA_TARGETS += copy_qmldir + PRE_TARGETDEPS += $$copy_qmldir.target +} + +qmldir.files = qmldir +symbian { + TARGET.EPOCALLOWDLLDATA = 1 +} else:unix { + maemo5 | !isEmpty(MEEGO_VERSION_MAJOR) { + installPath = /usr/lib/qt4/imports/$$replace(uri, \\., /) + } else { + installPath = $$[QT_INSTALL_IMPORTS]/$$replace(uri, \\., /) + } + qmldir.path = $$installPath + target.path = $$installPath + INSTALLS += target qmldir +} + + + diff --git a/tools/pngdumper/pngdumper.qml b/tools/pngdumper/pngdumper.qml new file mode 100644 index 0000000..c3dab22 --- /dev/null +++ b/tools/pngdumper/pngdumper.qml @@ -0,0 +1,235 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import com.nokia.mt.pngdumper 1.0 + +Rectangle { + id: main + width: 300 + height: width + property real size: width + property real timerInterval: 200 + property color background: "white" + property bool checkerboard: false + color: background + + Gradient { + id: firstGradient + GradientStop { position: 0.000; color: Qt.rgba(1, 0, 0, 1) } + GradientStop { position: 0.167; color: Qt.rgba(1, 1, 0, 1) } + GradientStop { position: 0.333; color: Qt.rgba(0, 1, 0, 1) } + GradientStop { position: 0.500; color: Qt.rgba(0, 1, 1, 1) } + GradientStop { position: 0.667; color: Qt.rgba(0, 0, 1, 1) } + GradientStop { position: 0.833; color: Qt.rgba(1, 0, 1, 1) } + GradientStop { position: 1.000; color: Qt.rgba(1, 0, 0, 1) } + } + Gradient { + id: secondGradient + GradientStop { position: 0.0; color: "#F0F0F0" } + GradientStop { position: 0.5; color: "#000000" } + GradientStop { position: 1.0; color: "#F0F0F0" } + } + Gradient { + id: thirdGradient + GradientStop { position: 0.0; color: "#00000000" } + GradientStop { position: 1.0; color: "#FF000000" } + } + + ItemModel { + id: itemModel + } + + Item { + id: container + width: size + height: size + clip: true + + Image { + source: '../../tests/manual/testbed/images/checker.png' + smooth: true + anchors.fill: parent + fillMode: Image.Tile + visible: main.checkerboard + } + + ListView { + id: list + width: size + height: size + model: itemModel + highlightMoveDuration: 1 + spacing: size + anchors.centerIn: parent + cacheBuffer: size + } + } + + // Sources + Image { + id: bug + source: "../../tests/manual/testbed/images/bug.jpg" + smooth: true + width: size + height: width + fillMode: Image.PreserveAspectFit + visible: false + } + ShaderEffectSource { + id: butterfly + smooth: true + width: size + height: width + visible: false + sourceItem: + Image { + //id: butterfly + source: "../../tests/manual/testbed/images/butterfly.png" + smooth: true + width: size + height: width + fillMode: Image.PreserveAspectFit + visible: false + } + } + Image { + id: fog + source: "../../tests/manual/testbed/images/fog.png" + smooth: true + width: size + height: width + fillMode: Image.PreserveAspectFit + visible: false + } + Rectangle { + id: rect + width: size / 2 + height: size / 2 + anchors.centerIn: container + color: "#dde4ff" + visible: false + } + Rectangle { + id: displacementMapSource + visible: false + color: Qt.rgba(0.5, 0.5, 1.0, 1.0) + smooth: true + anchors.fill: bug + Image { + id: di + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + sourceSize: Qt.size(128, 128) + source: "../../tests/manual/testbed/images/displacementmap.png" + smooth: true + } + } + + ItemCapturer { + id: capturer + } + + Timer { + interval: 1000 + running: true + onTriggered: { + // Ugly workaround for listview not updating itself + list.contentX = 1 + eval("list.currentItem."+list.currentItem.__varyingProperty+"=list.currentItem.__values[0]"); + timer.running = true + list.contentX = 0 + } + } + + Timer { + id: timer + interval: timerInterval + repeat: true + property int i: 0 + + onTriggered: { + var value = list.currentItem.__values[i]; + var filename = list.currentItem.__name + "_" + list.currentItem.__varyingProperty + (i + 1) + ".png" + filename = filename.replace(/\"/g,"") + //filename = filename.toLowerCase(); + capturer.grabItem(container, filename) + //console.log(filename) + + if (i >= list.currentItem.__values.length - 1) { + capturer.document("\\table\n") + capturer.document("\\header\n") + capturer.document("\\o Output examples with different " + list.currentItem.__varyingProperty + " values\n") + capturer.document("\\o\n\\o\n\\row\n") + var ii = 0 + for(ii = 0; ii < list.currentItem.__values.length; ii++) { + filename = list.currentItem.__name + "_" + list.currentItem.__varyingProperty + (ii + 1) + ".png" + filename = filename.replace(/\"/g,"") + //filename = filename.toLowerCase(); + capturer.document(" \\o \\image " + filename + "\n") + } + capturer.document("\\row\n") + for(ii = 0; ii < list.currentItem.__values.length; ii++) { + capturer.document(" \\o \\bold { " + list.currentItem.__varyingProperty + ": " + list.currentItem.__values[ii] + " }\n") + } + for (var p = 0; p < list.currentItem.__properties.length; p++) { + if (list.currentItem.__properties[p] == list.currentItem.__varyingProperty) continue; + + capturer.document("\\row\n") + + for(ii = 0; ii < list.currentItem.__values.length; ii++) { + capturer.document(" \\o \\l " + list.currentItem.__properties[p] + ": " + eval("list.currentItem."+list.currentItem.__properties[p]) + "\n") + } + } + capturer.document("\\endtable\n") + + if (list.currentIndex < list.count-1) { + i = 0 + if (list.currentItem.uninit != undefined) list.currentItem.uninit() + list.currentIndex++ + list.positionViewAtIndex(list.currentIndex, ListView.Center) + if (list.currentItem.init != undefined) list.currentItem.init() + } else Qt.quit() + } else i++ + + eval("list.currentItem."+list.currentItem.__varyingProperty+"=list.currentItem.__values[i]"); + } + } +} diff --git a/tools/pngdumper/pngdumper_plugin.cpp b/tools/pngdumper/pngdumper_plugin.cpp new file mode 100644 index 0000000..4f706c1 --- /dev/null +++ b/tools/pngdumper/pngdumper_plugin.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "pngdumper_plugin.h" +#include "pngdumper.h" + +#include <QtDeclarative/qdeclarative.h> + +void ItemcapturerPlugin::registerTypes(const char *uri) +{ + qmlRegisterType<ItemCapturer>(uri, 1, 0, "ItemCapturer"); +} + +Q_EXPORT_PLUGIN2(Itemcapturer, ItemcapturerPlugin) + diff --git a/tools/pngdumper/pngdumper_plugin.h b/tools/pngdumper/pngdumper_plugin.h new file mode 100644 index 0000000..524bee6 --- /dev/null +++ b/tools/pngdumper/pngdumper_plugin.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Graphical Effects module. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ITEMCAPTURER_PLUGIN_H +#define ITEMCAPTURER_PLUGIN_H + +#include <QtDeclarative/QDeclarativeExtensionPlugin> + +class ItemcapturerPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT + +public: + void registerTypes(const char *uri); +}; + +#endif // ITEMCAPTURER_PLUGIN_H + diff --git a/tools/pngdumper/qmldir b/tools/pngdumper/qmldir new file mode 100644 index 0000000..a4519f1 --- /dev/null +++ b/tools/pngdumper/qmldir @@ -0,0 +1,2 @@ +plugin pngdumper + |