From 80a19c1da873ea66c528786d381fb42ae7019ca9 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 1 Dec 2016 14:33:11 +0100 Subject: [PATCH] feat(ui/modules/Common/Image/RoundedImage): supports color mask --- tests/resources.qrc | 2 ++ tests/src/app/App.cpp | 4 ++++ tests/ui/modules/Common/Image/RoundedImage.qml | 12 +++++++++--- .../Styles/Animations/CaterpillarAnimationStyle.qml | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/resources.qrc b/tests/resources.qrc index a61a34a38..757310163 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -4,9 +4,11 @@ assets/images/attachment_normal.svg assets/images/attachment_pressed.svg assets/images/auto_answer.svg + assets/images/a-v-a-t-a-r-120120@3x.png assets/images/call_hovered.svg assets/images/call_normal.svg assets/images/call_pressed.svg + assets/images/cat.jpg assets/images/chat_error.svg assets/images/chat_hovered.svg assets/images/chat_normal.svg diff --git a/tests/src/app/App.cpp b/tests/src/app/App.cpp index 79790f180..36592450c 100644 --- a/tests/src/app/App.cpp +++ b/tests/src/app/App.cpp @@ -99,6 +99,10 @@ void App::registerTypes () { ); // Register models. + qmlRegisterUncreatableType( + "Linphone", 1, 0, "ContactModel", "ContactModel is uncreatable" + ); + ContactsListProxyModel::initContactsListModel(new ContactsListModel()); qmlRegisterType("Linphone", 1, 0, "ContactsListProxyModel"); diff --git a/tests/ui/modules/Common/Image/RoundedImage.qml b/tests/ui/modules/Common/Image/RoundedImage.qml index 85caeaa17..d07435865 100644 --- a/tests/ui/modules/Common/Image/RoundedImage.qml +++ b/tests/ui/modules/Common/Image/RoundedImage.qml @@ -4,6 +4,8 @@ import QtQuick 2.7 Item { property alias source: image.source + property color colorMask: '#00000000' + // vec4(0.812, 0.843, 0.866, 1.0) 0.9 Item { id: imageContainer @@ -26,17 +28,21 @@ Item { layer { effect: ShaderEffect { property var image: imageContainer + property var color: colorMask fragmentShader: ' uniform lowp sampler2D image; uniform lowp sampler2D mask; - uniform lowp float qt_Opacity; + uniform lowp vec4 color; + uniform lowp float qt_Opacity; varying highp vec2 qt_TexCoord0; void main () { - gl_FragColor = texture2D(image, qt_TexCoord0) * - texture2D(mask, qt_TexCoord0).a * + vec4 tex = texture2D(image, qt_TexCoord0); + + gl_FragColor = mix(tex, vec4(color.rgb, 1.0), color.a) * + texture2D(mask, qt_TexCoord0) * qt_Opacity; } ' diff --git a/tests/ui/modules/Common/Styles/Animations/CaterpillarAnimationStyle.qml b/tests/ui/modules/Common/Styles/Animations/CaterpillarAnimationStyle.qml index 8032b2250..c61079c2e 100644 --- a/tests/ui/modules/Common/Styles/Animations/CaterpillarAnimationStyle.qml +++ b/tests/ui/modules/Common/Styles/Animations/CaterpillarAnimationStyle.qml @@ -15,7 +15,7 @@ QtObject { } property QtObject sphere: QtObject { - property color color: Colors.r + property color color: Colors.x property int size: 10 } }