From eb6af63f6105d207458dc38ee42b6ecb5fc641cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaj=20Gr=C3=B6nholm?= Date: Wed, 23 Aug 2023 07:58:39 +0300 Subject: Add CurveRenderer item into shape antialiasing example CurveRenderer has built-in antialiasing supports, so compare it here to MSAA and SSAA. Task-number: QTBUG-104122 Pick-to: 6.6 Change-Id: I207ab770cae052b195e9da8802dc594a91ce713b Reviewed-by: Eskil Abrahamsen Blomfeldt --- examples/quick/shapes/main.qml | 2 +- examples/quick/shapes/sampling.qml | 50 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/quick/shapes/main.qml b/examples/quick/shapes/main.qml index 90fcbd28f0..7dc644be1d 100644 --- a/examples/quick/shapes/main.qml +++ b/examples/quick/shapes/main.qml @@ -12,7 +12,7 @@ Item { Component.onCompleted: { addExample(qsTr("Shape Gallery"), qsTr("Simple path rendering examples"), Qt.resolvedUrl("shapegallery.qml")) addExample(qsTr("Interactive Shape"), qsTr("Dynamic, interactive path rendering examples"), Qt.resolvedUrl("interactive.qml")) - addExample(qsTr("Super- and multisampling"), qsTr("Improving quality"), Qt.resolvedUrl("sampling.qml")) + addExample(qsTr("Anti-aliasing"), qsTr("Improving quality"), Qt.resolvedUrl("sampling.qml")) addExample(qsTr("Clip My Tiger!"), qsTr("Clip examples, a.k.a. What Not To Do"), Qt.resolvedUrl("clippedtigers.qml")) } } diff --git a/examples/quick/shapes/sampling.qml b/examples/quick/shapes/sampling.qml index f58815e813..27515b6722 100644 --- a/examples/quick/shapes/sampling.qml +++ b/examples/quick/shapes/sampling.qml @@ -171,6 +171,56 @@ Rectangle { height: 50 scale: 2 + ShapePath { + strokeColor: "green" + NumberAnimation on strokeWidth { + from: 1 + to: 20 + duration: 5000 + } + fillColor: "transparent" + capStyle: ShapePath.RoundCap + + startX: 40 + startY: 30 + PathQuad { + x: 50 + y: 80 + controlX: 0 + controlY: 80 + } + PathLine { + x: 150 + y: 80 + } + PathQuad { + x: 160 + y: 30 + controlX: 200 + controlY: 80 + } + } + } + } + Text { + text: qsTr("CurveRenderer") + } + + // Now let's use CurveRenderer with built-in antialiasing support. + Rectangle { + color: "lightGray" + width: 400 + height: 200 + + Shape { + x: 30 + y: 20 + width: 50 + height: 50 + scale: 2 + preferredRendererType: Shape.CurveRenderer + antialiasing: true + ShapePath { strokeColor: "green" NumberAnimation on strokeWidth { -- cgit v1.2.3