From 2423321be7a8ef012ff7ee9d07d789ddfb8c4d6b Mon Sep 17 00:00:00 2001 From: Bogdan Cuza Date: Tue, 16 Dec 2014 20:35:40 +0200 Subject: [PATCH 1/6] Create Image.qml It includes a color averaging function --- modules/Material/Extras/Image.qml | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 modules/Material/Extras/Image.qml diff --git a/modules/Material/Extras/Image.qml b/modules/Material/Extras/Image.qml new file mode 100644 index 0000000..0de3c87 --- /dev/null +++ b/modules/Material/Extras/Image.qml @@ -0,0 +1,37 @@ +import QtQuick 2.0 + +Image { + id: image + + property color averageColor + + Canvas { + id: canvas + + opacity: 0 + + onAvailableChanged: { + var imgSource = image.source; + canvas.loadImage(String(imgSource)); + var context = canvas.getContext("2d"), + pixelInterval = 5, + count = 0, + i = -4, + rgba = {"r": 0, "g": 0, "b": 0, "a": 0}, + data = context.createImageData(String(imgSource)).data, + length = data.length; + while ((i += pixelInterval * 4) < length) { + count++; + rgba.r += data[i]; + rgba.g += data[i+1]; + rgba.b += data[i+2]; + rgba.a += data[i+3]; + }; + rgba.r = Math.floor(rgba.r/count); + rgba.g = Math.floor(rgba.g/count); + rgba.b = Math.floor(rgba.b/count); + rgba.a = Math.floor(rgba.a/count); + image.averageColor = Qt.rgba(rgba.r/255, rgba.g/255, rgba.b/255, rgba.a/255); + } + } +} From 8427c43a1ce49841155c939661fd6b5309ea1f38 Mon Sep 17 00:00:00 2001 From: Bogdan Cuza Date: Tue, 30 Dec 2014 15:59:10 +0200 Subject: [PATCH 2/6] Update CircleImage.qml --- modules/Material/Extras/CircleImage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Material/Extras/CircleImage.qml b/modules/Material/Extras/CircleImage.qml index 8353049..55e2161 100644 --- a/modules/Material/Extras/CircleImage.qml +++ b/modules/Material/Extras/CircleImage.qml @@ -39,7 +39,7 @@ Item { Image { id: mask - source: Qt.resolvedUrl("circle.png") + source: Qt.resolvedUrl("images/circle.png") anchors.fill: image smooth: true visible: false From 77236320aab6c3347e68c35427ab09dd42398098 Mon Sep 17 00:00:00 2001 From: Bogdan Cuza Date: Tue, 30 Dec 2014 16:53:11 +0200 Subject: [PATCH 3/6] Update qmldir --- modules/Material/Extras/qmldir | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/Material/Extras/qmldir b/modules/Material/Extras/qmldir index 2b28eee..5169cbe 100644 --- a/modules/Material/Extras/qmldir +++ b/modules/Material/Extras/qmldir @@ -1,6 +1,7 @@ module Material.Extras CircleImage 0.1 CircleImage.qml +Image 0.1 Image.qml ColumnFlow 0.1 ColumnFlow.qml Document 0.1 Document.qml Object 0.1 Object.qml From efc50d781e60a69eed94196de7c80acf77745967 Mon Sep 17 00:00:00 2001 From: Bogdan Cuza Date: Tue, 30 Dec 2014 17:18:53 +0200 Subject: [PATCH 4/6] Average color for CircleImage --- modules/Material/Extras/CircleImage.qml | 6 ++++-- modules/Material/Extras/Image.qml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/Material/Extras/CircleImage.qml b/modules/Material/Extras/CircleImage.qml index 55e2161..cf193fb 100644 --- a/modules/Material/Extras/CircleImage.qml +++ b/modules/Material/Extras/CircleImage.qml @@ -18,6 +18,7 @@ */ import QtQuick 2.3 +import Material.Extras 0.1 as Extras import QtGraphicalEffects 1.0 Item { @@ -25,11 +26,12 @@ Item { property alias source: image.source property alias status: image.status + property alias averageColor: image.averageColor width: image.implicitWidth height: image.implicitHeight - Image { + Extras.Image { id: image anchors.fill: parent smooth: true @@ -37,7 +39,7 @@ Item { mipmap: true } - Image { + Extras.Image { id: mask source: Qt.resolvedUrl("images/circle.png") anchors.fill: image diff --git a/modules/Material/Extras/Image.qml b/modules/Material/Extras/Image.qml index 0de3c87..f4519ab 100644 --- a/modules/Material/Extras/Image.qml +++ b/modules/Material/Extras/Image.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.3 Image { id: image From 184ce4cd3682ebae4b5964f9f924673d7df51462 Mon Sep 17 00:00:00 2001 From: Bogdan Cuza Date: Mon, 5 Jan 2015 20:50:59 +0200 Subject: [PATCH 5/6] Add slack support --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index bf63053..31659ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,3 +11,6 @@ install: script: - qmake - make check + +notifications: + slack: papyros:Dfl04xnx2RdvHLiue5Lm7v5R From 6d1f003aad107073dc87df5309d232d162e55710 Mon Sep 17 00:00:00 2001 From: Michael Spencer Date: Wed, 7 Jan 2015 13:33:11 -0600 Subject: [PATCH 6/6] Rename to Papyros --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1fa0f31..aa16e94 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ QML Extras ========== -[![Build Status](https://travis-ci.org/quantum-os/qml-extras.svg)](https://travis-ci.org/quantum-os/qml-extras) +[![Build Status](https://travis-ci.org/papyros/qml-extras.svg)](https://travis-ci.org/papyros/qml-extras) Extra types and utilities to make QML even more awesome