exe 依赖添加

This commit is contained in:
Neo
2026-01-27 23:19:54 +08:00
parent 8b1200383e
commit ba00654ac5
3443 changed files with 754994 additions and 51 deletions

View File

@@ -0,0 +1,150 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "private/qquickboundaryrule_p.h"
lineNumber: 29
name: "QQuickBoundaryRule"
accessSemantics: "reference"
prototype: "QObject"
interfaces: ["QQmlParserStatus", "QQmlPropertyValueInterceptor"]
exports: [
"Qt.labs.animation/BoundaryRule 1.0",
"Qt.labs.animation/BoundaryRule 6.0"
]
exportMetaObjectRevisions: [256, 1536]
Enum {
name: "OvershootFilter"
lineNumber: 51
values: ["None", "Peak"]
}
Property {
name: "enabled"
type: "bool"
read: "enabled"
write: "setEnabled"
notify: "enabledChanged"
index: 0
lineNumber: 36
isFinal: true
}
Property {
name: "minimum"
type: "double"
read: "minimum"
write: "setMinimum"
notify: "minimumChanged"
index: 1
lineNumber: 37
isFinal: true
}
Property {
name: "minimumOvershoot"
type: "double"
read: "minimumOvershoot"
write: "setMinimumOvershoot"
notify: "minimumOvershootChanged"
index: 2
lineNumber: 38
isFinal: true
}
Property {
name: "maximum"
type: "double"
read: "maximum"
write: "setMaximum"
notify: "maximumChanged"
index: 3
lineNumber: 39
isFinal: true
}
Property {
name: "maximumOvershoot"
type: "double"
read: "maximumOvershoot"
write: "setMaximumOvershoot"
notify: "maximumOvershootChanged"
index: 4
lineNumber: 40
isFinal: true
}
Property {
name: "overshootScale"
type: "double"
read: "overshootScale"
write: "setOvershootScale"
notify: "overshootScaleChanged"
index: 5
lineNumber: 41
isFinal: true
}
Property {
name: "currentOvershoot"
type: "double"
read: "currentOvershoot"
notify: "currentOvershootChanged"
index: 6
lineNumber: 42
isReadonly: true
isFinal: true
}
Property {
name: "peakOvershoot"
type: "double"
read: "peakOvershoot"
notify: "peakOvershootChanged"
index: 7
lineNumber: 43
isReadonly: true
isFinal: true
}
Property {
name: "overshootFilter"
type: "OvershootFilter"
read: "overshootFilter"
write: "setOvershootFilter"
notify: "overshootFilterChanged"
index: 8
lineNumber: 44
isFinal: true
}
Property {
name: "easing"
type: "QEasingCurve"
read: "easing"
write: "setEasing"
notify: "easingChanged"
index: 9
lineNumber: 45
isFinal: true
}
Property {
name: "returnDuration"
type: "int"
read: "returnDuration"
write: "setReturnDuration"
notify: "returnDurationChanged"
index: 10
lineNumber: 46
isFinal: true
}
Signal { name: "enabledChanged"; lineNumber: 98 }
Signal { name: "minimumChanged"; lineNumber: 99 }
Signal { name: "minimumOvershootChanged"; lineNumber: 100 }
Signal { name: "maximumChanged"; lineNumber: 101 }
Signal { name: "maximumOvershootChanged"; lineNumber: 102 }
Signal { name: "overshootScaleChanged"; lineNumber: 103 }
Signal { name: "currentOvershootChanged"; lineNumber: 104 }
Signal { name: "peakOvershootChanged"; lineNumber: 105 }
Signal { name: "overshootFilterChanged"; lineNumber: 106 }
Signal { name: "easingChanged"; lineNumber: 107 }
Signal { name: "returnDurationChanged"; lineNumber: 108 }
Signal { name: "returnedToBounds"; lineNumber: 109 }
Method { name: "returnToBounds"; type: "bool"; lineNumber: 85 }
}
}

View File

@@ -0,0 +1,9 @@
module Qt.labs.animation
linktarget Qt6::labsanimationplugin
optional plugin labsanimationplugin
classname QtLabsAnimationPlugin
typeinfo plugins.qmltypes
depends QtQml
prefer :/qt-project.org/imports/Qt/labs/animation/
depends QtQuick

View File

@@ -0,0 +1,270 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "private/fileproperty_p.h"
lineNumber: 26
name: "FileProperty"
accessSemantics: "value"
}
Component {
file: "private/qquickfolderlistmodel_p.h"
lineNumber: 34
name: "QQuickFolderListModel"
accessSemantics: "reference"
prototype: "QAbstractListModel"
interfaces: ["QQmlParserStatus"]
exports: [
"Qt.labs.folderlistmodel/FolderListModel 1.0",
"Qt.labs.folderlistmodel/FolderListModel 2.1",
"Qt.labs.folderlistmodel/FolderListModel 2.2",
"Qt.labs.folderlistmodel/FolderListModel 2.11",
"Qt.labs.folderlistmodel/FolderListModel 2.12",
"Qt.labs.folderlistmodel/FolderListModel 6.0",
"Qt.labs.folderlistmodel/FolderListModel 6.4"
]
exportMetaObjectRevisions: [256, 513, 514, 523, 524, 1536, 1540]
Enum {
name: "SortField"
lineNumber: 99
values: ["Unsorted", "Name", "Time", "Size", "Type"]
}
Enum {
name: "Status"
lineNumber: 122
values: ["Null", "Ready", "Loading"]
}
Property {
name: "folder"
type: "QUrl"
read: "folder"
write: "setFolder"
notify: "folderChanged"
index: 0
lineNumber: 41
isFinal: true
}
Property {
name: "rootFolder"
type: "QUrl"
read: "rootFolder"
write: "setRootFolder"
notify: "rootFolderChanged"
index: 1
lineNumber: 42
isFinal: true
}
Property {
name: "parentFolder"
type: "QUrl"
read: "parentFolder"
notify: "folderChanged"
index: 2
lineNumber: 43
isReadonly: true
isFinal: true
}
Property {
name: "nameFilters"
type: "QStringList"
read: "nameFilters"
write: "setNameFilters"
notify: "nameFilterChanged"
index: 3
lineNumber: 44
isFinal: true
}
Property {
name: "sortField"
type: "SortField"
read: "sortField"
write: "setSortField"
notify: "sortFieldChanged"
index: 4
lineNumber: 45
isFinal: true
}
Property {
name: "sortReversed"
type: "bool"
read: "sortReversed"
write: "setSortReversed"
notify: "sortReversedChanged"
index: 5
lineNumber: 46
isFinal: true
}
Property {
name: "showFiles"
revision: 513
type: "bool"
read: "showFiles"
write: "setShowFiles"
notify: "showFilesChanged"
index: 6
lineNumber: 47
isFinal: true
}
Property {
name: "showDirs"
type: "bool"
read: "showDirs"
write: "setShowDirs"
notify: "showDirsChanged"
index: 7
lineNumber: 48
isFinal: true
}
Property {
name: "showDirsFirst"
type: "bool"
read: "showDirsFirst"
write: "setShowDirsFirst"
notify: "showDirsFirstChanged"
index: 8
lineNumber: 49
isFinal: true
}
Property {
name: "showDotAndDotDot"
type: "bool"
read: "showDotAndDotDot"
write: "setShowDotAndDotDot"
notify: "showDotAndDotDotChanged"
index: 9
lineNumber: 50
isFinal: true
}
Property {
name: "showHidden"
revision: 513
type: "bool"
read: "showHidden"
write: "setShowHidden"
notify: "showHiddenChanged"
index: 10
lineNumber: 51
isFinal: true
}
Property {
name: "showOnlyReadable"
type: "bool"
read: "showOnlyReadable"
write: "setShowOnlyReadable"
notify: "showOnlyReadableChanged"
index: 11
lineNumber: 52
isFinal: true
}
Property {
name: "caseSensitive"
revision: 514
type: "bool"
read: "caseSensitive"
write: "setCaseSensitive"
notify: "caseSensitiveChanged"
index: 12
lineNumber: 53
isFinal: true
}
Property {
name: "count"
type: "int"
read: "count"
notify: "countChanged"
index: 13
lineNumber: 54
isReadonly: true
isFinal: true
}
Property {
name: "status"
revision: 523
type: "Status"
read: "status"
notify: "statusChanged"
index: 14
lineNumber: 55
isReadonly: true
isFinal: true
}
Property {
name: "sortCaseSensitive"
revision: 524
type: "bool"
read: "sortCaseSensitive"
write: "setSortCaseSensitive"
notify: "sortCaseSensitiveChanged"
index: 15
lineNumber: 56
isFinal: true
}
Signal { name: "folderChanged"; lineNumber: 142 }
Signal { name: "rowCountChanged"; isMethodConstant: true; lineNumber: 143 }
Signal { name: "rootFolderChanged"; lineNumber: 144 }
Signal { name: "nameFilterChanged"; lineNumber: 145 }
Signal { name: "sortFieldChanged"; lineNumber: 146 }
Signal { name: "sortReversedChanged"; lineNumber: 147 }
Signal { name: "showFilesChanged"; lineNumber: 148 }
Signal { name: "showDirsChanged"; lineNumber: 149 }
Signal { name: "showDirsFirstChanged"; lineNumber: 150 }
Signal { name: "showDotAndDotDotChanged"; lineNumber: 151 }
Signal { name: "showHiddenChanged"; lineNumber: 152 }
Signal { name: "showOnlyReadableChanged"; lineNumber: 153 }
Signal { name: "caseSensitiveChanged"; lineNumber: 154 }
Signal { name: "sortCaseSensitiveChanged"; lineNumber: 155 }
Signal { name: "countChanged"; revision: 513; isMethodConstant: true; lineNumber: 157 }
Signal { name: "statusChanged"; revision: 523; lineNumber: 158 }
Method {
name: "_q_directoryChanged"
lineNumber: 170
Parameter { name: "directory"; type: "QString" }
Parameter { name: "list"; type: "FileProperty"; isList: true }
}
Method {
name: "_q_directoryUpdated"
lineNumber: 171
Parameter { name: "directory"; type: "QString" }
Parameter { name: "list"; type: "FileProperty"; isList: true }
Parameter { name: "fromIndex"; type: "int" }
Parameter { name: "toIndex"; type: "int" }
}
Method {
name: "_q_sortFinished"
lineNumber: 172
Parameter { name: "list"; type: "FileProperty"; isList: true }
}
Method {
name: "_q_statusChanged"
lineNumber: 173
Parameter { name: "s"; type: "QQuickFolderListModel::Status" }
}
Method {
name: "isFolder"
type: "bool"
isMethodConstant: true
lineNumber: 129
Parameter { name: "index"; type: "int" }
}
Method {
name: "get"
type: "QVariant"
isMethodConstant: true
lineNumber: 130
Parameter { name: "idx"; type: "int" }
Parameter { name: "property"; type: "QString" }
}
Method {
name: "indexOf"
type: "int"
isMethodConstant: true
lineNumber: 131
Parameter { name: "file"; type: "QUrl" }
}
}
}

View File

@@ -0,0 +1,8 @@
module Qt.labs.folderlistmodel
linktarget Qt6::qmlfolderlistmodelplugin
optional plugin qmlfolderlistmodelplugin
classname QmlFolderListModelPlugin
typeinfo plugins.qmltypes
depends QtQml.Models auto
prefer :/qt-project.org/imports/Qt/labs/folderlistmodel/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
module Qt.labs.platform
linktarget Qt6::LabsPlatformplugin
optional plugin labsplatformplugin
classname QtLabsPlatformPlugin
typeinfo plugins.qmltypes
depends QtQuick
depends QtQuick.Templates
prefer :/qt-project.org/imports/Qt/labs/platform/
depends QtQuick

View File

@@ -0,0 +1,504 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "private/qqmlabstractcolumnmodel_p.h"
lineNumber: 25
name: "QQmlAbstractColumnModel"
accessSemantics: "reference"
defaultProperty: "columns"
prototype: "QAbstractItemModel"
interfaces: ["QQmlParserStatus"]
Property {
name: "columnCount"
type: "int"
read: "columnCount"
notify: "columnCountChanged"
index: 0
lineNumber: 29
isReadonly: true
isFinal: true
}
Property {
name: "columns"
type: "QQmlTableModelColumn"
isList: true
read: "columns"
index: 1
lineNumber: 30
isReadonly: true
isFinal: true
isPropertyConstant: true
}
Signal { name: "columnCountChanged"; lineNumber: 58 }
Signal { name: "rowsChanged"; lineNumber: 59 }
Method {
name: "data"
type: "QVariant"
isMethodConstant: true
lineNumber: 49
Parameter { name: "index"; type: "QModelIndex" }
Parameter { name: "role"; type: "QString" }
}
Method {
name: "data"
type: "QVariant"
isMethodConstant: true
lineNumber: 50
Parameter { name: "index"; type: "QModelIndex" }
Parameter { name: "role"; type: "int" }
}
Method {
name: "data"
type: "QVariant"
isCloned: true
isMethodConstant: true
lineNumber: 50
Parameter { name: "index"; type: "QModelIndex" }
}
Method {
name: "setData"
type: "bool"
lineNumber: 51
Parameter { name: "index"; type: "QModelIndex" }
Parameter { name: "value"; type: "QVariant" }
Parameter { name: "role"; type: "QString" }
}
Method {
name: "setData"
type: "bool"
lineNumber: 52
Parameter { name: "index"; type: "QModelIndex" }
Parameter { name: "value"; type: "QVariant" }
Parameter { name: "role"; type: "int" }
}
Method {
name: "setData"
type: "bool"
isCloned: true
lineNumber: 52
Parameter { name: "index"; type: "QModelIndex" }
Parameter { name: "value"; type: "QVariant" }
}
}
Component {
file: "private/qqmldelegatechooser_p.h"
lineNumber: 36
name: "QQmlDelegateChoice"
accessSemantics: "reference"
defaultProperty: "delegate"
prototype: "QObject"
exports: [
"Qt.labs.qmlmodels/DelegateChoice 1.0",
"Qt.labs.qmlmodels/DelegateChoice 6.0"
]
exportMetaObjectRevisions: [256, 1536]
Property {
name: "roleValue"
type: "QVariant"
read: "roleValue"
write: "setRoleValue"
notify: "roleValueChanged"
index: 0
lineNumber: 32
isFinal: true
}
Property {
name: "row"
type: "int"
read: "row"
write: "setRow"
notify: "rowChanged"
index: 1
lineNumber: 33
isFinal: true
}
Property {
name: "index"
type: "int"
read: "row"
write: "setRow"
notify: "indexChanged"
index: 2
lineNumber: 34
isFinal: true
}
Property {
name: "column"
type: "int"
read: "column"
write: "setColumn"
notify: "columnChanged"
index: 3
lineNumber: 35
isFinal: true
}
Property {
name: "delegate"
type: "QQmlComponent"
isPointer: true
read: "delegate"
write: "setDelegate"
notify: "delegateChanged"
index: 4
lineNumber: 36
isFinal: true
}
Signal { name: "roleValueChanged"; lineNumber: 57 }
Signal { name: "rowChanged"; lineNumber: 58 }
Signal { name: "indexChanged"; lineNumber: 59 }
Signal { name: "columnChanged"; lineNumber: 60 }
Signal { name: "delegateChanged"; lineNumber: 61 }
Signal { name: "changed"; lineNumber: 62 }
}
Component {
file: "private/qqmldelegatechooser_p.h"
lineNumber: 28
name: "QQmlDelegateChooser"
accessSemantics: "reference"
defaultProperty: "choices"
prototype: "QQmlAbstractDelegateComponent"
exports: [
"Qt.labs.qmlmodels/DelegateChooser 1.0",
"Qt.labs.qmlmodels/DelegateChooser 2.0",
"Qt.labs.qmlmodels/DelegateChooser 6.0"
]
exportMetaObjectRevisions: [256, 512, 1536]
Property {
name: "role"
type: "QString"
read: "role"
write: "setRole"
notify: "roleChanged"
index: 0
lineNumber: 74
isFinal: true
}
Property {
name: "choices"
type: "QQmlDelegateChoice"
isList: true
read: "choices"
index: 1
lineNumber: 75
isReadonly: true
isFinal: true
isPropertyConstant: true
}
Signal { name: "roleChanged"; lineNumber: 96 }
}
Component {
file: "private/qqmltablemodel_p.h"
lineNumber: 32
name: "QQmlTableModel"
accessSemantics: "reference"
defaultProperty: "columns"
prototype: "QQmlAbstractColumnModel"
exports: [
"Qt.labs.qmlmodels/TableModel 1.0",
"Qt.labs.qmlmodels/TableModel 6.0",
"Qt.labs.qmlmodels/TableModel 6.4"
]
exportMetaObjectRevisions: [256, 1536, 1540]
Property {
name: "rowCount"
type: "int"
read: "rowCount"
notify: "rowCountChanged"
index: 0
lineNumber: 35
isReadonly: true
isFinal: true
}
Property {
name: "rows"
type: "QVariant"
read: "rows"
write: "setRows"
notify: "rowsChanged"
index: 1
lineNumber: 36
isFinal: true
}
Signal { name: "rowCountChanged"; lineNumber: 64 }
Method {
name: "appendRow"
lineNumber: 49
Parameter { name: "row"; type: "QVariant" }
}
Method { name: "clear"; lineNumber: 50 }
Method {
name: "getRow"
type: "QVariant"
lineNumber: 51
Parameter { name: "rowIndex"; type: "int" }
}
Method {
name: "insertRow"
lineNumber: 52
Parameter { name: "rowIndex"; type: "int" }
Parameter { name: "row"; type: "QVariant" }
}
Method {
name: "moveRow"
lineNumber: 53
Parameter { name: "fromRowIndex"; type: "int" }
Parameter { name: "toRowIndex"; type: "int" }
Parameter { name: "rows"; type: "int" }
}
Method {
name: "moveRow"
isCloned: true
lineNumber: 53
Parameter { name: "fromRowIndex"; type: "int" }
Parameter { name: "toRowIndex"; type: "int" }
}
Method {
name: "removeRow"
lineNumber: 54
Parameter { name: "rowIndex"; type: "int" }
Parameter { name: "rows"; type: "int" }
}
Method {
name: "removeRow"
isCloned: true
lineNumber: 54
Parameter { name: "rowIndex"; type: "int" }
}
Method {
name: "setRow"
lineNumber: 55
Parameter { name: "rowIndex"; type: "int" }
Parameter { name: "row"; type: "QVariant" }
}
}
Component {
file: "private/qqmltablemodelcolumn_p.h"
lineNumber: 30
name: "QQmlTableModelColumn"
accessSemantics: "reference"
prototype: "QObject"
exports: [
"Qt.labs.qmlmodels/TableModelColumn 1.0",
"Qt.labs.qmlmodels/TableModelColumn 6.0"
]
exportMetaObjectRevisions: [256, 1536]
Property {
name: "display"
type: "QJSValue"
read: "display"
write: "setDisplay"
notify: "displayChanged"
index: 0
lineNumber: 33
isFinal: true
}
Property {
name: "decoration"
type: "QJSValue"
read: "decoration"
write: "setDecoration"
notify: "decorationChanged"
index: 1
lineNumber: 34
isFinal: true
}
Property {
name: "edit"
type: "QJSValue"
read: "edit"
write: "setEdit"
notify: "editChanged"
index: 2
lineNumber: 35
isFinal: true
}
Property {
name: "toolTip"
type: "QJSValue"
read: "toolTip"
write: "setToolTip"
notify: "toolTipChanged"
index: 3
lineNumber: 36
isFinal: true
}
Property {
name: "statusTip"
type: "QJSValue"
read: "statusTip"
write: "setStatusTip"
notify: "statusTipChanged"
index: 4
lineNumber: 37
isFinal: true
}
Property {
name: "whatsThis"
type: "QJSValue"
read: "whatsThis"
write: "setWhatsThis"
notify: "whatsThisChanged"
index: 5
lineNumber: 38
isFinal: true
}
Property {
name: "font"
type: "QJSValue"
read: "font"
write: "setFont"
notify: "fontChanged"
index: 6
lineNumber: 40
isFinal: true
}
Property {
name: "textAlignment"
type: "QJSValue"
read: "textAlignment"
write: "setTextAlignment"
notify: "textAlignmentChanged"
index: 7
lineNumber: 41
isFinal: true
}
Property {
name: "background"
type: "QJSValue"
read: "background"
write: "setBackground"
notify: "backgroundChanged"
index: 8
lineNumber: 42
isFinal: true
}
Property {
name: "foreground"
type: "QJSValue"
read: "foreground"
write: "setForeground"
notify: "foregroundChanged"
index: 9
lineNumber: 43
isFinal: true
}
Property {
name: "checkState"
type: "QJSValue"
read: "checkState"
write: "setCheckState"
notify: "checkStateChanged"
index: 10
lineNumber: 44
isFinal: true
}
Property {
name: "accessibleText"
type: "QJSValue"
read: "accessibleText"
write: "setAccessibleText"
notify: "accessibleTextChanged"
index: 11
lineNumber: 46
isFinal: true
}
Property {
name: "accessibleDescription"
type: "QJSValue"
read: "accessibleDescription"
write: "setAccessibleDescription"
notify: "accessibleDescriptionChanged"
index: 12
lineNumber: 47
isFinal: true
}
Property {
name: "sizeHint"
type: "QJSValue"
read: "sizeHint"
write: "setSizeHint"
notify: "sizeHintChanged"
index: 13
lineNumber: 50
isFinal: true
}
Signal { name: "indexChanged"; lineNumber: 107 }
Signal { name: "displayChanged"; lineNumber: 108 }
Signal { name: "decorationChanged"; lineNumber: 109 }
Signal { name: "editChanged"; lineNumber: 110 }
Signal { name: "toolTipChanged"; lineNumber: 111 }
Signal { name: "statusTipChanged"; lineNumber: 112 }
Signal { name: "whatsThisChanged"; lineNumber: 113 }
Signal { name: "fontChanged"; lineNumber: 115 }
Signal { name: "textAlignmentChanged"; lineNumber: 116 }
Signal { name: "backgroundChanged"; lineNumber: 117 }
Signal { name: "foregroundChanged"; lineNumber: 118 }
Signal { name: "checkStateChanged"; lineNumber: 119 }
Signal { name: "accessibleTextChanged"; lineNumber: 121 }
Signal { name: "accessibleDescriptionChanged"; lineNumber: 122 }
Signal { name: "sizeHintChanged"; lineNumber: 123 }
}
Component {
file: "private/qqmltreemodel_p.h"
lineNumber: 34
name: "QQmlTreeModel"
accessSemantics: "reference"
defaultProperty: "columns"
prototype: "QQmlAbstractColumnModel"
exports: ["Qt.labs.qmlmodels/TreeModel 6.10"]
exportMetaObjectRevisions: [1546]
Property {
name: "rows"
type: "QVariant"
read: "rows"
write: "setRows"
notify: "rowsChanged"
index: 0
lineNumber: 37
isFinal: true
}
Method {
name: "appendRow"
lineNumber: 50
Parameter { name: "parent"; type: "QModelIndex" }
Parameter { name: "row"; type: "QVariant" }
}
Method {
name: "appendRow"
lineNumber: 51
Parameter { name: "row"; type: "QVariant" }
}
Method { name: "clear"; lineNumber: 52 }
Method {
name: "getRow"
type: "QVariant"
isMethodConstant: true
lineNumber: 53
Parameter { name: "index"; type: "QModelIndex" }
}
Method {
name: "removeRow"
lineNumber: 54
Parameter { name: "index"; type: "QModelIndex" }
}
Method {
name: "setRow"
lineNumber: 55
Parameter { name: "index"; type: "QModelIndex" }
Parameter { name: "rowData"; type: "QVariant" }
}
Method {
name: "index"
type: "QModelIndex"
lineNumber: 57
Parameter { name: "rowIndex"; type: "std::vector<int>" }
Parameter { name: "column"; type: "int" }
}
}
}

View File

@@ -0,0 +1,8 @@
module Qt.labs.qmlmodels
linktarget Qt6::labsmodelsplugin
optional plugin labsmodelsplugin
classname QtQmlLabsModelsPlugin
typeinfo plugins.qmltypes
depends QtQml.Models auto
prefer :/qt-project.org/imports/Qt/labs/qmlmodels/

View File

@@ -0,0 +1,64 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "private/qqmlsettings_p.h"
lineNumber: 30
name: "QQmlSettingsLabs"
accessSemantics: "reference"
prototype: "QObject"
interfaces: ["QQmlParserStatus"]
exports: [
"Qt.labs.settings/Settings 1.0",
"Qt.labs.settings/Settings 6.0"
]
exportMetaObjectRevisions: [256, 1536]
Property {
name: "category"
type: "QString"
read: "category"
write: "setCategory"
index: 0
lineNumber: 34
isFinal: true
}
Property {
name: "fileName"
type: "QString"
read: "fileName"
write: "setFileName"
index: 1
lineNumber: 35
isFinal: true
}
Method { name: "_q_propertyChanged"; lineNumber: 63 }
Method {
name: "value"
type: "QVariant"
isMethodConstant: true
lineNumber: 49
Parameter { name: "key"; type: "QString" }
Parameter { name: "defaultValue"; type: "QVariant" }
}
Method {
name: "value"
type: "QVariant"
isCloned: true
isMethodConstant: true
lineNumber: 49
Parameter { name: "key"; type: "QString" }
}
Method {
name: "setValue"
lineNumber: 50
Parameter { name: "key"; type: "QString" }
Parameter { name: "value"; type: "QVariant" }
}
Method { name: "sync"; lineNumber: 51 }
}
}

View File

@@ -0,0 +1,7 @@
module Qt.labs.settings
linktarget Qt6::qmlsettingsplugin
optional plugin qmlsettingsplugin
classname QmlSettingsPlugin
typeinfo plugins.qmltypes
prefer :/qt-project.org/imports/Qt/labs/settings/

View File

@@ -0,0 +1,16 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "private/qsharedimageloader_p.h"
lineNumber: 32
name: "QSharedImageLoader"
accessSemantics: "reference"
prototype: "QObject"
}
}

View File

@@ -0,0 +1,9 @@
module Qt.labs.sharedimage
linktarget Qt6::sharedimageplugin
plugin sharedimageplugin
classname QtQuickSharedImagePlugin
static
typeinfo plugins.qmltypes
prefer :/qt-project.org/imports/Qt/labs/sharedimage/
depends QtQuick

View File

@@ -0,0 +1,84 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "private/qwavefrontmesh_p.h"
lineNumber: 29
name: "QWavefrontMesh"
accessSemantics: "reference"
prototype: "QQuickShaderEffectMesh"
exports: [
"Qt.labs.wavefrontmesh/WavefrontMesh 1.0",
"Qt.labs.wavefrontmesh/WavefrontMesh 2.0",
"Qt.labs.wavefrontmesh/WavefrontMesh 6.0"
]
exportMetaObjectRevisions: [256, 512, 1536]
Enum {
name: "Error"
lineNumber: 40
values: [
"NoError",
"InvalidSourceError",
"UnsupportedFaceShapeError",
"UnsupportedIndexSizeError",
"FileNotFoundError",
"NoAttributesError",
"MissingPositionAttributeError",
"MissingTextureCoordinateAttributeError",
"MissingPositionAndTextureCoordinateAttributesError",
"TooManyAttributesError",
"InvalidPlaneDefinitionError"
]
}
Property {
name: "source"
type: "QUrl"
read: "source"
write: "setSource"
notify: "sourceChanged"
index: 0
lineNumber: 32
isFinal: true
}
Property {
name: "lastError"
type: "Error"
read: "lastError"
notify: "lastErrorChanged"
index: 1
lineNumber: 33
isReadonly: true
isFinal: true
}
Property {
name: "projectionPlaneV"
type: "QVector3D"
read: "projectionPlaneV"
write: "setProjectionPlaneV"
notify: "projectionPlaneVChanged"
index: 2
lineNumber: 34
isFinal: true
}
Property {
name: "projectionPlaneW"
type: "QVector3D"
read: "projectionPlaneW"
write: "setProjectionPlaneW"
notify: "projectionPlaneWChanged"
index: 3
lineNumber: 35
isFinal: true
}
Signal { name: "sourceChanged"; lineNumber: 76 }
Signal { name: "lastErrorChanged"; lineNumber: 77 }
Signal { name: "projectionPlaneVChanged"; lineNumber: 78 }
Signal { name: "projectionPlaneWChanged"; lineNumber: 79 }
Method { name: "readData"; lineNumber: 82 }
}
}

View File

@@ -0,0 +1,9 @@
module Qt.labs.wavefrontmesh
linktarget Qt6::qmlwavefrontmeshplugin
optional plugin qmlwavefrontmeshplugin
classname QmlWavefrontMeshPlugin
typeinfo plugins.qmltypes
depends QtQuick auto
prefer :/qt-project.org/imports/Qt/labs/wavefrontmesh/
depends QtQuick

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
module Qt3D.Animation
linktarget Qt6::quick3danimationplugin
optional plugin quick3danimationplugin
classname Qt3DQuick3DAnimationPlugin
typeinfo plugins.qmltypes
depends QtQml auto
depends Qt3D.Render auto
depends Qt3D.Core auto
prefer :/qt-project.org/imports/Qt3D/Animation/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
module Qt3D.Core
linktarget Qt6::quick3dcoreplugin
plugin quick3dcoreplugin
classname Qt3DQuick3DCorePlugin
typeinfo plugins.qmltypes
depends QtQuick auto
prefer :/qt-project.org/imports/Qt3D/Core/
depends QtQuick

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
module Qt3D.Extras
linktarget Qt6::quick3dextrasplugin
optional plugin quick3dextrasplugin
classname Qt3DQuick3DExtrasPlugin
typeinfo plugins.qmltypes
depends QtQuick auto
depends Qt3D.Logic auto
depends Qt3D.Render auto
prefer :/qt-project.org/imports/Qt3D/Extras/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
module Qt3D.Input
linktarget Qt6::quick3dinputplugin
plugin quick3dinputplugin
classname Qt3DQuick3DInputPlugin
typeinfo plugins.qmltypes
depends QtQml auto
depends Qt3D.Core auto
prefer :/qt-project.org/imports/Qt3D/Input/

View File

@@ -0,0 +1,122 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "private/qt3dquick3dlogicforeign_p.h"
lineNumber: 22
name: "Qt3DLogic::QFrameAction"
accessSemantics: "reference"
prototype: "Qt3DCore::QComponent"
exports: ["Qt3D.Logic/FrameAction 2.0", "Qt3D.Logic/FrameAction 6.0"]
exportMetaObjectRevisions: [512, 1536]
Signal {
name: "triggered"
lineNumber: 33
Parameter { name: "dt"; type: "float" }
}
}
Component {
file: "qcomponent.h"
lineNumber: 17
name: "Qt3DCore::QComponent"
accessSemantics: "reference"
prototype: "Qt3DCore::QNode"
Property {
name: "isShareable"
type: "bool"
read: "isShareable"
write: "setShareable"
notify: "shareableChanged"
index: 0
lineNumber: 20
}
Signal {
name: "shareableChanged"
lineNumber: 34
Parameter { name: "isShareable"; type: "bool" }
}
Signal {
name: "addedToEntity"
lineNumber: 35
Parameter { name: "entity"; type: "QEntity"; isPointer: true }
}
Signal {
name: "removedFromEntity"
lineNumber: 36
Parameter { name: "entity"; type: "QEntity"; isPointer: true }
}
Method {
name: "setShareable"
lineNumber: 31
Parameter { name: "isShareable"; type: "bool" }
}
}
Component {
file: "qnode.h"
lineNumber: 28
name: "Qt3DCore::QNode"
accessSemantics: "reference"
prototype: "QObject"
Property {
name: "parent"
type: "Qt3DCore::QNode"
isPointer: true
read: "parentNode"
write: "setParent"
notify: "parentChanged"
index: 0
lineNumber: 31
}
Property {
name: "enabled"
type: "bool"
read: "isEnabled"
write: "setEnabled"
notify: "enabledChanged"
index: 1
lineNumber: 32
}
Signal {
name: "parentChanged"
lineNumber: 53
Parameter { name: "parent"; type: "QObject"; isPointer: true }
}
Signal {
name: "enabledChanged"
lineNumber: 54
Parameter { name: "enabled"; type: "bool" }
}
Signal { name: "nodeDestroyed"; lineNumber: 55 }
Method {
name: "setParent"
lineNumber: 49
Parameter { name: "parent"; type: "QNode"; isPointer: true }
}
Method {
name: "setEnabled"
lineNumber: 50
Parameter { name: "isEnabled"; type: "bool" }
}
Method { name: "_q_postConstructorInit"; lineNumber: 67 }
Method {
name: "_q_addChild"
lineNumber: 68
Parameter { type: "Qt3DCore::QNode"; isPointer: true }
}
Method {
name: "_q_removeChild"
lineNumber: 69
Parameter { type: "Qt3DCore::QNode"; isPointer: true }
}
Method {
name: "_q_setParentHelper"
lineNumber: 70
Parameter { type: "Qt3DCore::QNode"; isPointer: true }
}
}
}

View File

@@ -0,0 +1,8 @@
module Qt3D.Logic
linktarget Qt6::quick3dlogicplugin
optional plugin quick3dlogicplugin
classname Qt3DQuick3DLogicPlugin
typeinfo plugins.qmltypes
depends Qt3D.Core
prefer :/qt-project.org/imports/Qt3D/Logic/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
module Qt3D.Render
linktarget Qt6::quick3drenderplugin
optional plugin quick3drenderplugin
classname Qt3DQuick3DRenderPlugin
typeinfo plugins.qmltypes
depends QtQml auto
depends Qt3D.Core auto
prefer :/qt-project.org/imports/Qt3D/Render/

View File

@@ -0,0 +1,448 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype Blend
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-blend
\brief Merges two source items by using a blend mode.
Blend mode can be selected with the \l{Blend::mode}{mode} property.
\table
\header
\li source
\li foregroundSource
\li Effect applied
\row
\li \image Original_bug.png
\li \image Original_butterfly.png
\li \image Blend_bug_and_butterfly.png
\endtable
\note This effect is available when running with OpenGL.
\section1 Example
The following example shows how to apply the effect.
\snippet Blend-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that is going to be the base when
\l{Blend::foregroundSource}{foregroundSource} is blended over it.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the item that is going to be blended over the
\l{Blend::source}{source}.
\note It is not supported to let the effect include itself, for
instance by setting foregroundSource to the effect's parent.
*/
property variant foregroundSource
/*!
This property defines the mode which is used when foregroundSource is
blended over source. Values are case insensitive.
\table
\header
\li mode
\li description
\row
\li normal
\li The pixel component values from foregroundSource are written
over source by using alpha blending.
\row
\li addition
\li The pixel component values from source and foregroundSource are
added together and written.
\row
\li average
\li The pixel component values from source and foregroundSource are
averaged and written.
\row
\li color
\li The lightness value from source is combined with hue and
saturation from foregroundSource and written.
\row
\li colorBurn
\li The darker pixels from source are darkened more, if both source
and foregroundSource pixels are light the result is light.
\row
\li colorDodge
\li The lighter pixels from source are lightened more, if both
source and foregroundSource pixels are dark the result is dark.
\row
\li darken
\li The darker pixel component value from source and
foregroundSource is written.
\row
\li darkerColor
\li The lower luminance pixel rgb-value from source and
foregroundSource is written.
\row
\li difference
\li The absolute pixel component value difference between source and
foregroundSource is written.
\row
\li divide
\li The pixel component values from source is divided by the value
from foregroundSource and written.
\row
\li exclusion
\li The pixel component value difference with reduced contrast
between source and foregroundSource is written.
\row
\li hardLight
\li The pixel component values from source are lightened or darkened
according to foregroundSource values and written.
\row
\li hue
\li The hue value from foregroundSource is combined with saturation
and lightness from source and written.
\row
\li lighten
\li The lightest pixel component value from source and
foregroundSource is written.
\row
\li lighterColor
\li The higher luminance pixel rgb-value from source and
foregroundSource is written.
\row
\li lightness
\li The lightness value from foregroundSource is combined with hue
and saturation from source and written.
\row
\li multiply
\li The pixel component values from source and foregroundSource are
multiplied together and written.
\row
\li negation
\li The inverted absolute pixel component value difference between
source and foregroundSource is written.
\row
\li saturation
\li The saturation value from foregroundSource is combined with hue
and lightness from source and written.
\row
\li screen
\li The pixel values from source and foregroundSource are negated,
then multiplied, negated again, and written.
\row
\li subtract
\li Pixel value from foregroundSource is subracted from source and
written.
\row
\li softLight
\li The pixel component values from source are lightened or darkened
slightly according to foregroundSource values and written.
\endtable
\table
\header
\li Example source
\li Example foregroundSource
\row
\li \image Original_bug.png
\li \image Original_butterfly.png
\endtable
\table
\header
\li Output examples with different mode values
\li
\li
\row
\li \image Blend_mode1.png
\li \image Blend_mode2.png
\li \image Blend_mode3.png
\row
\li \b { mode: normal }
\li \b { mode: addition }
\li \b { mode: average }
\row
\li \image Blend_mode4.png
\li \image Blend_mode5.png
\li \image Blend_mode6.png
\row
\li \b { mode: color }
\li \b { mode: colorBurn }
\li \b { mode: colorDodge }
\row
\li \image Blend_mode7.png
\li \image Blend_mode8.png
\li \image Blend_mode9.png
\row
\li \b { mode: darken }
\li \b { mode: darkerColor }
\li \b { mode: difference }
\row
\li \image Blend_mode10.png
\li \image Blend_mode11.png
\li \image Blend_mode12.png
\row
\li \b { mode: divide }
\li \b { mode: exclusion }
\li \b { mode: hardlight }
\row
\li \image Blend_mode13.png
\li \image Blend_mode14.png
\li \image Blend_mode15.png
\row
\li \b { mode: hue }
\li \b { mode: lighten }
\li \b { mode: lighterColor }
\row
\li \image Blend_mode16.png
\li \image Blend_mode17.png
\li \image Blend_mode18.png
\row
\li \b { mode: lightness }
\li \b { mode: negation }
\li \b { mode: multiply }
\row
\li \image Blend_mode19.png
\li \image Blend_mode20.png
\li \image Blend_mode21.png
\row
\li \b { mode: saturation }
\li \b { mode: screen }
\li \b { mode: subtract }
\row
\li \image Blend_mode22.png
\row
\li \b { mode: softLight }
\endtable
*/
property string mode: "normal"
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in the
cache must be updated. Memory consumption is increased, because an extra
buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to false.
*/
property bool cached: false
SourceProxy {
id: backgroundSourceProxy
input: rootItem.source
}
SourceProxy {
id: foregroundSourceProxy
input: rootItem.foregroundSource
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: backgroundSourceProxy.output
property variant foregroundSource: foregroundSourceProxy.output
property string mode: rootItem.mode
anchors.fill: parent
function buildFragmentShader() {
var shader = fragmentShaderBegin
switch (mode.toLowerCase()) {
case "addition" : shader += blendModeAddition; break;
case "average" : shader += blendModeAverage; break;
case "color" : shader += blendModeColor; break;
case "colorburn" : shader += blendModeColorBurn; break;
case "colordodge" : shader += blendModeColorDodge; break;
case "darken" : shader += blendModeDarken; break;
case "darkercolor" : shader += blendModeDarkerColor; break;
case "difference" : shader += blendModeDifference; break;
case "divide" : shader += blendModeDivide; break;
case "exclusion" : shader += blendModeExclusion; break;
case "hardlight" : shader += blendModeHardLight; break;
case "hue" : shader += blendModeHue; break;
case "lighten" : shader += blendModeLighten; break;
case "lightercolor" : shader += blendModeLighterColor; break;
case "lightness" : shader += blendModeLightness; break;
case "negation" : shader += blendModeNegation; break;
case "normal" : shader += blendModeNormal; break;
case "multiply" : shader += blendModeMultiply; break;
case "saturation" : shader += blendModeSaturation; break;
case "screen" : shader += blendModeScreen; break;
case "subtract" : shader += blendModeSubtract; break;
case "softlight" : shader += blendModeSoftLight; break;
default: shader += "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);"; break;
}
shader += fragmentShaderEnd
fragmentShader = ShaderBuilder.buildFragmentShader(shader)
// Workaround for a bug just to make sure display gets updated when the mode changes.
sourceChanged()
}
Component.onCompleted: {
buildFragmentShader()
}
onModeChanged: {
buildFragmentShader()
}
property string blendModeAddition: "result.rgb = min(rgb1 + rgb2, 1.0);"
property string blendModeAverage: "result.rgb = 0.5 * (rgb1 + rgb2);"
property string blendModeColor: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).xy, RGBtoL(rgb1)));"
property string blendModeColorBurn: "result.rgb = clamp(1.0 - ((1.0 - rgb1) / max(vec3(1.0 / 256.0), rgb2)), vec3(0.0), vec3(1.0));"
property string blendModeColorDodge: "result.rgb = clamp(rgb1 / max(vec3(1.0 / 256.0), (1.0 - rgb2)), vec3(0.0), vec3(1.0));"
property string blendModeDarken: "result.rgb = min(rgb1, rgb2);"
property string blendModeDarkerColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb2 : rgb1;"
property string blendModeDifference: "result.rgb = abs(rgb1 - rgb2);"
property string blendModeDivide: "result.rgb = clamp(rgb1 / rgb2, 0.0, 1.0);"
property string blendModeExclusion: "result.rgb = rgb1 + rgb2 - 2.0 * rgb1 * rgb2;"
property string blendModeHardLight: "result.rgb = vec3(channelBlendHardLight(rgb1.r, rgb2.r), channelBlendHardLight(rgb1.g, rgb2.g), channelBlendHardLight(rgb1.b, rgb2.b));"
property string blendModeHue: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb2).x, RGBtoHSL(rgb1).yz));"
property string blendModeLighten: "result.rgb = max(rgb1, rgb2);"
property string blendModeLighterColor: "result.rgb = 0.3 * rgb1.r + 0.59 * rgb1.g + 0.11 * rgb1.b > 0.3 * rgb2.r + 0.59 * rgb2.g + 0.11 * rgb2.b ? rgb1 : rgb2;"
property string blendModeLightness: "result.rgb = HSLtoRGB(vec3(RGBtoHSL(rgb1).xy, RGBtoL(rgb2)));"
property string blendModeMultiply: "result.rgb = rgb1 * rgb2;"
property string blendModeNegation: "result.rgb = 1.0 - abs(1.0 - rgb1 - rgb2);"
property string blendModeNormal: "result.rgb = rgb2; a = max(color1.a, color2.a);"
property string blendModeSaturation: "vec3 hsl1 = RGBtoHSL(rgb1); result.rgb = HSLtoRGB(vec3(hsl1.x, RGBtoHSL(rgb2).y, hsl1.z));"
property string blendModeScreen: "result.rgb = 1.0 - (vec3(1.0) - rgb1) * (vec3(1.0) - rgb2);"
property string blendModeSubtract: "result.rgb = max(rgb1 - rgb2, vec3(0.0));"
property string blendModeSoftLight: "result.rgb = rgb1 * ((1.0 - rgb1) * rgb2 + (1.0 - (1.0 - rgb1) * (1.0 - rgb2)));"
property string fragmentShaderBegin: "#version 440
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
float qt_Opacity;
};
layout(binding = 1) uniform sampler2D source;
layout(binding = 2) uniform sampler2D foregroundSource;
float RGBtoL(vec3 color) {
float cmin = min(color.r, min(color.g, color.b));
float cmax = max(color.r, max(color.g, color.b));
float l = (cmin + cmax) / 2.0;
return l;
}
vec3 RGBtoHSL(vec3 color) {
float cmin = min(color.r, min(color.g, color.b));
float cmax = max(color.r, max(color.g, color.b));
float h = 0.0;
float s = 0.0;
float l = (cmin + cmax) / 2.0;
float diff = cmax - cmin;
if (diff > 1.0 / 256.0) {
if (l < 0.5)
s = diff / (cmin + cmax);
else
s = diff / (2.0 - (cmin + cmax));
if (color.r == cmax)
h = (color.g - color.b) / diff;
else if (color.g == cmax)
h = 2.0 + (color.b - color.r) / diff;
else
h = 4.0 + (color.r - color.g) / diff;
h /= 6.0;
}
return vec3(h, s, l);
}
float hueToIntensity(float v1, float v2, float h) {
h = fract(h);
if (h < 1.0 / 6.0)
return v1 + (v2 - v1) * 6.0 * h;
else if (h < 1.0 / 2.0)
return v2;
else if (h < 2.0 / 3.0)
return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
return v1;
}
vec3 HSLtoRGB(vec3 color) {
float h = color.x;
float l = color.z;
float s = color.y;
if (s < 1.0 / 256.0)
return vec3(l, l, l);
float v1;
float v2;
if (l < 0.5)
v2 = l * (1.0 + s);
else
v2 = (l + s) - (s * l);
v1 = 2.0 * l - v2;
float d = 1.0 / 3.0;
float r = hueToIntensity(v1, v2, h + d);
float g = hueToIntensity(v1, v2, h);
float b = hueToIntensity(v1, v2, h - d);
return vec3(r, g, b);
}
float channelBlendHardLight(float c1, float c2) {
return c2 > 0.5 ? (1.0 - (1.0 - 2.0 * (c2 - 0.5)) * (1.0 - c1)) : (2.0 * c1 * c2);
}
void main() {
vec4 result = vec4(0.0);
vec4 color1 = texture(source, qt_TexCoord0);
vec4 color2 = texture(foregroundSource, qt_TexCoord0);
vec3 rgb1 = color1.rgb / max(1.0/256.0, color1.a);
vec3 rgb2 = color2.rgb / max(1.0/256.0, color2.a);
float a = max(color1.a, color1.a * color2.a);
"
property string fragmentShaderEnd: "
fragColor.rgb = mix(rgb1, result.rgb, color2.a);
fragColor.rbg *= a;
fragColor.a = a;
fragColor *= qt_Opacity;
}
"
}
}

View File

@@ -0,0 +1,157 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype BrightnessContrast
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-color
\brief Adjusts brightness and contrast.
This effect adjusts the source item colors.
Brightness adjustment changes the perceived luminance of the source item.
Contrast adjustment increases or decreases the color
and brightness variations.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image BrightnessContrast_bug.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet BrightnessContrast-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that provides the source pixels
for the effect.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines how much the source brightness is increased or
decreased.
The value ranges from -1.0 to 1.0. By default, the property is set to \c
0.0 (no change).
\table
\header
\li Output examples with different brightness values
\li
\li
\row
\li \image BrightnessContrast_brightness1.png
\li \image BrightnessContrast_brightness2.png
\li \image BrightnessContrast_brightness3.png
\row
\li \b { brightness: -0.25 }
\li \b { brightness: 0 }
\li \b { brightness: 0.5 }
\row
\li \l contrast: 0
\li \l contrast: 0
\li \l contrast: 0
\endtable
*/
property real brightness: 0.0
/*!
This property defines how much the source contrast is increased or
decreased. The decrease of the contrast is linear, but the increase is
applied with a non-linear curve to allow very high contrast adjustment at
the high end of the value range.
\table
\header
\li Contrast adjustment curve
\row
\li \image BrightnessContrast_contrast_graph.png
\endtable
The value ranges from -1.0 to 1.0. By default, the property is set to \c 0.0 (no change).
\table
\header
\li Output examples with different contrast values
\li
\li
\row
\li \image BrightnessContrast_contrast1.png
\li \image BrightnessContrast_contrast2.png
\li \image BrightnessContrast_contrast3.png
\row
\li \b { contrast: -0.5 }
\li \b { contrast: 0 }
\li \b { contrast: 0.5 }
\row
\li \l brightness: 0
\li \l brightness: 0
\li \l brightness: 0
\endtable
*/
property real contrast: 0.0
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
interpolation: input && input.smooth ? SourceProxy.LinearInterpolation : SourceProxy.NearestInterpolation
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property real brightness: rootItem.brightness
property real contrast: rootItem.contrast
anchors.fill: parent
blending: !rootItem.cached
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/brightnesscontrast.frag.qsb"
}
}

View File

@@ -0,0 +1,111 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype ColorOverlay
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-color
\brief Alters the colors of the source item by applying an overlay color.
The effect is similar to what happens when a colorized glass is put on top
of a grayscale image. The color for the overlay is given in the ARGB format.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_butterfly.png
\li \image ColorOverlay_butterfly.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet ColorOverlay-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that provides the source pixels
for the effect.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the color value which is used to colorize the
source.
By default, the property is set to \c "transparent".
\table
\header
\li Output examples with different color values
\li
\li
\row
\li \image ColorOverlay_color1.png
\li \image ColorOverlay_color2.png
\li \image ColorOverlay_color3.png
\row
\li \b { color: #80ff0000 }
\li \b { color: #8000ff00 }
\li \b { color: #800000ff }
\endtable
*/
property color color: "transparent"
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
interpolation: input && input.smooth ? SourceProxy.LinearInterpolation : SourceProxy.NearestInterpolation
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property color color: rootItem.color
anchors.fill: parent
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/coloroverlay.frag.qsb"
}
}

View File

@@ -0,0 +1,199 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype Colorize
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-color
\brief Sets the color in the HSL color space.
The effect is similar to what happens when a colorized glass is put on top
of a grayscale image. Colorize uses the hue, saturation, and lightness (HSL)
color space. You can specify a desired value for each property. You can
shift all HSL values with the \l HueSaturation effect.
Alternatively, you can use the \l ColorOverlay effect to colorize the
source item in the RGBA color space.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image Colorize_bug.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet Colorize-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that provides the source pixels
for the effect.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the hue value which is used to colorize the
source.
The value ranges from 0.0 to 1.0. By default, the property is set to \c
0.0, which produces a slightly red color.
\table
\header
\li Allowed hue values
\row
\li \image Colorize_hue_scale.png
\endtable
\table
\header
\li Output examples with different hue values
\li
\li
\row
\li \image Colorize_hue1.png
\li \image Colorize_hue2.png
\li \image Colorize_hue3.png
\row
\li \b { hue: 0.2 }
\li \b { hue: 0.5 }
\li \b { hue: 0.8 }
\row
\li \l saturation: 1
\li \l saturation: 1
\li \l saturation: 1
\row
\li \l lightness: 0
\li \l lightness: 0
\li \l lightness: 0
\endtable
*/
property real hue: 0.0
/*!
This property defines the saturation value which is used to colorize the
source.
The value ranges from 0.0 (desaturated) to 1.0 (saturated). By default,
the property is set to \c 1.0 (saturated).
\table
\header
\li Output examples with different saturation values
\li
\li
\row
\li \image Colorize_saturation1.png
\li \image Colorize_saturation2.png
\li \image Colorize_saturation3.png
\row
\li \b { saturation: 0 }
\li \b { saturation: 0.5 }
\li \b { saturation: 1 }
\row
\li \l hue: 0
\li \l hue: 0
\li \l hue: 0
\row
\li \l lightness: 0
\li \l lightness: 0
\li \l lightness: 0
\endtable
*/
property real saturation: 1.0
/*!
This property defines how much the source lightness value is increased
or decreased.
Unlike hue and saturation properties, lightness does not set the used
value, but it shifts the existing source pixel lightness value.
The value ranges from -1.0 (decreased) to 1.0 (increased). By default,
the property is set to \c 0.0 (no change).
\table
\header
\li Output examples with different lightness values
\li
\li
\row
\li \image Colorize_lightness1.png
\li \image Colorize_lightness2.png
\li \image Colorize_lightness3.png
\row
\li \b { lightness: -0.75 }
\li \b { lightness: 0 }
\li \b { lightness: 0.75 }
\row
\li \l hue: 0
\li \l hue: 0
\li \l hue: 0
\row
\li \l saturation: 1
\li \l saturation: 1
\li \l saturation: 1
\endtable
*/
property real lightness: 0.0
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
interpolation: input && input.smooth ? SourceProxy.LinearInterpolation : SourceProxy.NearestInterpolation
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property real hue: rootItem.hue
property real saturation: rootItem.saturation
property real lightness: rootItem.lightness
anchors.fill: parent
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/colorize.frag.qsb"
}
}

View File

@@ -0,0 +1,296 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype ConicalGradient
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-gradient
\brief Draws a conical gradient.
A gradient is defined by two or more colors, which are blended seamlessly.
The colors start from the specified angle and end at 360 degrees larger
angle value.
\table
\header
\li Effect applied
\row
\li \image ConicalGradient.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet ConicalGradient-example.qml example
*/
Item {
id: rootItem
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
/*!
This property defines the starting angle where the color at the gradient
position of 0.0 is rendered. Colors at larger position values are
rendered into larger angle values and blended seamlessly. Angle values
increase clockwise.
\table
\header
\li Output examples with different angle values
\li
\li
\row
\li \image ConicalGradient_angle1.png
\li \image ConicalGradient_angle2.png
\li \image ConicalGradient_angle3.png
\row
\li \b { angle: 0 }
\li \b { angle: 45 }
\li \b { angle: 185 }
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\endtable
*/
property real angle: 0.0
/*!
\qmlproperty real QtGraphicalEffects::ConicalGradient::horizontalOffset
\qmlproperty real QtGraphicalEffects::ConicalGradient::verticalOffset
The horizontalOffset and verticalOffset properties define the offset in
pixels for the center point of the gradient compared to the item center.
The value ranges from -inf to inf. By default, the properties are set to \c
0.
\table
\header
\li Output examples with different horizontalOffset values
\li
\li
\row
\li \image ConicalGradient_horizontalOffset1.png
\li \image ConicalGradient_horizontalOffset2.png
\li \image ConicalGradient_horizontalOffset3.png
\row
\li \b { horizontalOffset: -50 }
\li \b { horizontalOffset: 0 }
\li \b { horizontalOffset: 50 }
\row
\li \l angle: 0
\li \l angle: 0
\li \l angle: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\endtable
*/
property real horizontalOffset: 0.0
property real verticalOffset: 0.0
/*!
This property defines the item that is going to be filled with gradient.
Source item gets rendered into an intermediate pixel buffer and the
alpha values from the result are used to determine the gradient's pixels
visibility in the display. The default value for source is undefined and
in that case whole effect area is filled with gradient.
\table
\header
\li Output examples with different source values
\li
\row
\li \image ConicalGradient_maskSource1.png
\li \image ConicalGradient_maskSource2.png
\row
\li \b { source: undefined }
\li \b { source: }
\row
\li \l angle: 0
\li \l angle: 0
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\endtable
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
A gradient is defined by two or more colors, which are blended seamlessly.
The colors are specified as a set of GradientStop child items, each of which
defines a position on the gradient (from 0.0 to 1.0), and a color.
The position of each GradientStop is defined by the position property.
The color is defined by the color property.
\table
\header
\li Output examples with different gradient values
\li
\li
\row
\li \image ConicalGradient_gradient1.png
\li \image ConicalGradient_gradient2.png
\li \image ConicalGradient_gradient3.png
\row
\li \b {gradient:} \code
Gradient {
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)
}
}
\endcode
\li \b {gradient:} \code
Gradient {
GradientStop {
position: 0.0
color: "#F0F0F0"
}
GradientStop {
position: 0.5
color: "#000000"
}
GradientStop {
position: 1.0
color: "#F0F0F0"
}
}
\endcode
\li \b {gradient:} \code
Gradient {
GradientStop {
position: 0.0
color: "#00000000"
}
GradientStop {
position: 1.0
color: "#FF000000"
}
}
\endcode
\row
\li \l angle: 0
\li \l angle: 0
\li \l angle: 0
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\endtable
*/
property Gradient gradient: Gradient {
GradientStop { position: 0.0; color: "white" }
GradientStop { position: 1.0; color: "black" }
}
SourceProxy {
id: maskSourceProxy
input: rootItem.source
}
Rectangle {
id: gradientRect
width: 16
height: 256
gradient: rootItem.gradient
smooth: true
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
rotation: shaderItem.rotation
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant gradientSource: ShaderEffectSource {
sourceItem: gradientRect
smooth: true
hideSource: true
visible: false
}
property variant maskSource: maskSourceProxy.output
property real startAngle: (rootItem.angle - 90) * Math.PI/180
property variant center: Qt.point(0.5 + horizontalOffset / width, 0.5 + verticalOffset / height)
anchors.fill: parent
fragmentShader: maskSource == undefined ? noMaskShader : maskShader
onFragmentShaderChanged: startAngleChanged()
property string noMaskShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/conicalgradient_nomask.frag.qsb"
property string maskShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/conicalgradient_mask.frag.qsb"
}
}

View File

@@ -0,0 +1,110 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype Desaturate
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-color
\brief Reduces the saturation of the colors.
Desaturated pixel values are calculated as averages of the original RGB
component values of the source item.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image Desaturate_bug.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet Desaturate-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that provides the source pixels to
the effect.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines how much the source colors are desaturated.
The value ranges from 0.0 (no change) to 1.0 (desaturated). By default,
the property is set to \c 0.0 (no change).
\table
\header
\li Output examples with different desaturation values
\li
\li
\row
\li \image Desaturate_desaturation1.png
\li \image Desaturate_desaturation2.png
\li \image Desaturate_desaturation3.png
\row
\li \b { desaturation: 0.0 }
\li \b { desaturation: 0.5 }
\li \b { desaturation: 1.0 }
\endtable
*/
property real desaturation: 0.0
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
interpolation: input && input.smooth ? SourceProxy.LinearInterpolation : SourceProxy.NearestInterpolation
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property real desaturation: rootItem.desaturation
anchors.fill: parent
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/desaturate.frag.qsb"
}
}

View File

@@ -0,0 +1,259 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype DirectionalBlur
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-motion-blur
\brief Applies blur effect to the specified direction.
Effect creates perceived impression that the source item appears to be
moving in the direction of the blur. Blur is applied to both sides of
each pixel, therefore setting the direction to 0 and 180 provides the
same result.
Other available motionblur effects are \l{Qt5Compat.GraphicalEffects::ZoomBlur}{ZoomBlur} and
\l{Qt5Compat.GraphicalEffects::RadialBlur}{RadialBlur}.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image DirectionalBlur_bug.png
\endtable
\note This effect is available when running with OpenGL.
\section1 Example
The following example shows how to apply the effect.
\snippet DirectionalBlur-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that is going to be blurred.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the perceived amount of movement for each pixel.
The movement is divided evenly to both sides of each pixel.
The quality of the blur depends on \l{DirectionalBlur::samples}{samples}
property. If length value is large, more samples are needed to keep the
visual quality at high level.
The value ranges from 0.0 to inf.
By default the property is set to \c 0.0 (no blur).
\table
\header
\li Output examples with different length values
\li
\li
\row
\li \image DirectionalBlur_length1.png
\li \image DirectionalBlur_length2.png
\li \image DirectionalBlur_length3.png
\row
\li \b { length: 0.0 }
\li \b { length: 32.0 }
\li \b { length: 48.0 }
\row
\li \l samples: 24
\li \l samples: 24
\li \l samples: 24
\row
\li \l angle: 0
\li \l angle: 0
\li \l angle: 0
\endtable
*/
property real length: 0.0
/*!
This property defines how many samples are taken per pixel when blur
calculation is done. Larger value produces better quality, but is slower
to render.
This property is not intended to be animated. Changing this property may
cause the underlying OpenGL shaders to be recompiled.
Allowed values are between 0 and inf (practical maximum depends on GPU).
By default the property is set to \c 0 (no samples).
*/
property int samples: 0
/*!
This property defines the direction for the blur. Blur is applied to
both sides of each pixel, therefore setting the direction to 0 and 180
produces the same result.
The value ranges from -180.0 to 180.0.
By default the property is set to \c 0.0.
\table
\header
\li Output examples with different angle values
\li
\li
\row
\li \image DirectionalBlur_angle1.png
\li \image DirectionalBlur_angle2.png
\li \image DirectionalBlur_angle3.png
\row
\li \b { angle: 0.0 }
\li \b { angle: 45.0 }
\li \b { angle: 90.0 }
\row
\li \l samples: 24
\li \l samples: 24
\li \l samples: 24
\row
\li \l length: 32
\li \l length: 32
\li \l length: 32
\endtable
*/
property real angle: 0.0
/*!
This property defines the blur behavior near the edges of the item,
where the pixel blurring is affected by the pixels outside the source
edges.
If the property is set to \c true, the pixels outside the source are
interpreted to be transparent, which is similar to OpenGL
clamp-to-border extension. The blur is expanded slightly outside the
effect item area.
If the property is set to \c false, the pixels outside the source are
interpreted to contain the same color as the pixels at the edge of the
item, which is similar to OpenGL clamp-to-edge behavior. The blur does
not expand outside the effect item area.
By default, the property is set to \c false.
*/
property bool transparentBorder: false
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
}
ShaderEffectSource {
id: cacheItem
anchors.fill: shaderItem
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property real len: rootItem.length
property bool transparentBorder: rootItem.transparentBorder
property real samples: rootItem.samples
property real weight: 1.0 / Math.max(1.0, rootItem.samples)
property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0)
property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
property variant delta: Qt.size(1.0 / rootItem.width * Math.cos((rootItem.angle + 90) * Math.PI/180), 1.0 / rootItem.height * Math.sin((rootItem.angle + 90) * Math.PI/180))
x: transparentBorder ? -expandPixels.width - 1: 0
y: transparentBorder ? -expandPixels.height - 1 : 0
width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width
height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height
property string fragmentShaderSkeleton: "#version 440
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
float qt_Opacity;
float len;
float samples;
float weight;
vec2 expand;
vec2 delta;
};
layout(binding = 1) uniform sampler2D source;
void main(void) {
vec2 shift = delta * len / max(1.0, samples - 1.0);
vec2 texCoord = qt_TexCoord0;
fragColor = vec4(0.0);
PLACEHOLDER_EXPAND_STEPS
texCoord -= shift * max(0.0, samples - 1.0) * 0.5;
PLACEHOLDER_UNROLLED_LOOP
fragColor *= weight * qt_Opacity;
}
"
function buildFragmentShader() {
var shader = fragmentShaderSkeleton
var expandSteps = ""
if (transparentBorder) {
expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
}
var unrolledLoop = "fragColor += texture(source, texCoord);\n"
if (rootItem.samples > 1) {
unrolledLoop = ""
for (var i = 0; i < rootItem.samples; i++)
unrolledLoop += "fragColor += texture(source, texCoord); texCoord += shift;\n"
}
shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
fragmentShader = ShaderBuilder.buildFragmentShader(shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop))
}
onFragmentShaderChanged: sourceChanged()
onSamplesChanged: buildFragmentShader()
onTransparentBorderChanged: buildFragmentShader()
Component.onCompleted: buildFragmentShader()
}
}

View File

@@ -0,0 +1,153 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype Displace
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-distortion
\brief Moves the pixels of the source item according to the given
displacement map.
\table
\header
\li Source
\li DisplacementSource
\li Effect applied
\row
\li \image Original_bug.png
\li \image Displace_map.png
\li \image Displace_bug.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet Displace-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item for the pixels that are going to
be displaced according to the data from
\l{Displace::displacementSource}{displacementSource}.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the item that is going to be used as the
displacement map. The displacementSource item gets rendered into the
intermediate pixel buffer. The red and green component values from the
result determine the displacement of the pixels from the source item.
The format for the displacement map is similar to the tangent space
normal maps, which can be created with most 3D-modeling tools. Many
image processing tools include the support for generating normal maps.
Alternatively, the displacement map for this effect can also be a QML
element which is colored appropriately. Like any QML element, it can be
animated. It is recommended that the size of the diplacement map matches
the size of the \l{Displace::source}{source}.
The displace data is interpreted in the RGBA format. For every pixel:
the red channel stores the x-axis displacement, and the green channel
stores the y-axis displacement. Blue and alpha channels are ignored for
this effect.
Assuming that red channel value 1.0 is fully red (0.0 having no red at
all), this effect considers pixel component value 0.5 to cause no
displacement at all. Values above 0.5 shift pixels to the left, values
below 0.5 do the shift to the right. In a similar way, green channel
values above 0.5 displace the pixels upwards, and values below 0.5 shift
the pixels downwards. The actual amount of displacement in pixels
depends on the \l displacement property.
*/
property variant displacementSource
/*!
This property defines the scale for the displacement. The bigger scale,
the bigger the displacement of the pixels. The value set to 0.0 causes
no displacement.
The value ranges from -1.0 (inverted maximum shift, according to
displacementSource) to 1.0 (maximum shift, according to
displacementSource). By default, the property is set to \c 0.0 (no
displacement).
\table
\header
\li Output examples with different displacement values
\li
\li
\row
\li \image Displace_displacement1.png
\li \image Displace_displacement2.png
\li \image Displace_displacement3.png
\row
\li \b { displacement: -0.2 }
\li \b { displacement: 0.0 }
\li \b { displacement: 0.2 }
\endtable
*/
property real displacement: 0.0
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
}
SourceProxy {
id: displacementSourceProxy
input: rootItem.displacementSource
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property variant displacementSource: displacementSourceProxy.output
property real displacement: rootItem.displacement
property real xPixel: 1.0/width
property real yPixel: 1.0/height
anchors.fill: parent
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/displace.frag.qsb"
}
}

View File

@@ -0,0 +1,355 @@
// Copyright (C) 2020 The Qt Company Ltd.
// Copyright (C) 2017 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype DropShadow
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-drop-shadow
\brief Generates a soft shadow behind the source item.
The DropShadow effect blurs the alpha channel of the input, colorizes the
result and places it behind the source object to create a soft shadow. The
shadow's color can be changed using the \l {DropShadow::color}{color}
property. The location of the shadow can be changed with the \l
horizontalOffset and \l verticalOffset properties.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_butterfly.png
\li \image DropShadow_butterfly.png
\endtable
The soft shadow is created by blurring the image live using a gaussian
blur. Performing blur live is a costly operation. Fullscreen gaussian blur
with even a moderate number of samples will only run at 60 fps on highend
graphics hardware.
When the source is static, the \l cached property can be set to allocate
another buffer to avoid performing the blur every time it is drawn.
\note This effect is available when running with OpenGL.
\section1 Example
The following example shows how to apply the effect.
\snippet DropShadow-example.qml example
*/
Item {
id: root
DropShadowBase {
id: dbs
anchors.fill: parent
}
/*!
This property defines the source item that is going to be used as the
source for the generated shadow.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property alias source: dbs.source
/*!
\qmlproperty int DropShadow::radius
Radius defines the softness of the shadow. A larger radius causes the
edges of the shadow to appear more blurry.
The ideal blur is achieved by selecting \c samples and \c radius such
that \c {samples = 1 + radius * 2}, such as:
\table
\header \li Radius \li Samples
\row \li 0 \e{(no blur)} \li 1
\row \li 1 \li 3
\row \li 2 \li 5
\row \li 3 \li 7
\endtable
By default, the property is set to \c {floor(samples/2)}.
\table
\header
\li Output examples with different radius values
\li
\li
\row
\li \image DropShadow_radius1.png
\li \image DropShadow_radius2.png
\li \image DropShadow_radius3.png
\row
\li \b { radius: 0 }
\li \b { radius: 6 }
\li \b { radius: 12 }
\row
\li \l samples: 25
\li \l samples: 25
\li \l samples: 25
\row
\li \l color: #000000
\li \l color: #000000
\li \l color: #000000
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 20
\li \l verticalOffset: 20
\li \l verticalOffset: 20
\row
\li \l spread: 0
\li \l spread: 0
\li \l spread: 0
\endtable
*/
property alias radius: dbs.radius;
/*!
This property defines how many samples are taken per pixel when edge
softening blur calculation is done. Larger value produces better
quality, but is slower to render.
Ideally, this value should be twice as large as the highest required
radius value plus one, such as:
\table
\header \li Radius \li Samples
\row \li 0 \e{(no blur)} \li 1
\row \li 1 \li 3
\row \li 2 \li 5
\row \li 3 \li 7
\endtable
By default, the property is set to \c 9.
This property is not intended to be animated. Changing this property will
cause the underlying OpenGL shaders to be recompiled.
*/
property alias samples: dbs.samples
/*!
This property defines the RGBA color value which is used for the shadow.
By default, the property is set to \c "black".
\table
\header
\li Output examples with different color values
\li
\li
\row
\li \image DropShadow_color1.png
\li \image DropShadow_color2.png
\li \image DropShadow_color3.png
\row
\li \b { color: #000000 }
\li \b { color: #0000ff }
\li \b { color: #aa000000 }
\row
\li \l radius: 8
\li \l radius: 8
\li \l radius: 8
\row
\li \l samples: 17
\li \l samples: 17
\li \l samples: 17
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 20
\li \l verticalOffset: 20
\li \l verticalOffset: 20
\row
\li \l spread: 0
\li \l spread: 0
\li \l spread: 0
\endtable
*/
property alias color: dbs.color
/*!
\qmlproperty real QtGraphicalEffects::DropShadow::horizontalOffset
\qmlproperty real QtGraphicalEffects::DropShadow::verticalOffset
HorizontalOffset and verticalOffset properties define the offset for the
rendered shadow compared to the DropShadow item position. Often, the
DropShadow item is anchored so that it fills the source element. In this
case, if the HorizontalOffset and verticalOffset properties are set to
0, the shadow is rendered exactly under the source item. By changing the
offset properties, the shadow can be positioned relatively to the source
item.
The values range from -inf to inf. By default, the properties are set to
\c 0.
\table
\header
\li Output examples with different horizontalOffset values
\li
\li
\row
\li \image DropShadow_horizontalOffset1.png
\li \image DropShadow_horizontalOffset2.png
\li \image DropShadow_horizontalOffset3.png
\row
\li \b { horizontalOffset: -20 }
\li \b { horizontalOffset: 0 }
\li \b { horizontalOffset: 20 }
\row
\li \l radius: 4
\li \l radius: 4
\li \l radius: 4
\row
\li \l samples: 9
\li \l samples: 9
\li \l samples: 9
\row
\li \l color: #000000
\li \l color: #000000
\li \l color: #000000
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\row
\li \l spread: 0
\li \l spread: 0
\li \l spread: 0
\endtable
\table
\header
\li Output examples with different verticalOffset values
\li
\li
\row
\li \image DropShadow_horizontalOffset2.png
\li \image DropShadow_spread1.png
\row
\li \b { horizontalOffset: 0 }
\li \b { horizontalOffset: 0 }
\row
\li \l radius: 4
\li \l radius: 8
\row
\li \l samples: 9
\li \l samples: 17
\row
\li \l color: #000000
\li \l color: #000000
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 20
\row
\li \l spread: 0
\li \l spread: 0
\endtable
*/
property alias horizontalOffset: dbs.horizontalOffset
property alias verticalOffset: dbs.verticalOffset
/*!
This property defines how large part of the shadow color is strengthened
near the source edges.
The value ranges from 0.0 to 1.0. By default, the property is set to \c
0.0.
\table
\header
\li Output examples with different spread values
\li
\li
\row
\li \image DropShadow_spread1.png
\li \image DropShadow_spread2.png
\li \image DropShadow_spread3.png
\row
\li \b { spread: 0.0 }
\li \b { spread: 0.5 }
\li \b { spread: 1.0 }
\row
\li \l radius: 8
\li \l radius: 8
\li \l radius: 8
\row
\li \l samples: 17
\li \l samples: 17
\li \l samples: 17
\row
\li \l color: #000000
\li \l color: #000000
\li \l color: #000000
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 20
\li \l verticalOffset: 20
\li \l verticalOffset: 20
\endtable
*/
property alias spread: dbs.spread
/*!
\internal
Starting Qt 5.6, this property has no effect. It is left here
for source compatibility only.
### Qt 6: remove
*/
property bool fast: false
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance. Every time the source or effect
properties are changed, the pixels in the cache must be updated. Memory
consumption is increased, because an extra buffer of memory is required
for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property alias cached: dbs.cached
/*!
This property determines whether or not the effect has a transparent
border.
When set to \c true, the exterior of the item is padded with a 1 pixel
wide transparent edge, making sampling outside the source texture use
transparency instead of the edge pixels. Without this property, an
image which has opaque edges will not get a blurred shadow.
In the image below, the Rectangle on the left has transparent borders
and has blurred edges, whereas the Rectangle on the right does not:
By default, this property is set to \c true.
\snippet DropShadow-transparentBorder-example.qml example
\image DropShadow-transparentBorder.png
*/
property alias transparentBorder: dbs.transparentBorder
}

View File

@@ -0,0 +1,400 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype FastBlur
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-blur
\brief Applies a fast blur effect to one or more source items.
The FastBlur effect softens the source content by blurring it with algorithm
which uses the source content downscaling and bilinear filtering.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image FastBlur_bug.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet FastBlur-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that is going to be blurred.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the distance of the neighboring pixels which affect
the blurring of an individual pixel. A larger radius increases the blur
effect. FastBlur algorithm may internally reduce the accuracy of the radius in order to
provide good rendering performance.
The value ranges from 0.0 (no blur) to inf. Visual quality of the blur is reduced when
radius exceeds value 64. By default, the property is set to \c 0.0 (no blur).
\table
\header
\li Output examples with different blur values
\li
\li
\row
\li \image FastBlur_radius1.png
\li \image FastBlur_radius2.png
\li \image FastBlur_radius3.png
\row
\li \b { radius: 0 }
\li \b { radius: 32 }
\li \b { radius: 64 }
\endtable
*/
property real radius: 0.0
/*!
This property defines the blur behavior near the edges of the item,
where the pixel blurring is affected by the pixels outside the source
edges.
If the property is set to \c true, the pixels outside the source are
interpreted to be transparent, which is similar to OpenGL
clamp-to-border extension. The blur is expanded slightly outside the
effect item area.
If the property is set to \c false, the pixels outside the source are
interpreted to contain the same color as the pixels at the edge of the
item, which is similar to OpenGL clamp-to-edge behavior. The blur does
not expand outside the effect item area.
By default, the property is set to \c false.
\table
\header
\li Output examples with different transparentBorder values
\li
\li
\row
\li \image FastBlur_transparentBorder1.png
\li \image FastBlur_transparentBorder2.png
\row
\li \b { transparentBorder: false }
\li \b { transparentBorder: true }
\row
\li \l radius: 64
\li \l radius: 64
\endtable
*/
property bool transparentBorder: false
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
}
ShaderEffectSource {
id: cacheItem
anchors.fill: shaderItem
visible: rootItem.cached
sourceItem: shaderItem
live: true
hideSource: visible
smooth: rootItem.radius > 0
}
/*! \internal */
property string __internalBlurVertexShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/fastblur_internal.vert.qsb"
/*! \internal */
property string __internalBlurFragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/fastblur_internal.frag.qsb"
ShaderEffect {
id: level0
property variant source: sourceProxy.output
anchors.fill: parent
visible: false
smooth: true
}
ShaderEffectSource {
id: level1
width: Math.ceil(shaderItem.width / 32) * 32
height: Math.ceil(shaderItem.height / 32) * 32
sourceItem: level0
hideSource: rootItem.visible
sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0, 0, 0, 0)
visible: false
smooth: rootItem.radius > 0
}
ShaderEffect {
id: effect1
property variant source: level1
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level2
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level2
width: level1.width / 2
height: level1.height / 2
sourceItem: effect1
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect2
property variant source: level2
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level3
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level3
width: level2.width / 2
height: level2.height / 2
sourceItem: effect2
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect3
property variant source: level3
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level4
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level4
width: level3.width / 2
height: level3.height / 2
sourceItem: effect3
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect4
property variant source: level4
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level5
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level5
width: level4.width / 2
height: level4.height / 2
sourceItem: effect4
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect5
property variant source: level5
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level6
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level6
width: level5.width / 2
height: level5.height / 2
sourceItem: effect5
hideSource: rootItem.visible
visible: false
smooth: true
}
Item {
id: dummysource
width: 1
height: 1
visible: false
}
ShaderEffectSource {
id: dummy
width: 1
height: 1
sourceItem: dummysource
visible: false
smooth: false
live: false
}
ShaderEffect {
id: shaderItem
property variant source1: level1
property variant source2: level2
property variant source3: level3
property variant source4: level4
property variant source5: level5
property variant source6: level6
property real lod: Math.sqrt(rootItem.radius / 64.0) * 1.2 - 0.2
property real weight1
property real weight2
property real weight3
property real weight4
property real weight5
property real weight6
x: transparentBorder ? -64 : 0
y: transparentBorder ? -64 : 0
width: transparentBorder ? parent.width + 128 : parent.width
height: transparentBorder ? parent.height + 128 : parent.height
function weight(v) {
if (v <= 0.0)
return 1.0
if (v >= 0.5)
return 0.0
return 1.0 - v * 2.0
}
function calculateWeights() {
var w1 = weight(Math.abs(lod - 0.100))
var w2 = weight(Math.abs(lod - 0.300))
var w3 = weight(Math.abs(lod - 0.500))
var w4 = weight(Math.abs(lod - 0.700))
var w5 = weight(Math.abs(lod - 0.900))
var w6 = weight(Math.abs(lod - 1.100))
var sum = w1 + w2 + w3 + w4 + w5 + w6;
weight1 = w1 / sum;
weight2 = w2 / sum;
weight3 = w3 / sum;
weight4 = w4 / sum;
weight5 = w5 / sum;
weight6 = w6 / sum;
upateSources()
}
function upateSources() {
var sources = new Array();
var weights = new Array();
if (weight1 > 0) {
sources.push(level1)
weights.push(weight1)
}
if (weight2 > 0) {
sources.push(level2)
weights.push(weight2)
}
if (weight3 > 0) {
sources.push(level3)
weights.push(weight3)
}
if (weight4 > 0) {
sources.push(level4)
weights.push(weight4)
}
if (weight5 > 0) {
sources.push(level5)
weights.push(weight5)
}
if (weight6 > 0) {
sources.push(level6)
weights.push(weight6)
}
for (var j = sources.length; j < 6; j++) {
sources.push(dummy)
weights.push(0.0)
}
source1 = sources[0]
source2 = sources[1]
source3 = sources[2]
source4 = sources[3]
source5 = sources[4]
source6 = sources[5]
weight1 = weights[0]
weight2 = weights[1]
weight3 = weights[2]
weight4 = weights[3]
weight5 = weights[4]
weight6 = weights[5]
}
Component.onCompleted: calculateWeights()
onLodChanged: calculateWeights()
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/fastblur.frag.qsb"
}
}

View File

@@ -0,0 +1,146 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype GammaAdjust
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-color
\brief Alters the luminance of the source item.
GammaAdjust is applied to each pixel according to the curve which is
pre-defined as a power-law expression, where the property gamma is used as the
reciprocal scaling exponent. Refer to the property documentation of \l{GammaAdjust::gamma}{gamma}
for more details.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image GammaAdjust_bug.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet GammaAdjust-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item for which the luminance is going to be
adjusted.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the change factor for how the luminance of each pixel
is altered according to the equation:
\code
luminance = pow(original_luminance, 1.0 / gamma); // The luminance is assumed to be between 0.0 and 1.0
\endcode
Setting the gamma values under 1.0 makes the image darker, the values
above 1.0 lighten it.
The value ranges from 0.0 (darkest) to inf (lightest). By default, the
property is set to \c 1.0 (no change).
\table
\header
\li Output examples with different gamma values
\li
\li
\row
\li \image GammaAdjust_gamma1.png
\li \image GammaAdjust_gamma2.png
\li \image GammaAdjust_gamma3.png
\row
\li \b { gamma: 0.5 }
\li \b { gamma: 1.0 }
\li \b { gamma: 2.0 }
\endtable
\table
\header
\li Pixel luminance curves of the above images.
\li
\li
\row
\li \image GammaAdjust_gamma1_graph.png
\li \image GammaAdjust_gamma2_graph.png
\li \image GammaAdjust_gamma3_graph.png
\row
\li Red curve: default gamma (1.0)
\li
\li
\row
\li Yellow curve: effect applied
\li
\li
\row
\li X-axis: pixel original luminance
\li
\li
\row
\li Y-axis: pixel luminance with effect applied
\li
\li
\endtable
*/
property real gamma: 1.0
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
interpolation: input && input.smooth ? SourceProxy.LinearInterpolation : SourceProxy.NearestInterpolation
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property real gamma: 1.0 / Math.max(rootItem.gamma, 0.0001)
anchors.fill: parent
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/gammaadjust.frag.qsb"
}
}

View File

@@ -0,0 +1,350 @@
// Copyright (C) 2017 The Qt Company Ltd.
// Copyright (C) 2017 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import QtQuick.Window
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype GaussianBlur
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-blur
\brief Applies a higher quality blur effect.
GaussianBlur effect softens the image by blurring it with an algorithm that
uses the Gaussian function to calculate the effect. The effect produces
higher quality than \l{Qt5Compat.GraphicalEffects::FastBlur}{FastBlur}, but is
slower to render.
In particular, modifying properties of Gaussian blur will in many cases require
rebuilding the shader code from scratch, so animating properties of the effect
may perform badly as well as require a large amount of cache space. Therefore,
\l{FastBlur} should usually be preferred for animated blurs.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image GaussianBlur_bug.png
\endtable
\note This effect is available when running with OpenGL.
\section1 Example
The following example shows how to apply the effect.
\snippet GaussianBlur-example.qml example
Performing blur live is a costly operation. Fullscreen gaussian blur
with even a moderate number of samples will only run at 60 fps on highend
graphics hardware.
*/
Item {
id: root
/*!
This property defines the source item that is going to be blurred.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the distance of the neighboring pixels which
affect the blurring of an individual pixel. A larger radius increases
the blur effect.
The ideal blur is achieved by selecting \c samples and \c radius such
that \c {samples = 1 + radius * 2}, such as:
\table
\header \li Radius \li Samples
\row \li 0 \e{(no blur)} \li 1
\row \li 1 \li 3
\row \li 2 \li 5
\row \li 3 \li 7
\endtable
The value ranges from 0.0 (no blur) to inf. By default, the property is
set to \c floor(samples / 2.0).
\table
\header
\li Output examples with different radius values
\li
\li
\row
\li \image GaussianBlur_radius1.png
\li \image GaussianBlur_radius2.png
\li \image GaussianBlur_radius3.png
\row
\li \b { radius: 0 }
\li \b { radius: 4 }
\li \b { radius: 8 }
\row
\li \l samples: 16
\li \l samples: 16
\li \l samples: 16
\row
\li \l deviation: 3
\li \l deviation: 3
\li \l deviation: 3
\endtable
*/
property real radius: Math.floor(samples / 2);
/*!
This property defines how many samples are taken per pixel when blur
calculation is done. Larger value produces better quality, but is slower
to render.
Ideally, this value should be twice as large as the highest required
radius value plus 1, for example, if the radius is animated between 0.0
and 4.0, samples should be set to 9.
By default, the property is set to \c 9.
\note This property is not intended to be animated. Changing this property may
cause the underlying OpenGL shaders to be recompiled.
*/
property int samples: 9
/*!
This property is a parameter to the gaussian function that is used when
calculating neighboring pixel weights for the blurring. A larger
deviation causes image to appear more blurry, but it also reduces the
quality of the blur. A very large deviation value causes the effect to
look a bit similar to what, for exmple, a box blur algorithm produces. A
too small deviation values makes the effect insignificant for the pixels
near the radius.
\image GaussianBlur_deviation_graph.png
\caption The image above shows the Gaussian function with two different
deviation values, yellow (1) and cyan (2.7). The y-axis shows the
weights, the x-axis shows the pixel distance.
The value ranges from 0.0 (no deviation) to inf (maximum deviation). By
default, deviation is bound to radius. When radius increases, deviation
is automatically increased linearly. With the radius value of 8, the
deviation default value becomes approximately 2.7034. This value
produces a compromise between the blur quality and overall blurriness.
\table
\header
\li Output examples with different deviation values
\li
\li
\row
\li \image GaussianBlur_deviation1.png
\li \image GaussianBlur_deviation2.png
\li \image GaussianBlur_deviation3.png
\row
\li \b { deviation: 1 }
\li \b { deviation: 2 }
\li \b { deviation: 4 }
\row
\li \l radius: 8
\li \l radius: 8
\li \l radius: 8
\row
\li \l samples: 16
\li \l samples: 16
\li \l samples: 16
\endtable
*/
property real deviation: (radius + 1.0) / 3.3333
/*!
This property defines the blur behavior near the edges of the item,
where the pixel blurring is affected by the pixels outside the source
edges.
If the property is set to \c true, the pixels outside the source are
interpreted to be transparent, which is similar to OpenGL
clamp-to-border extension. The blur is expanded slightly outside the
effect item area.
If the property is set to \c false, the pixels outside the source are
interpreted to contain the same color as the pixels at the edge of the
item, which is similar to OpenGL clamp-to-edge behavior. The blur does
not expand outside the effect item area.
By default, the property is set to \c false.
\table
\header
\li Output examples with different transparentBorder values
\li
\li
\row
\li \image GaussianBlur_transparentBorder1.png
\li \image GaussianBlur_transparentBorder2.png
\row
\li \b { transparentBorder: false }
\li \b { transparentBorder: true }
\row
\li \l radius: 8
\li \l radius: 8
\row
\li \l samples: 16
\li \l samples: 16
\row
\li \l deviation: 2.7
\li \l deviation: 2.7
\endtable
*/
property bool transparentBorder: false
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
// private members...
/*! \internal */
property int _paddedTexWidth: transparentBorder ? width + 2 * radius: width;
/*! \internal */
property int _paddedTexHeight: transparentBorder ? height + 2 * radius: height;
/*! \internal */
property int _kernelRadius: Math.max(0, samples / 2);
/*! \internal */
property int _kernelSize: _kernelRadius * 2 + 1;
/*! \internal */
property real _dpr: Screen.devicePixelRatio;
/*! \internal */
property bool _alphaOnly: false;
/*! \internal */
property var _maskSource: undefined
/*! \internal */
property alias _output: sourceProxy.output;
/*! \internal */
property alias _outputRect: sourceProxy.sourceRect;
/*! \internal */
property alias _color: verticalBlur.color;
/*! \internal */
property real _thickness: 0;
/*! \internal */
property bool _componentIsComplete: false
onSamplesChanged: _rebuildShaders();
on_KernelSizeChanged: _rebuildShaders();
onDeviationChanged: _rebuildShaders();
on_DprChanged: _rebuildShaders();
on_MaskSourceChanged: _rebuildShaders();
Component.onCompleted: {
_componentIsComplete = true
_rebuildShaders();
}
/*! \internal */
function _rebuildShaders() {
if (!_componentIsComplete)
return
var params = {
radius: _kernelRadius,
// Limit deviation to something very small avoid getting NaN in the shader.
deviation: Math.max(0.00001, deviation),
alphaOnly: root._alphaOnly,
masked: _maskSource != undefined,
fallback: root.radius != _kernelRadius
}
var shaders = ShaderBuilder.gaussianBlur(params);
horizontalBlur.fragmentShader = shaders.fragmentShader;
horizontalBlur.vertexShader = shaders.vertexShader;
}
SourceProxy {
id: sourceProxy
interpolation: SourceProxy.LinearInterpolation
input: root.source
sourceRect: root.transparentBorder
? Qt.rect(-root.radius, 0, root._paddedTexWidth, parent.height)
: Qt.rect(0, 0, 0, 0)
}
ShaderEffect {
id: horizontalBlur
width: root.transparentBorder ? root._paddedTexWidth : root.width
height: root.height;
// Used by all shaders
property Item source: sourceProxy.output;
property real spread: root.radius / root._kernelRadius;
property var dirstep: Qt.vector2d(1 / (root._paddedTexWidth * root._dpr), 0);
// Used by fallback shader (sampleCount exceeds number of varyings)
property real deviation: root.deviation
// Only in use for DropShadow and Glow
property color color: "white"
property real thickness: Math.max(0, Math.min(0.98, 1 - root._thickness * 0.98));
// Only in use for MaskedBlur
property var mask: root._maskSource;
layer.enabled: true
layer.smooth: true
layer.sourceRect: root.transparentBorder
? Qt.rect(0, -root.radius, width, root._paddedTexHeight)
: Qt.rect(0, 0, 0, 0)
visible: false
blending: false
}
ShaderEffect {
id: verticalBlur
x: transparentBorder ? -root.radius : 0
y: x;
width: root.transparentBorder ? root._paddedTexWidth: root.width
height: root.transparentBorder ? root._paddedTexHeight : root.height;
fragmentShader: horizontalBlur.fragmentShader
vertexShader: horizontalBlur.vertexShader
property Item source: horizontalBlur
property real spread: horizontalBlur.spread
property var dirstep: Qt.vector2d(0, 1 / (root._paddedTexHeight * root._dpr));
property real deviation: horizontalBlur.deviation
property color color: "black"
property real thickness: horizontalBlur.thickness;
property var mask: horizontalBlur.mask;
visible: true
}
ShaderEffectSource {
id: cacheItem
anchors.fill: verticalBlur
visible: root.cached
smooth: true
sourceItem: verticalBlur
hideSource: visible
}
}

View File

@@ -0,0 +1,247 @@
// Copyright (C) 2020 The Qt Company Ltd.
// Copyright (C) 2017 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype Glow
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-glow
\brief Generates a blurred and colorized image of the source and places it
behind the original, giving impression that the source is glowing.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_butterfly_black.png
\li \image Glow_butterfly.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet Glow-example.qml example
*/
Item {
id: root
DropShadowBase {
id: dps
anchors.fill: parent
color: "white"
spread: 0.5
horizontalOffset: 0
verticalOffset: 0
}
/*!
This property defines the source item that is going to be used as source
for the generated glow.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property alias source: dps.source
/*!
Radius defines the softness of the glow. A larger radius causes the
edges of the glow to appear more blurry.
Depending on the radius value, value of the \l{Glow::samples}{samples}
should be set to sufficiently large to ensure the visual quality.
The ideal blur is achieved by selecting \c samples and \c radius such
that \c {samples = 1 + radius * 2}, such as:
\table
\header \li Radius \li Samples
\row \li 0 \e{(no blur)} \li 1
\row \li 1 \li 3
\row \li 2 \li 5
\row \li 3 \li 7
\endtable
By default, the property is set to \c {floor(samples/2)}.
\table
\header
\li Output examples with different radius values
\li
\li
\row
\li \image Glow_radius1.png
\li \image Glow_radius2.png
\li \image Glow_radius3.png
\row
\li \b { radius: 0 }
\li \b { radius: 6 }
\li \b { radius: 12 }
\row
\li \l samples: 25
\li \l samples: 25
\li \l samples: 25
\row
\li \l color: #ffffff
\li \l color: #ffffff
\li \l color: #ffffff
\row
\li \l spread: 0
\li \l spread: 0
\li \l spread: 0
\endtable
*/
property alias radius: dps.radius
/*!
This property defines how many samples are taken per pixel when edge
softening blur calculation is done. Larger value produces better
quality, but is slower to render.
Ideally, this value should be twice as large as the highest required
radius value plus one, such as:
\table
\header \li Radius \li Samples
\row \li 0 \e{(no blur)} \li 1
\row \li 1 \li 3
\row \li 2 \li 5
\row \li 3 \li 7
\endtable
By default, the property is set to \c 9.
This property is not intended to be animated. Changing this property will
cause the underlying OpenGL shaders to be recompiled.
*/
property alias samples: dps.samples
/*!
This property defines how large part of the glow color is strengthened
near the source edges.
The values range from 0.0 to 1.0. By default, the property is set to \c
0.5.
\note The implementation is optimized for medium and low spread values.
Depending on the source, spread values closer to 1.0 may yield visually
asymmetrical results.
\table
\header
\li Output examples with different spread values
\li
\li
\row
\li \image Glow_spread1.png
\li \image Glow_spread2.png
\li \image Glow_spread3.png
\row
\li \b { spread: 0.0 }
\li \b { spread: 0.5 }
\li \b { spread: 1.0 }
\row
\li \l radius: 8
\li \l radius: 8
\li \l radius: 8
\row
\li \l samples: 17
\li \l samples: 17
\li \l samples: 17
\row
\li \l color: #ffffff
\li \l color: #ffffff
\li \l color: #ffffff
\endtable
*/
property alias spread: dps.spread
/*!
This property defines the RGBA color value which is used for the glow.
By default, the property is set to \c "white".
\table
\header
\li Output examples with different color values
\li
\li
\row
\li \image Glow_color1.png
\li \image Glow_color2.png
\li \image Glow_color3.png
\row
\li \b { color: #ffffff }
\li \b { color: #00ff00 }
\li \b { color: #aa00ff00 }
\row
\li \l radius: 8
\li \l radius: 8
\li \l radius: 8
\row
\li \l samples: 17
\li \l samples: 17
\li \l samples: 17
\row
\li \l spread: 0.5
\li \l spread: 0.5
\li \l spread: 0.5
\endtable
*/
property alias color: dps.color
/*!
\internal
Starting Qt 5.6, this property has no effect. It is left here
for source compatibility only.
### Qt 6: remove
*/
property bool fast: false
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property alias cached: dps.cached
/*!
This property determines whether or not the effect has a transparent
border.
When set to \c true, the exterior of the item is padded with a
transparent edge, making sampling outside the source texture use
transparency instead of the edge pixels. Without this property, an
image which has opaque edges will not get a blurred edge.
By default, the property is set to \c true. Set it to false if the source
already has a transparent edge to make the blurring a tiny bit faster.
In the snippet below, the Rectangle on the left has transparent borders
and has blurred edges, whereas the Rectangle on the right does not.
\snippet Glow-transparentBorder-example.qml example
\image Glow-transparentBorder.png
*/
property alias transparentBorder: dps.transparentBorder
}

View File

@@ -0,0 +1,187 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype HueSaturation
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-color
\brief Alters the source item colors in the HSL color space.
HueSaturation is similar to the \l Colorize effect, but the hue and
saturation property values are handled differently. The HueSaturation effect
always shifts the hue, saturation, and lightness from the original, instead
of setting them.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image HueSaturation_bug.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet HueSaturation-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that provides the source pixels
for the effect.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source: 0
/*!
This property defines the hue value which is added to the source hue
value.
The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the
property is set to \c 0.0 (no change).
\table
\header
\li Output examples with different hue values
\li
\li
\row
\li \image HueSaturation_hue1.png
\li \image HueSaturation_hue2.png
\li \image HueSaturation_hue3.png
\row
\li \b { hue: -0.3 }
\li \b { hue: 0.0 }
\li \b { hue: 0.3 }
\row
\li \l saturation: 0
\li \l saturation: 0
\li \l saturation: 0
\row
\li \l lightness: 0
\li \l lightness: 0
\li \l lightness: 0
\endtable
*/
property real hue: 0.0
/*!
This property defines the saturation value value which is added to the
source saturation value.
The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the
property is set to \c 0.0 (no change).
\table
\header
\li Output examples with different saturation values
\li
\li
\row
\li \image HueSaturation_saturation1.png
\li \image HueSaturation_saturation2.png
\li \image HueSaturation_saturation3.png
\row
\li \b { saturation: -0.8 }
\li \b { saturation: 0.0 }
\li \b { saturation: 1.0 }
\row
\li \l hue: 0
\li \l hue: 0
\li \l hue: 0
\row
\li \l lightness: 0
\li \l lightness: 0
\li \l lightness: 0
\endtable
*/
property real saturation: 0.0
/*!
This property defines the lightness value which is added to the source
saturation value.
The value ranges from -1.0 (decrease) to 1.0 (increase). By default, the
property is set to \c 0.0 (no change).
\table
\header
\li Output examples with different lightness values
\li
\li
\row
\li \image HueSaturation_lightness1.png
\li \image HueSaturation_lightness2.png
\li \image HueSaturation_lightness3.png
\row
\li \b { lightness: -0.5 }
\li \b { lightness: 0.0 }
\li \b { lightness: 0.5 }
\row
\li \l hue: 0
\li \l hue: 0
\li \l hue: 0
\row
\li \l saturation: 0
\li \l saturation: 0
\li \l saturation: 0
\endtable
*/
property real lightness: 0.0
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
interpolation: input && input.smooth ? SourceProxy.LinearInterpolation : SourceProxy.NearestInterpolation
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property variant hsl: Qt.vector3d(rootItem.hue, rootItem.saturation, rootItem.lightness)
anchors.fill: parent
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/huesaturation.frag.qsb"
}
}

View File

@@ -0,0 +1,351 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype InnerShadow
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-drop-shadow
\brief Generates a colorized and blurred shadow inside the
source.
By default the effect produces a high quality shadow image, thus the
rendering speed of the shadow might not be the highest possible. The
rendering speed is reduced especially if the shadow edges are heavily
softened. For use cases that require faster rendering speed and for which
the highest possible visual quality is not necessary, property
\l{InnerShadow::fast}{fast} can be set to true.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_butterfly.png
\li \image InnerShadow_butterfly.png
\endtable
\note This effect is available when running with OpenGL.
\section1 Example
The following example shows how to apply the effect.
\snippet InnerShadow-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that is going to be used as the
source for the generated shadow.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
Radius defines the softness of the shadow. A larger radius causes the
edges of the shadow to appear more blurry.
Depending on the radius value, value of the
\l{InnerShadow::samples}{samples} should be set to sufficiently large to
ensure the visual quality.
The value ranges from 0.0 (no blur) to inf. By default, the property is
set to \c 0.0 (no blur).
\table
\header
\li Output examples with different radius values
\li
\li
\row
\li \image InnerShadow_radius1.png
\li \image InnerShadow_radius2.png
\li \image InnerShadow_radius3.png
\row
\li \b { radius: 0 }
\li \b { radius: 6 }
\li \b { radius: 12 }
\row
\li \l samples: 24
\li \l samples: 24
\li \l samples: 24
\row
\li \l color: #000000
\li \l color: #000000
\li \l color: #000000
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\row
\li \l spread: 0
\li \l spread: 0
\li \l spread: 0
\endtable
*/
property real radius: 0.0
/*!
This property defines how many samples are taken per pixel when edge
softening blur calculation is done. Larger value produces better
quality, but is slower to render.
Ideally, this value should be twice as large as the highest required
radius value, for example, if the radius is animated between 0.0 and
4.0, samples should be set to 8.
The value ranges from 0 to 32. By default, the property is set to \c 0.
This property is not intended to be animated. Changing this property may
cause the underlying OpenGL shaders to be recompiled.
When \l{InnerShadow::fast}{fast} property is set to true, this property
has no effect.
*/
property int samples: 0
/*!
This property defines how large part of the shadow color is strengthened
near the source edges.
The value ranges from 0.0 to 1.0. By default, the property is set to \c
0.5.
\table
\header
\li Output examples with different spread values
\li
\li
\row
\li \image InnerShadow_spread1.png
\li \image InnerShadow_spread2.png
\li \image InnerShadow_spread3.png
\row
\li \b { spread: 0.0 }
\li \b { spread: 0.3 }
\li \b { spread: 0.5 }
\row
\li \l radius: 16
\li \l radius: 16
\li \l radius: 16
\row
\li \l samples: 24
\li \l samples: 24
\li \l samples: 24
\row
\li \l color: #000000
\li \l color: #000000
\li \l color: #000000
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\endtable
*/
property real spread: 0.0
/*!
This property defines the RGBA color value which is used for the shadow.
By default, the property is set to \c "black".
\table
\header
\li Output examples with different color values
\li
\li
\row
\li \image InnerShadow_color1.png
\li \image InnerShadow_color2.png
\li \image InnerShadow_color3.png
\row
\li \b { color: #000000 }
\li \b { color: #ffffff }
\li \b { color: #ff0000 }
\row
\li \l radius: 16
\li \l radius: 16
\li \l radius: 16
\row
\li \l samples: 24
\li \l samples: 24
\li \l samples: 24
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\row
\li \l spread: 0.2
\li \l spread: 0.2
\li \l spread: 0.2
\endtable
*/
property color color: "black"
/*!
\qmlproperty real QtGraphicalEffects::InnerShadow::horizontalOffset
\qmlproperty real QtGraphicalEffects::InnerShadow::verticalOffset
HorizontalOffset and verticalOffset properties define the offset for the
rendered shadow compared to the InnerShadow item position. Often, the
InnerShadow item is anchored so that it fills the source element. In
this case, if the HorizontalOffset and verticalOffset properties are set
to 0, the shadow is rendered fully inside the source item. By changing
the offset properties, the shadow can be positioned relatively to the
source item.
The values range from -inf to inf. By default, the properties are set to
\c 0.
\table
\header
\li Output examples with different horizontalOffset values
\li
\li
\row
\li \image InnerShadow_horizontalOffset1.png
\li \image InnerShadow_horizontalOffset2.png
\li \image InnerShadow_horizontalOffset3.png
\row
\li \b { horizontalOffset: -20 }
\li \b { horizontalOffset: 0 }
\li \b { horizontalOffset: 20 }
\row
\li \l radius: 16
\li \l radius: 16
\li \l radius: 16
\row
\li \l samples: 24
\li \l samples: 24
\li \l samples: 24
\row
\li \l color: #000000
\li \l color: #000000
\li \l color: #000000
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\row
\li \l spread: 0
\li \l spread: 0
\li \l spread: 0
\endtable
*/
property real horizontalOffset: 0
property real verticalOffset: 0
/*!
This property selects the blurring algorithm that is used to produce the
softness for the effect. Setting this to true enables fast algorithm,
setting value to false produces higher quality result.
By default, the property is set to \c false.
\table
\header
\li Output examples with different fast values
\li
\li
\row
\li \image InnerShadow_fast1.png
\li \image InnerShadow_fast2.png
\row
\li \b { fast: false }
\li \b { fast: true }
\row
\li \l radius: 16
\li \l radius: 16
\row
\li \l samples: 24
\li \l samples: 24
\row
\li \l color: #000000
\li \l color: #000000
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\row
\li \l spread: 0.2
\li \l spread: 0.2
\endtable
*/
property bool fast: false
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance. Every time the source or effect
properties are changed, the pixels in the cache must be updated. Memory
consumption is increased, because an extra buffer of memory is required
for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
Loader {
anchors.fill: parent
sourceComponent: rootItem.fast ? innerShadow : gaussianInnerShadow
}
Component {
id: gaussianInnerShadow
GaussianInnerShadow {
anchors.fill: parent
source: rootItem.source
radius: rootItem.radius
maximumRadius: rootItem.samples * 0.5
color: rootItem.color
cached: rootItem.cached
spread: rootItem.spread
horizontalOffset: rootItem.horizontalOffset
verticalOffset: rootItem.verticalOffset
}
}
Component {
id: innerShadow
FastInnerShadow {
anchors.fill: parent
source: rootItem.source
blur: Math.pow(rootItem.radius / 64.0, 0.4)
color: rootItem.color
cached: rootItem.cached
spread: rootItem.spread
horizontalOffset: rootItem.horizontalOffset
verticalOffset: rootItem.verticalOffset
}
}
}

View File

@@ -0,0 +1,403 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype LevelAdjust
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-color
\brief Adjusts color levels in the RGBA color space.
This effect adjusts the source item colors separately for each color
channel. Source item contrast can be adjusted and color balance altered.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_butterfly.png
\li \image LevelAdjust_butterfly.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet LevelAdjust-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that provides the source pixels
for the effect.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the change factor for how the value of each pixel
color channel is altered according to the equation:
\code
result.rgb = pow(original.rgb, 1.0 / gamma.rgb);
\endcode
Setting the gamma values under QtVector3d(1.0, 1.0, 1.0) makes the image
darker, the values above QtVector3d(1.0, 1.0, 1.0) lighten it.
The value ranges from QtVector3d(0.0, 0.0, 0.0) (darkest) to inf
(lightest). By default, the property is set to \c QtVector3d(1.0, 1.0,
1.0) (no change).
\table
\header
\li Output examples with different gamma values
\li
\li
\row
\li \image LevelAdjust_gamma1.png
\li \image LevelAdjust_gamma2.png
\li \image LevelAdjust_gamma3.png
\row
\li \b { gamma: Qt.vector3d(1.0, 1.0, 1.0) }
\li \b { gamma: Qt.vector3d(1.0, 0.4, 2.0) }
\li \b { gamma: Qt.vector3d(1.0, 0.1, 4.0) }
\row
\li \l minimumInput: #000000
\li \l minimumInput: #000000
\li \l minimumInput: #000000
\row
\li \l maximumInput: #ffffff
\li \l maximumInput: #ffffff
\li \l maximumInput: #ffffff
\row
\li \l minimumOutput: #000000
\li \l minimumOutput: #000000
\li \l minimumOutput: #000000
\row
\li \l maximumOutput: #ffffff
\li \l maximumOutput: #ffffff
\li \l maximumOutput: #ffffff
\endtable
\table
\header
\li Pixel color channel luminance curves of the above images.
\li
\li
\row
\li \image LevelAdjust_default_curve.png
\li \image LevelAdjust_gamma2_curve.png
\li \image LevelAdjust_gamma3_curve.png
\row
\li X-axis: pixel original luminance
\li
\li
\row
\li Y-axis: color channel luminance with effect applied
\li
\li
\endtable
*/
property variant gamma: Qt.vector3d(1.0, 1.0, 1.0)
/*!
This property defines the minimum input level for each color channel. It
sets the black-point, all pixels having lower value than this property
are rendered as black (per color channel). Increasing the value darkens
the dark areas.
The value ranges from "#00000000" to "#ffffffff". By default, the
property is set to \c "#00000000" (no change).
\table
\header
\li Output examples with different minimumInput values
\li
\li
\row
\li \image LevelAdjust_minimumInput1.png
\li \image LevelAdjust_minimumInput2.png
\li \image LevelAdjust_minimumInput3.png
\row
\li \b { minimumInput: #00000000 }
\li \b { minimumInput: #00000040 }
\li \b { minimumInput: #00000070 }
\row
\li \l maximumInput: #ffffff
\li \l maximumInput: #ffffff
\li \l maximumInput: #ffffff
\row
\li \l minimumOutput: #000000
\li \l minimumOutput: #000000
\li \l minimumOutput: #000000
\row
\li \l maximumOutput: #ffffff
\li \l maximumOutput: #ffffff
\li \l maximumOutput: #ffffff
\row
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\endtable
\table
\header
\li Pixel color channel luminance curves of the above images.
\li
\li
\row
\li \image LevelAdjust_default_curve.png
\li \image LevelAdjust_minimumInput2_curve.png
\li \image LevelAdjust_minimumInput3_curve.png
\row
\li X-axis: pixel original luminance
\li
\li
\row
\li Y-axis: color channel luminance with effect applied
\li
\li
\endtable
*/
property color minimumInput: Qt.rgba(0.0, 0.0, 0.0, 0.0)
/*!
This property defines the maximum input level for each color channel.
It sets the white-point, all pixels having higher value than this
property are rendered as white (per color channel).
Decreasing the value lightens the light areas.
The value ranges from "#ffffffff" to "#00000000". By default, the
property is set to \c "#ffffffff" (no change).
\table
\header
\li Output examples with different maximumInput values
\li
\li
\row
\li \image LevelAdjust_maximumInput1.png
\li \image LevelAdjust_maximumInput2.png
\li \image LevelAdjust_maximumInput3.png
\row
\li \b { maximumInput: #FFFFFFFF }
\li \b { maximumInput: #FFFFFF80 }
\li \b { maximumInput: #FFFFFF30 }
\row
\li \l minimumInput: #000000
\li \l minimumInput: #000000
\li \l minimumInput: #000000
\row
\li \l minimumOutput: #000000
\li \l minimumOutput: #000000
\li \l minimumOutput: #000000
\row
\li \l maximumOutput: #ffffff
\li \l maximumOutput: #ffffff
\li \l maximumOutput: #ffffff
\row
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\endtable
\table
\header
\li Pixel color channel luminance curves of the above images.
\li
\li
\row
\li \image LevelAdjust_default_curve.png
\li \image LevelAdjust_maximumInput2_curve.png
\li \image LevelAdjust_maximumInput3_curve.png
\row
\li X-axis: pixel original luminance
\li
\li
\row
\li Y-axis: color channel luminance with effect applied
\li
\li
\endtable
*/
property color maximumInput: Qt.rgba(1.0, 1.0, 1.0, 1.0)
/*!
This property defines the minimum output level for each color channel.
Increasing the value lightens the dark areas, reducing the contrast.
The value ranges from "#00000000" to "#ffffffff". By default, the
property is set to \c "#00000000" (no change).
\table
\header
\li Output examples with different minimumOutput values
\li
\li
\row
\li \image LevelAdjust_minimumOutput1.png
\li \image LevelAdjust_minimumOutput2.png
\li \image LevelAdjust_minimumOutput3.png
\row
\li \b { minimumOutput: #00000000 }
\li \b { minimumOutput: #00000070 }
\li \b { minimumOutput: #000000A0 }
\row
\li \l minimumInput: #000000
\li \l minimumInput: #000000
\li \l minimumInput: #000000
\row
\li \l maximumInput: #ffffff
\li \l maximumInput: #ffffff
\li \l maximumInput: #ffffff
\row
\li \l maximumOutput: #ffffff
\li \l maximumOutput: #ffffff
\li \l maximumOutput: #ffffff
\row
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\endtable
\table
\header
\li Pixel color channel luminance curves of the above images.
\li
\li
\row
\li \image LevelAdjust_default_curve.png
\li \image LevelAdjust_minimumOutput2_curve.png
\li \image LevelAdjust_minimumOutput3_curve.png
\row
\li X-axis: pixel original luminance
\li
\li
\row
\li Y-axis: color channel luminance with effect applied
\li
\li
\endtable
*/
property color minimumOutput: Qt.rgba(0.0, 0.0, 0.0, 0.0)
/*!
This property defines the maximum output level for each color channel.
Decreasing the value darkens the light areas, reducing the contrast.
The value ranges from "#ffffffff" to "#00000000". By default, the
property is set to \c "#ffffffff" (no change).
\table
\header
\li Output examples with different maximumOutput values
\li
\li
\row
\li \image LevelAdjust_maximumOutput1.png
\li \image LevelAdjust_maximumOutput2.png
\li \image LevelAdjust_maximumOutput3.png
\row
\li \b { maximumOutput: #FFFFFFFF }
\li \b { maximumOutput: #FFFFFF80 }
\li \b { maximumOutput: #FFFFFF30 }
\row
\li \l minimumInput: #000000
\li \l minimumInput: #000000
\li \l minimumInput: #000000
\row
\li \l maximumInput: #ffffff
\li \l maximumInput: #ffffff
\li \l maximumInput: #ffffff
\row
\li \l minimumOutput: #000000
\li \l minimumOutput: #000000
\li \l minimumOutput: #000000
\row
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\li \l gamma: Qt.vector3d(1.0, 1.0, 1.0)
\endtable
\table
\header
\li Pixel color channel luminance curves of the above images.
\li
\li
\row
\li \image LevelAdjust_default_curve.png
\li \image LevelAdjust_maximumOutput2_curve.png
\li \image LevelAdjust_maximumOutput3_curve.png
\row
\li X-axis: pixel original luminance
\li
\li
\row
\li Y-axis: color channel luminance with effect applied
\li
\li
\endtable
*/
property color maximumOutput: Qt.rgba(1.0, 1.0, 1.0, 1.0)
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
interpolation: input && input.smooth ? SourceProxy.LinearInterpolation : SourceProxy.NearestInterpolation
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property variant minimumInputRGB: Qt.vector3d(rootItem.minimumInput.r, rootItem.minimumInput.g, rootItem.minimumInput.b)
property variant maximumInputRGB: Qt.vector3d(rootItem.maximumInput.r, rootItem.maximumInput.g, rootItem.maximumInput.b)
property real minimumInputAlpha: rootItem.minimumInput.a
property real maximumInputAlpha: rootItem.maximumInput.a
property variant minimumOutputRGB: Qt.vector3d(rootItem.minimumOutput.r, rootItem.minimumOutput.g, rootItem.minimumOutput.b)
property variant maximumOutputRGB: Qt.vector3d(rootItem.maximumOutput.r, rootItem.maximumOutput.g, rootItem.maximumOutput.b)
property real minimumOutputAlpha: rootItem.minimumOutput.a
property real maximumOutputAlpha: rootItem.maximumOutput.a
property variant gamma: Qt.vector3d(1.0 / Math.max(rootItem.gamma.x, 0.0001), 1.0 / Math.max(rootItem.gamma.y, 0.0001), 1.0 / Math.max(rootItem.gamma.z, 0.0001))
anchors.fill: parent
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/leveladjust.frag.qsb"
}
}

View File

@@ -0,0 +1,286 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype LinearGradient
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-gradient
\brief Draws a linear gradient.
A gradient is defined by two or more colors, which are blended seamlessly.
The colors start from the given start point and end to the given end point.
\table
\header
\li Effect applied
\row
\li \image LinearGradient.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet LinearGradient-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the starting point where the color at gradient
position of 0.0 is rendered. Colors at larger position values are
rendered linearly towards the end point. The point is given in pixels
and the default value is Qt.point(0, 0). Setting the default values for
the start and \l{LinearGradient::end}{end} results in a full height
linear gradient on the y-axis.
\table
\header
\li Output examples with different start values
\li
\li
\row
\li \image LinearGradient_start1.png
\li \image LinearGradient_start2.png
\li \image LinearGradient_start3.png
\row
\li \b { start: QPoint(0, 0) }
\li \b { start: QPoint(150, 150) }
\li \b { start: QPoint(300, 0) }
\row
\li \l end: QPoint(300, 300)
\li \l end: QPoint(300, 300)
\li \l end: QPoint(300, 300)
\endtable
*/
property variant start: Qt.point(0, 0)
/*!
This property defines the ending point where the color at gradient
position of 1.0 is rendered. Colors at smaller position values are
rendered linearly towards the start point. The point is given in pixels
and the default value is Qt.point(0, height). Setting the default values
for the \l{LinearGradient::start}{start} and end results in a full
height linear gradient on the y-axis.
\table
\header
\li Output examples with different end values
\li
\li
\row
\li \image LinearGradient_end1.png
\li \image LinearGradient_end2.png
\li \image LinearGradient_end3.png
\row
\li \b { end: Qt.point(300, 300) }
\li \b { end: Qt.point(150, 150) }
\li \b { end: Qt.point(300, 0) }
\row
\li \l start: Qt.point(0, 0)
\li \l start: Qt.point(0, 0)
\li \l start: Qt.point(0, 0)
\endtable
*/
property variant end: Qt.point(0, height)
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
/*!
This property defines the item that is going to be filled with gradient.
Source item gets rendered into an intermediate pixel buffer and the
alpha values from the result are used to determine the gradient's pixels
visibility in the display. The default value for source is undefined and
in that case whole effect area is filled with gradient.
\table
\header
\li Output examples with different source values
\li
\li
\row
\li \image LinearGradient_maskSource1.png
\li \image LinearGradient_maskSource2.png
\row
\li \b { source: undefined }
\li \b { source: Image { source: images/butterfly.png } }
\row
\li \l start: Qt.point(0, 0)
\li \l start: Qt.point(0, 0)
\row
\li \l end: Qt.point(300, 300)
\li \l end: Qt.point(300, 300)
\endtable
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
A gradient is defined by two or more colors, which are blended
seamlessly. The colors are specified as a set of GradientStop child
items, each of which defines a position on the gradient from 0.0 to 1.0
and a color. The position of each GradientStop is defined by the
position property, and the color is definded by the color property.
\table
\header
\li Output examples with different gradient values
\li
\li
\row
\li \image LinearGradient_gradient1.png
\li \image LinearGradient_gradient2.png
\li \image LinearGradient_gradient3.png
\row
\li \b {gradient:} \code
Gradient {
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)
}
}
\endcode
\li \b {gradient:} \code
Gradient {
GradientStop {
position: 0.0
color: "#F0F0F0"
}
GradientStop {
position: 0.5
color: "#000000"
}
GradientStop {
position: 1.0
color: "#F0F0F0"
}
}
\endcode
\li \b {gradient:} \code
Gradient {
GradientStop {
position: 0.0
color: "#00000000"
}
GradientStop {
position: 1.0
color: "#FF000000"
}
}
\endcode
\row
\li \l start: Qt.point(0, 0)
\li \l start: Qt.point(0, 0)
\li \l start: Qt.point(0, 0)
\row
\li \l end: Qt.point(300, 300)
\li \l end: Qt.point(300, 300)
\li \l end: Qt.point(300, 300)
\endtable
*/
property Gradient gradient: Gradient {
GradientStop { position: 0.0; color: "white" }
GradientStop { position: 1.0; color: "black" }
}
SourceProxy {
id: maskSourceProxy
input: rootItem.source
}
ShaderEffectSource {
id: gradientSource
sourceItem: Rectangle {
width: 16
height: 256
gradient: rootItem.gradient
smooth: true
}
smooth: true
hideSource: true
visible: false
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
anchors.fill: parent
property variant source: gradientSource
property variant maskSource: maskSourceProxy.output
property variant startPoint: Qt.point(start.x / width, start.y / height)
property real dx: end.x - start.x
property real dy: end.y - start.y
property real l: 1.0 / Math.sqrt(Math.pow(dx / width, 2.0) + Math.pow(dy / height, 2.0))
property real angle: Math.atan2(dx, dy)
property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle))
vertexShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/lineargradient.vert.qsb"
fragmentShader: maskSource == undefined ? noMaskShader : maskShader
onFragmentShaderChanged: lChanged()
property string maskShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/lineargradient_mask.frag.qsb"
property string noMaskShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/lineargradient_nomask.frag.qsb"
}
}

View File

@@ -0,0 +1,157 @@
// Copyright (C) 2022 The Qt Company Ltd.
// Copyright (C) 2017 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype MaskedBlur
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-blur
\brief Applies a blur effect with a varying intesity.
MaskedBlur effect softens the image by blurring it. The intensity of the
blur can be controlled for each pixel using maskSource so that some parts of
the source are blurred more than others.
Performing blur live is a costly operation. Fullscreen gaussian blur
with even a moderate number of samples will only run at 60 fps on highend
graphics hardware.
\table
\header
\li Source
\li MaskSource
\li Effect applied
\row
\li \image Original_bug.png
\li \image MaskedBlur_mask.png
\li \image MaskedBlur_bug.png
\endtable
\note This effect is available when running with OpenGL.
\section1 Example
The following example shows how to apply the effect.
\snippet MaskedBlur-example.qml example
*/
Item {
id: root
/*!
This property defines the source item that is going to be blurred.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property alias source: blur.source
/*!
This property defines the item that is controlling the final intensity
of the blur. The pixel alpha channel value from maskSource defines the
actual blur radius that is going to be used for blurring the
corresponding source pixel.
Opaque maskSource pixels produce blur with specified
\l{MaskedBlur::radius}{radius}, while transparent pixels suppress the
blur completely. Semitransparent maskSource pixels produce blur with a
radius that is interpolated according to the pixel transparency level.
*/
property alias maskSource: maskProxy.input
/*!
This property defines the distance of the neighboring pixels which
affect the blurring of an individual pixel. A larger radius increases
the blur effect.
Depending on the radius value, value of the
\l{MaskedBlur::samples}{samples} should be set to sufficiently large to
ensure the visual quality.
The value ranges from 0.0 (no blur) to inf. By default, the property is
set to \c 0.0 (no blur).
\table
\header
\li Output examples with different radius values
\li
\li
\row
\li \image MaskedBlur_radius1.png
\li \image MaskedBlur_radius2.png
\li \image MaskedBlur_radius3.png
\row
\li \b { radius: 0 }
\li \b { radius: 8 }
\li \b { radius: 16 }
\row
\li \l samples: 25
\li \l samples: 25
\li \l samples: 25
\endtable
*/
property alias radius: blur.radius
/*!
This property defines how many samples are taken per pixel when blur
calculation is done. Larger value produces better quality, but is slower
to render.
Ideally, this value should be twice as large as the highest required
radius value plus 1, for example, if the radius is animated between 0.0
and 4.0, samples should be set to 9.
By default, the property is set to \c 9.
This property is not intended to be animated. Changing this property may
cause the underlying OpenGL shaders to be recompiled.
*/
property alias samples: blur.samples
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance. Every time the source or effect
properties are changed, the pixels in the cache must be updated. Memory
consumption is increased, because an extra buffer of memory is required
for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property alias cached: cacheItem.visible
GaussianBlur {
id: blur
source: root.source;
anchors.fill: parent
_maskSource: maskProxy.output;
SourceProxy {
id: maskProxy
}
}
ShaderEffectSource {
id: cacheItem
x: -blur._kernelRadius
y: -blur._kernelRadius
width: blur.width + 2 * blur._kernelRadius
height: blur.height + 2 * blur._kernelRadius
visible: false
smooth: true
sourceRect: Qt.rect(-blur._kernelRadius, -blur._kernelRadius, width, height);
sourceItem: blur
hideSource: visible
}
}

View File

@@ -0,0 +1,125 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype OpacityMask
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-mask
\brief Masks the source item with another item.
\table
\header
\li Source
\li MaskSource
\li Effect applied
\row
\li \image Original_bug.png
\li \image OpacityMask_mask.png
\li \image OpacityMask_bug.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet OpacityMask-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that is going to be masked.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the item that is going to be used as the mask. The
mask item gets rendered into an intermediate pixel buffer and the alpha
values from the result are used to determine the source item's pixels
visibility in the display.
\table
\header
\li Original
\li Mask
\li Effect applied
\row
\li \image Original_bug.png
\li \image OpacityMask_mask.png
\li \image OpacityMask_bug.png
\endtable
*/
property variant maskSource
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
\note It is not supported to let the effect include itself, for
instance by setting maskSource to the effect's parent.
*/
property bool cached: false
/*!
This property controls how the alpha values of the sourceMask will behave.
If this property is \c false, the resulting opacity is the source alpha
multiplied with the mask alpha, \c{As * Am}.
If this property is \c true, the resulting opacity is the source alpha
multiplied with the inverse of the mask alpha, \c{As * (1 - Am)}.
The default is \c false.
\since 5.7
*/
property bool invert: false
SourceProxy {
id: sourceProxy
input: rootItem.source
}
SourceProxy {
id: maskSourceProxy
input: rootItem.maskSource
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property variant maskSource: maskSourceProxy.output
anchors.fill: parent
fragmentShader: invert ? "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/opacitymask_invert.frag.qsb" : "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/opacitymask.frag.qsb"
}
}

View File

@@ -0,0 +1,283 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype RadialBlur
\inqmlmodule Qt5Compat.GraphicalEffects
\since Qt5Compat.GraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-motion-blur
\brief Applies directional blur in a circular direction around the items
center point.
Effect creates perceived impression that the source item appears to be
rotating to the direction of the blur.
Other available motionblur effects are
\l{Qt5Compat.GraphicalEffects::ZoomBlur}{ZoomBlur} and
\l{Qt5Compat.GraphicalEffects::DirectionalBlur}{DirectionalBlur}.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image RadialBlur_bug.png
\endtable
\note This effect is available when running with OpenGL.
\section1 Example Usage
The following example shows how to apply the effect.
\snippet RadialBlur-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that is going to be blurred.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the direction for the blur and at the same time
the level of blurring. The larger the angle, the more the result becomes
blurred. The quality of the blur depends on
\l{RadialBlur::samples}{samples} property. If angle value is large, more
samples are needed to keep the visual quality at high level.
Allowed values are between 0.0 and 360.0. By default the property is set
to \c 0.0.
\table
\header
\li Output examples with different angle values
\li
\li
\row
\li \image RadialBlur_angle1.png
\li \image RadialBlur_angle2.png
\li \image RadialBlur_angle3.png
\row
\li \b { angle: 0.0 }
\li \b { angle: 15.0 }
\li \b { angle: 30.0 }
\row
\li \l samples: 24
\li \l samples: 24
\li \l samples: 24
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\endtable
*/
property real angle: 0.0
/*!
This property defines how many samples are taken per pixel when blur
calculation is done. Larger value produces better quality, but is slower
to render.
This property is not intended to be animated. Changing this property may
cause the underlying OpenGL shaders to be recompiled.
Allowed values are between 0 and inf (practical maximum depends on GPU).
By default the property is set to \c 0 (no samples).
*/
property int samples: 0
/*!
\qmlproperty real QtGraphicalEffects::RadialBlur::horizontalOffset
\qmlproperty real QtGraphicalEffects::RadialBlur::verticalOffset
These properties define the offset in pixels for the perceived center
point of the rotation.
Allowed values are between -inf and inf.
By default these properties are set to \c 0.
\table
\header
\li Output examples with different horizontalOffset values
\li
\li
\row
\li \image RadialBlur_horizontalOffset1.png
\li \image RadialBlur_horizontalOffset2.png
\li \image RadialBlur_horizontalOffset3.png
\row
\li \b { horizontalOffset: 75.0 }
\li \b { horizontalOffset: 0.0 }
\li \b { horizontalOffset: -75.0 }
\row
\li \l samples: 24
\li \l samples: 24
\li \l samples: 24
\row
\li \l angle: 20
\li \l angle: 20
\li \l angle: 20
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\endtable
*/
property real horizontalOffset: 0.0
property real verticalOffset: 0.0
/*!
This property defines the blur behavior near the edges of the item,
where the pixel blurring is affected by the pixels outside the source
edges.
If the property is set to \c true, the pixels outside the source are
interpreted to be transparent, which is similar to OpenGL
clamp-to-border extension. The blur is expanded slightly outside the
effect item area.
If the property is set to \c false, the pixels outside the source are
interpreted to contain the same color as the pixels at the edge of the
item, which is similar to OpenGL clamp-to-edge behavior. The blur does
not expand outside the effect item area.
By default, the property is set to \c false.
*/
property bool transparentBorder: false
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
sourceRect: shaderItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
}
ShaderEffectSource {
id: cacheItem
anchors.fill: shaderItem
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property variant center: Qt.point(0.5 + rootItem.horizontalOffset / parent.width, 0.5 + rootItem.verticalOffset / parent.height)
property bool transparentBorder: rootItem.transparentBorder && rootItem.samples > 1
property int samples: rootItem.samples
property real weight: 1.0 / Math.max(1.0, rootItem.samples)
property real angleSin: Math.sin(rootItem.angle/2 * Math.PI/180)
property real angleCos: Math.cos(rootItem.angle/2 * Math.PI/180)
property real angleSinStep: Math.sin(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1))
property real angleCosStep: Math.cos(-rootItem.angle * Math.PI/180 / Math.max(1.0, rootItem.samples - 1))
property variant expandPixels: transparentBorder ? Qt.size(0.5 * parent.height, 0.5 * parent.width) : Qt.size(0,0)
property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height)
property real w: parent.width
property real h: parent.height
x: transparentBorder ? -expandPixels.width - 1 : 0
y: transparentBorder ? -expandPixels.height - 1 : 0
width: transparentBorder ? parent.width + expandPixels.width * 2.0 + 2 : parent.width
height: transparentBorder ? parent.height + expandPixels.height * 2.0 + 2 : parent.height
property string fragmentShaderSkeleton: "#version 440
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
float qt_Opacity;
float angleSin;
float angleCos;
float angleSinStep;
float angleCosStep;
float weight;
vec2 expand;
vec2 center;
vec2 delta;
float w;
float h;
};
layout(binding = 1) uniform sampler2D source;
void main() {
mat2 m;
fragColor = vec4(0.0);
vec2 texCoord = qt_TexCoord0;
PLACEHOLDER_EXPAND_STEPS
vec2 dir = vec2(texCoord.s * w - w * center.x, texCoord.t * h - h * center.y);
m[0] = vec2(angleCos, -angleSin);
m[1] = vec2(angleSin, angleCos);
dir *= m;
m[0] = vec2(angleCosStep, -angleSinStep);
m[1] = vec2(angleSinStep, angleCosStep);
PLACEHOLDER_UNROLLED_LOOP
fragColor *= weight * qt_Opacity;
}
"
function buildFragmentShader() {
var shader = fragmentShaderSkeleton
var expandSteps = ""
if (transparentBorder) {
expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
}
var unrolledLoop = "fragColor += texture(source, texCoord);\n"
if (rootItem.samples > 1) {
unrolledLoop = ""
for (var i = 0; i < rootItem.samples; i++)
unrolledLoop += "fragColor += texture(source, center + dir * delta); dir *= m;\n"
}
shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
fragmentShader = ShaderBuilder.buildFragmentShader(shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop))
}
onFragmentShaderChanged: sourceChanged()
onSamplesChanged: buildFragmentShader()
onTransparentBorderChanged: buildFragmentShader()
Component.onCompleted: buildFragmentShader()
}
}

View File

@@ -0,0 +1,373 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype RadialGradient
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-gradient
\brief Draws a radial gradient.
A gradient is defined by two or more colors, which are blended seamlessly.
The colors start from the middle of the item and end at the borders.
\table
\header
\li Effect applied
\row
\li \image RadialGradient.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet RadialGradient-example.qml example
*/
Item {
id: rootItem
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
/*!
\qmlproperty real RadialGradient::horizontalOffset
\qmlproperty real RadialGradient::verticalOffset
The horizontalOffset and verticalOffset properties define the offset in
pixels for the center point of the gradient compared to the item center.
The values range from -inf to inf. By default, these properties are set
to \c 0.
\table
\header
\li Output examples with different horizontalOffset values
\li
\li
\row
\li \image RadialGradient_horizontalOffset1.png
\li \image RadialGradient_horizontalOffset2.png
\li \image RadialGradient_horizontalOffset3.png
\row
\li \b { horizontalOffset: -150 }
\li \b { horizontalOffset: 0 }
\li \b { horizontalOffset: 150 }
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\row
\li \l horizontalRadius: 300
\li \l horizontalRadius: 300
\li \l horizontalRadius: 300
\row
\li \l verticalRadius: 300
\li \l verticalRadius: 300
\li \l verticalRadius: 300
\row
\li \l angle: 0
\li \l angle: 0
\li \l angle: 0
\endtable
*/
property real horizontalOffset: 0.0
property real verticalOffset: 0.0
/*!
\qmlproperty real RadialGradient::horizontalRadius
\qmlproperty real RadialGradient::verticalRadius
The horizontalRadius and verticalRadius properties define the shape and
size of the radial gradient. If the radiuses are equal, the shape of the
gradient is a circle. If the horizontal and vertical radiuses differ,
the shape is elliptical. The radiuses are given in pixels.
The value ranges from -inf to inf. By default, horizontalRadius is bound
to width and verticalRadius is bound to height.
\table
\header
\li Output examples with different horizontalRadius values
\li
\li
\row
\li \image RadialGradient_horizontalRadius1.png
\li \image RadialGradient_horizontalRadius2.png
\row
\li \b { horizontalRadius: 300 }
\li \b { horizontalRadius: 100 }
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\row
\li \l verticalRadius: 300
\li \l verticalRadius: 300
\row
\li \l angle: 0
\li \l angle: 0
\row
\li \l gradient: QQuickGradient(0xa05fb10)
\li \l gradient: QQuickGradient(0xa05fb10)
\endtable
*/
property real horizontalRadius: width
property real verticalRadius: height
/*!
This property defines the rotation of the gradient around its center
point. The rotation is only visible when the
\l{RadialGradient::horizontalRadius}{horizontalRadius} and
\l{RadialGradient::verticalRadius}{verticalRadius} properties are not
equal. The angle is given in degrees and the default value is \c 0.
\table
\header
\li Output examples with different angle values
\li
\li
\row
\li \image RadialGradient_angle1.png
\li \image RadialGradient_angle2.png
\li \image RadialGradient_angle3.png
\row
\li \b { angle: 0 }
\li \b { angle: 45 }
\li \b { angle: 90 }
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\row
\li \l horizontalRadius: 100
\li \l horizontalRadius: 100
\li \l horizontalRadius: 100
\row
\li \l verticalRadius: 300
\li \l verticalRadius: 300
\li \l verticalRadius: 300
\endtable
*/
property real angle: 0.0
/*!
This property defines the item that is going to be filled with gradient.
Source item gets rendered into an intermediate pixel buffer and the
alpha values from the result are used to determine the gradient's pixels
visibility in the display. The default value for source is undefined and
in that case whole effect area is filled with gradient.
\table
\header
\li Output examples with different source values
\li
\li
\row
\li \image RadialGradient_maskSource1.png
\li \image RadialGradient_maskSource2.png
\row
\li \b { source: undefined }
\li \b { source: Image { source: images/butterfly.png } }
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\row
\li \l horizontalRadius: 300
\li \l horizontalRadius: 300
\row
\li \l verticalRadius: 300
\li \l verticalRadius: 300
\row
\li \l angle: 0
\li \l angle: 0
\endtable
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
A gradient is defined by two or more colors, which are blended
seamlessly. The colors are specified as a set of GradientStop child
items, each of which defines a position on the gradient from 0.0 to 1.0
and a color. The position of each GradientStop is defined by setting the
position property. The color is defined by setting the color property.
\table
\header
\li Output examples with different gradient values
\li
\li
\row
\li \image RadialGradient_gradient1.png
\li \image RadialGradient_gradient2.png
\li \image RadialGradient_gradient3.png
\row
\li \b {gradient:} \code
Gradient {
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)
}
}
\endcode
\li \b {gradient:} \code
Gradient {
GradientStop {
position: 0.0
color: "#F0F0F0"
}
GradientStop {
position: 0.5
color: "#000000"
}
GradientStop {
position: 1.0
color: "#F0F0F0"
}
}
\endcode
\li \b {gradient:}
\code
Gradient {
GradientStop {
position: 0.0
color: "#00000000"
}
GradientStop {
position: 1.0
color: "#FF000000"
}
}
\endcode
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\row
\li \l horizontalRadius: 300
\li \l horizontalRadius: 300
\li \l horizontalRadius: 300
\row
\li \l verticalRadius: 300
\li \l verticalRadius: 300
\li \l verticalRadius: 300
\row
\li \l angle: 0
\li \l angle: 0
\li \l angle: 0
\endtable
*/
property Gradient gradient: Gradient {
GradientStop { position: 0.0; color: "white" }
GradientStop { position: 1.0; color: "black" }
}
SourceProxy {
id: maskSourceProxy
input: rootItem.source
}
ShaderEffectSource {
id: gradientSource
sourceItem: Rectangle {
width: 16
height: 256
gradient: rootItem.gradient
smooth: true
}
smooth: true
hideSource: true
visible: false
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant gradientImage: gradientSource
property variant maskSource: maskSourceProxy.output
property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height)
property real horizontalRatio: rootItem.horizontalRadius > 0 ? width / (2 * rootItem.horizontalRadius) : width * 16384
property real verticalRatio: rootItem.verticalRadius > 0 ? height / (2 * rootItem.verticalRadius) : height * 16384
property real angle: -rootItem.angle / 360 * 2 * Math.PI
property variant matrixData: Qt.point(Math.sin(angle), Math.cos(angle))
anchors.fill: parent
vertexShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/radialgradient.vert.qsb"
fragmentShader: maskSource == undefined ? noMaskShader : maskShader
onFragmentShaderChanged: horizontalRatioChanged()
property string maskShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/radialgradient_mask.frag.qsb"
property string noMaskShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/radialgradient_nomask.frag.qsb"
}
}

View File

@@ -0,0 +1,231 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype RectangularGlow
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-glow
\brief Generates a blurred and colorized rectangle, which gives
the impression that the source is glowing.
This effect is intended to have good performance. The shape of the glow is
limited to a rectangle with a custom corner radius. For situations where
custom shapes are required, consider \l[QML]{Glow} effect.
\table
\header
\li Effect applied
\row
\li \image RectangularGlow_applied.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet RectangularGlow-example.qml example
*/
Item {
id: rootItem
/*!
This property defines how many pixels outside the item area are reached
by the glow.
The value ranges from 0.0 (no glow) to inf (infinite glow). By default,
the property is set to \c 0.0.
\table
\header
\li Output examples with different glowRadius values
\li
\li
\row
\li \image RectangularGlow_glowRadius1.png
\li \image RectangularGlow_glowRadius2.png
\li \image RectangularGlow_glowRadius3.png
\row
\li \b { glowRadius: 10 }
\li \b { glowRadius: 20 }
\li \b { glowRadius: 40 }
\row
\li \l spread: 0
\li \l spread: 0
\li \l spread: 0
\row
\li \l color: #ffffff
\li \l color: #ffffff
\li \l color: #ffffff
\row
\li \l cornerRadius: 25
\li \l cornerRadius: 25
\li \l cornerRadius: 25
\endtable
*/
property real glowRadius: 0.0
/*!
This property defines how large part of the glow color is strengthened
near the source edges.
The value ranges from 0.0 (no strength increase) to 1.0 (maximum
strength increase). By default, the property is set to \c 0.0.
\table
\header
\li Output examples with different spread values
\li
\li
\row
\li \image RectangularGlow_spread1.png
\li \image RectangularGlow_spread2.png
\li \image RectangularGlow_spread3.png
\row
\li \b { spread: 0.0 }
\li \b { spread: 0.5 }
\li \b { spread: 1.0 }
\row
\li \l glowRadius: 20
\li \l glowRadius: 20
\li \l glowRadius: 20
\row
\li \l color: #ffffff
\li \l color: #ffffff
\li \l color: #ffffff
\row
\li \l cornerRadius: 25
\li \l cornerRadius: 25
\li \l cornerRadius: 25
\endtable
*/
property real spread: 0.0
/*!
This property defines the RGBA color value which is used for the glow.
By default, the property is set to \c "white".
\table
\header
\li Output examples with different color values
\li
\li
\row
\li \image RectangularGlow_color1.png
\li \image RectangularGlow_color2.png
\li \image RectangularGlow_color3.png
\row
\li \b { color: #ffffff }
\li \b { color: #55ff55 }
\li \b { color: #5555ff }
\row
\li \l glowRadius: 20
\li \l glowRadius: 20
\li \l glowRadius: 20
\row
\li \l spread: 0
\li \l spread: 0
\li \l spread: 0
\row
\li \l cornerRadius: 25
\li \l cornerRadius: 25
\li \l cornerRadius: 25
\endtable
*/
property color color: "white"
/*!
This property defines the corner radius that is used to draw a glow with
rounded corners.
The value ranges from 0.0 to half of the effective width or height of
the glow, whichever is smaller. This can be calculated with: \c{
min(width, height) / 2.0 + glowRadius}
By default, the property is bound to glowRadius property. The glow
behaves as if the rectangle was blurred when adjusting the glowRadius
property.
\table
\header
\li Output examples with different cornerRadius values
\li
\li
\row
\li \image RectangularGlow_cornerRadius1.png
\li \image RectangularGlow_cornerRadius2.png
\li \image RectangularGlow_cornerRadius3.png
\row
\li \b { cornerRadius: 0 }
\li \b { cornerRadius: 25 }
\li \b { cornerRadius: 50 }
\row
\li \l glowRadius: 20
\li \l glowRadius: 20
\li \l glowRadius: 20
\row
\li \l spread: 0
\li \l spread: 0
\li \l spread: 0
\row
\li \l color: #ffffff
\li \l color: #ffffff
\li \l color: #ffffff
\endtable
*/
property real cornerRadius: glowRadius
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
ShaderEffectSource {
id: cacheItem
anchors.fill: shaderItem
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
x: (parent.width - width) / 2.0
y: (parent.height - height) / 2.0
width: parent.width + rootItem.glowRadius * 2 + cornerRadius * 2
height: parent.height + rootItem.glowRadius * 2 + cornerRadius * 2
function clampedCornerRadius() {
var maxCornerRadius = Math.min(rootItem.width, rootItem.height) / 2 + glowRadius;
return Math.max(0, Math.min(rootItem.cornerRadius, maxCornerRadius))
}
property color color: rootItem.color
property real inverseSpread: 1.0 - rootItem.spread
property real relativeSizeX: ((inverseSpread * inverseSpread) * rootItem.glowRadius + cornerRadius * 2.0) / width
property real relativeSizeY: relativeSizeX * (width / height)
property real spread: rootItem.spread / 2.0
property real cornerRadius: clampedCornerRadius()
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/rectangularglow.frag.qsb"
}
}

View File

@@ -0,0 +1,294 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype RecursiveBlur
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-blur
\brief Blurs repeatedly, providing a strong blur effect.
The RecursiveBlur effect softens the image by blurring it with an algorithm
that uses a recursive feedback loop to blur the source multiple times. The
effect may give more blurry results than
\l{Qt5Compat.GraphicalEffects::GaussianBlur}{GaussianBlur} or
\l{Qt5Compat.GraphicalEffects::FastBlur}{FastBlur}, but the result is produced
asynchronously and takes more time.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image RecursiveBlur_bug.png
\endtable
\note This effect is available when running with OpenGL.
\section1 Example
The following example shows how to apply the effect.
\snippet RecursiveBlur-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that is going to be blurred.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the distance of neighboring pixels which influence
the blurring of individual pixels. A larger radius provides better
quality, but is slower to render.
\b Note: The radius value in this effect is not intended to be changed
or animated frequently. The correct way to use it is to set the correct
value and keep it unchanged for the whole duration of the iterative blur
sequence.
The value ranges from (no blur) to 16.0 (maximum blur step). By default,
the property is set to \c 0.0 (no blur).
\table
\header
\li Output examples with different radius values
\li
\li
\row
\li \image RecursiveBlur_radius1.png
\li \image RecursiveBlur_radius2.png
\li \image RecursiveBlur_radius3.png
\row
\li \b { radius: 2.5 }
\li \b { radius: 4.5 }
\li \b { radius: 7.5 }
\row
\li \l loops: 20
\li \l loops: 20
\li \l loops: 20
\endtable
*/
property real radius: 0.0
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
/*!
This property defines the blur behavior near the edges of the item,
where the pixel blurring is affected by the pixels outside the source
edges.
If the property is set to \c true, the pixels outside the source are
interpreted to be transparent, which is similar to OpenGL
clamp-to-border extension. The blur is expanded slightly outside the
effect item area.
If the property is set to \c false, the pixels outside the source are
interpreted to contain the same color as the pixels at the edge of the
item, which is similar to OpenGL clamp-to-edge behavior. The blur does
not expand outside the effect item area.
By default, the property is set to \c false.
\table
\header
\li Output examples with different transparentBorder values
\li
\li
\row
\li \image RecursiveBlur_transparentBorder1.png
\li \image RecursiveBlur_transparentBorder2.png
\row
\li \b { transparentBorder: false }
\li \b { transparentBorder: true }
\row
\li \l loops: 20
\li \l loops: 20
\row
\li \l radius: 7.5
\li \l radius: 7.5
\endtable
*/
property bool transparentBorder: false
/*!
This property defines the amount of blur iterations that are going to be
performed for the source. When the property changes, the iterative
blurring process starts. If the value is decreased or if the value
changes from zero to non-zero, a snapshot is taken from the source. The
snapshot is used as a starting point for the process.
The iteration loop tries to run as fast as possible. The speed might be
limited by the VSYNC or the time needed for one blur step, or both.
Sometimes it may be desirable to perform the blurring with a slower
pace. In that case, it may be convenient to control the property with
Animation which increases the value.
The value ranges from 0 to inf. By default, the property is set to \c 0.
\table
\header
\li Output examples with different loops values
\li
\li
\row
\li \image RecursiveBlur_loops1.png
\li \image RecursiveBlur_loops2.png
\li \image RecursiveBlur_loops3.png
\row
\li \b { loops: 4 }
\li \b { loops: 20 }
\li \b { loops: 70 }
\row
\li \l radius: 7.5
\li \l radius: 7.5
\li \l radius: 7.5
\endtable
*/
property int loops: 0
/*!
This property holds the progress of asynchronous source blurring
process, from 0.0 (nothing blurred) to 1.0 (finished).
*/
property real progress: loops > 0.0 ? Math.min(1.0, recursionTimer.counter / loops) : 0.0
onLoopsChanged: recursiveSource.scheduleUpdate()
onSourceChanged: recursionTimer.reset()
onRadiusChanged: recursionTimer.reset()
onTransparentBorderChanged: recursionTimer.reset()
SourceProxy {
id: sourceProxy
input: rootItem.source
sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2, parent.height + 2) : Qt.rect(0, 0, 0, 0)
}
ShaderEffectSource {
id: cacheItem
anchors.fill: verticalBlur
smooth: true
visible: rootItem.cached
hideSource: visible
live: true
sourceItem: inputItem.visible ? inputItem : verticalBlur
}
Item {
id: recursionTimer
property int counter: 0
function reset() {
counter = 0
recursiveSource.scheduleUpdate()
}
function nextFrame() {
if (loops < counter)
recursionTimer.counter = 0
if (counter > 0)
recursiveSource.sourceItem = verticalBlur
else
recursiveSource.sourceItem = inputItem
if (counter < loops) {
recursiveSource.scheduleUpdate()
counter++
}
}
}
ShaderEffect {
id: inputItem
property variant source: sourceProxy.output
property real expandX: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.width : 0.0
property real expandY: rootItem.transparentBorder ? (horizontalBlur.maximumRadius) / horizontalBlur.height : 0.0
anchors.fill: verticalBlur
visible: !verticalBlur.visible
vertexShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/recursiveblur.vert.qsb"
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/recursiveblur.frag.qsb"
}
ShaderEffectSource {
id: recursiveSource
visible: false
smooth: true
hideSource: false
live: false
sourceItem: inputItem
recursive: true
onSourceItemChanged: scheduleUpdate()
onScheduledUpdateCompleted: recursionTimer.nextFrame()
}
GaussianDirectionalBlur {
id: verticalBlur
x: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0
y: rootItem.transparentBorder ? -horizontalBlur.maximumRadius - 1 : 0
width: horizontalBlur.width + 2
height: horizontalBlur.height + 2
horizontalStep: 0.0
verticalStep: 1.0 / parent.height
source: ShaderEffectSource {
sourceItem: horizontalBlur
hideSource: true
visible: false
smooth: true
}
deviation: (radius + 1) / 2.3333
radius: rootItem.radius
maximumRadius: Math.ceil(rootItem.radius)
transparentBorder: false
visible: loops > 0
}
GaussianDirectionalBlur {
id: horizontalBlur
width: rootItem.transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
height: rootItem.transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
horizontalStep: 1.0 / parent.width
verticalStep: 0.0
source: recursiveSource
deviation: (radius + 1) / 2.3333
radius: rootItem.radius
maximumRadius: Math.ceil(rootItem.radius)
transparentBorder: false
visible: false
}
}

View File

@@ -0,0 +1,178 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype ThresholdMask
\inqmlmodule Qt5Compat.GraphicalEffects
\since QtGraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-mask
\brief Masks the source item with another item and applies a threshold
value.
The masking behavior can be controlled with the \l threshold value for the
mask pixels.
\table
\header
\li Source
\li MaskSource
\li Effect applied
\row
\li \image Original_bug.png
\li \image ThresholdMask_mask.png
\li \image ThresholdMask_bug.png
\endtable
\section1 Example
The following example shows how to apply the effect.
\snippet ThresholdMask-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that is going to be masked.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the item that is going to be used as the mask.
Mask item gets rendered into an intermediate pixel buffer and the alpha
values from the result are used to determine the source item's pixels
visibility in the display.
\table
\header
\li Original
\li Mask
\li Effect applied
\row
\li \image Original_bug.png
\li \image ThresholdMask_mask.png
\li \image ThresholdMask_bug.png
\endtable
\note It is not supported to let the effect include itself, for
instance by setting maskSource to the effect's parent.
*/
property variant maskSource
/*!
This property defines a threshold value for the mask pixels. The mask
pixels that have an alpha value below this property are used to
completely mask away the corresponding pixels from the source item. The
mask pixels that have a higher alpha value are used to alphablend the
source item to the display.
The value ranges from 0.0 (alpha value 0) to 1.0 (alpha value 255). By
default, the property is set to \c 0.0.
\table
\header
\li Output examples with different threshold values
\li
\li
\row
\li \image ThresholdMask_threshold1.png
\li \image ThresholdMask_threshold2.png
\li \image ThresholdMask_threshold3.png
\row
\li \b { threshold: 0.0 }
\li \b { threshold: 0.5 }
\li \b { threshold: 0.7 }
\row
\li \l spread: 0.2
\li \l spread: 0.2
\li \l spread: 0.2
\endtable
*/
property real threshold: 0.0
/*!
This property defines the smoothness of the mask edges near the
\l{ThresholdMask::threshold}{threshold} alpha value. Setting spread to
0.0 uses mask normally with the specified threshold. Setting higher
spread values softens the transition from the transparent mask pixels
towards opaque mask pixels by adding interpolated values between them.
The value ranges from 0.0 (sharp mask edge) to 1.0 (smooth mask edge).
By default, the property is set to \c 0.0.
\table
\header
\li Output examples with different spread values
\li
\li
\row
\li \image ThresholdMask_spread1.png
\li \image ThresholdMask_spread2.png
\li \image ThresholdMask_spread3.png
\row
\li \b { spread: 0.0 }
\li \b { spread: 0.2 }
\li \b { spread: 0.8 }
\row
\li \l threshold: 0.4
\li \l threshold: 0.4
\li \l threshold: 0.4
\endtable
*/
property real spread: 0.0
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
}
SourceProxy {
id: maskSourceProxy
input: rootItem.maskSource
}
ShaderEffectSource {
id: cacheItem
anchors.fill: parent
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property variant maskSource: maskSourceProxy.output
property real threshold: rootItem.threshold
property real spread: rootItem.spread
anchors.fill: parent
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/thresholdmask.frag.qsb"
}
}

View File

@@ -0,0 +1,273 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
/*!
\qmltype ZoomBlur
\inqmlmodule Qt5Compat.GraphicalEffects
\since Qt5Compat.GraphicalEffects 1.0
\inherits QtQuick2::Item
\ingroup qtgraphicaleffects-motion-blur
\brief Applies directional blur effect towards source items center point.
Effect creates perceived impression that the source item appears to be
moving towards the center point in Z-direction or that the camera appears
to be zooming rapidly. Other available motion blur effects are
\l{Qt5Compat.GraphicalEffects::DirectionalBlur}{DirectionalBlur}
and \l{Qt5Compat.GraphicalEffects::RadialBlur}{RadialBlur}.
\table
\header
\li Source
\li Effect applied
\row
\li \image Original_bug.png
\li \image ZoomBlur_bug.png
\endtable
\note This effect is available when running with OpenGL.
\section1 Example
The following example shows how to apply the effect.
\snippet ZoomBlur-example.qml example
*/
Item {
id: rootItem
/*!
This property defines the source item that is going to be blurred.
\note It is not supported to let the effect include itself, for
instance by setting source to the effect's parent.
*/
property variant source
/*!
This property defines the maximum perceived amount of movement for each
pixel. The amount is smaller near the center and reaches the specified
value at the edges.
The quality of the blur depends on \l{ZoomBlur::samples}{samples}
property. If length value is large, more samples are needed to keep the
visual quality at high level.
The value ranges from 0.0 to inf. By default the property is set to \c
0.0 (no blur).
\table
\header
\li Output examples with different length values
\li
\li
\row
\li \image ZoomBlur_length1.png
\li \image ZoomBlur_length2.png
\li \image ZoomBlur_length3.png
\row
\li \b { length: 0.0 }
\li \b { length: 32.0 }
\li \b { length: 48.0 }
\row
\li \l samples: 24
\li \l samples: 24
\li \l samples: 24
\row
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\li \l horizontalOffset: 0
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\endtable
*/
property real length: 0.0
/*!
This property defines how many samples are taken per pixel when blur
calculation is done. Larger value produces better quality, but is slower
to render.
This property is not intended to be animated. Changing this property may
cause the underlying OpenGL shaders to be recompiled.
Allowed values are between 0 and inf (practical maximum depends on GPU).
By default the property is set to \c 0 (no samples).
*/
property int samples: 0
/*!
\qmlproperty real QtGraphicalEffects::ZoomBlur::horizontalOffset
\qmlproperty real QtGraphicalEffects::ZoomBlur::verticalOffset
These properties define an offset in pixels for the blur direction
center point.
The values range from -inf to inf. By default these properties are set
to \c 0.
\table
\header
\li Output examples with different horizontalOffset values
\li
\li
\row
\li \image ZoomBlur_horizontalOffset1.png
\li \image ZoomBlur_horizontalOffset2.png
\li \image ZoomBlur_horizontalOffset3.png
\row
\li \b { horizontalOffset: 100.0 }
\li \b { horizontalOffset: 0.0 }
\li \b { horizontalOffset: -100.0 }
\row
\li \l samples: 24
\li \l samples: 24
\li \l samples: 24
\row
\li \l length: 32
\li \l length: 32
\li \l length: 32
\row
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\li \l verticalOffset: 0
\endtable
*/
property real horizontalOffset: 0.0
property real verticalOffset: 0.0
/*!
This property defines the blur behavior near the edges of the item,
where the pixel blurring is affected by the pixels outside the source
edges.
If the property is set to \c true, the pixels outside the source are
interpreted to be transparent, which is similar to OpenGL
clamp-to-border extension. The blur is expanded slightly outside the
effect item area.
If the property is set to \c false, the pixels outside the source are
interpreted to contain the same color as the pixels at the edge of the
item, which is similar to OpenGL clamp-to-edge behavior. The blur does
not expand outside the effect item area.
By default, the property is set to \c false.
*/
property bool transparentBorder: false
/*!
This property allows the effect output pixels to be cached in order to
improve the rendering performance.
Every time the source or effect properties are changed, the pixels in
the cache must be updated. Memory consumption is increased, because an
extra buffer of memory is required for storing the effect output.
It is recommended to disable the cache when the source or the effect
properties are animated.
By default, the property is set to \c false.
*/
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
}
ShaderEffectSource {
id: cacheItem
anchors.fill: shaderItem
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property variant center: Qt.point(0.5 + rootItem.horizontalOffset / width, 0.5 + rootItem.verticalOffset / height)
property real len: rootItem.length
property bool transparentBorder: rootItem.transparentBorder
property real samples: rootItem.samples
property real weight: 1.0 / Math.max(1.0, rootItem.samples)
property variant expandPixels: transparentBorder ? Qt.size(rootItem.samples, rootItem.samples) : Qt.size(0,0)
property variant expand: transparentBorder ? Qt.size(expandPixels.width / width, expandPixels.height / height) : Qt.size(0,0)
property variant delta: Qt.size(1.0 / rootItem.width, 1.0 / rootItem.height)
x: transparentBorder ? -expandPixels.width - 1 : 0
y: transparentBorder ? -expandPixels.height - 1 : 0
width: transparentBorder ? parent.width + 2.0 * expandPixels.width + 2 : parent.width
height: transparentBorder ? parent.height + 2.0 * expandPixels.height + 2 : parent.height
property string fragmentShaderSkeleton: "#version 440
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
float qt_Opacity;
float len;
float weight;
float samples;
vec2 center;
vec2 expand;
vec2 delta;
};
layout(binding = 1) uniform sampler2D source;
void main() {
vec2 texCoord = qt_TexCoord0;
vec2 centerCoord = center;
PLACEHOLDER_EXPAND_STEPS
vec2 dir = vec2(centerCoord.x - texCoord.s, centerCoord.y - texCoord.t);
dir /= max(1.0, length(dir) * 2.0);
vec2 shift = delta * len * dir * 2.0 / max(1.0, samples - 1.0);
fragColor = vec4(0.0);
PLACEHOLDER_UNROLLED_LOOP
fragColor *= weight * qt_Opacity;
}
"
function buildFragmentShader() {
var shader = fragmentShaderSkeleton
var expandSteps = ""
if (transparentBorder) {
expandSteps += "centerCoord = (centerCoord - expand) / (1.0 - 2.0 * expand);"
expandSteps += "texCoord = (texCoord - expand) / (1.0 - 2.0 * expand);"
}
var unrolledLoop = "fragColor += texture(source, texCoord);\n"
if (rootItem.samples > 1) {
unrolledLoop = ""
for (var i = 0; i < rootItem.samples; i++)
unrolledLoop += "fragColor += texture(source, texCoord); texCoord += shift;\n"
}
shader = shader.replace("PLACEHOLDER_EXPAND_STEPS", expandSteps)
fragmentShader = ShaderBuilder.buildFragmentShader(shader.replace("PLACEHOLDER_UNROLLED_LOOP", unrolledLoop))
}
onFragmentShaderChanged: sourceChanged()
onSamplesChanged: buildFragmentShader()
onTransparentBorderChanged: buildFragmentShader()
Component.onCompleted: buildFragmentShader()
}
}

View File

@@ -0,0 +1,63 @@
// Copyright (C) 2017 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
import Qt5Compat.GraphicalEffects
Item {
id: root
property variant source
property real radius: Math.floor(samples / 2)
property int samples: 9
property color color: "black"
property real horizontalOffset: 0
property real verticalOffset: 0
property real spread: 0.0
property bool cached: false
property bool transparentBorder: true
GaussianBlur {
id: blur
width: parent.width
height: parent.height
x: Math.round(horizontalOffset)
y: Math.round(verticalOffset)
source: root.source
radius: root.radius * Screen.devicePixelRatio
samples: root.samples * Screen.devicePixelRatio
_thickness: root.spread
transparentBorder: root.transparentBorder
_color: root.color;
_alphaOnly: true
// ignoreDevicePixelRatio: root.ignoreDevicePixelRatio
ShaderEffect {
x: blur._outputRect.x - parent.x
y: blur._outputRect.y - parent.y
width: transparentBorder ? blur._outputRect.width : blur.width
height: transparentBorder ? blur._outputRect.height : blur.height
property variant source: blur._output;
}
}
ShaderEffectSource {
id: cacheItem
x: -blur._kernelRadius + horizontalOffset
y: -blur._kernelRadius + verticalOffset
width: blur.width + 2 * blur._kernelRadius
height: blur.height + 2 * blur._kernelRadius
visible: root.cached
smooth: true
sourceRect: Qt.rect(-blur._kernelRadius, -blur._kernelRadius, width, height);
sourceItem: blur
hideSource: visible
}
}

View File

@@ -0,0 +1,296 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
Item {
id: rootItem
property variant source
property real spread: 0.0
property real blur: 0.0
property color color: "white"
property bool transparentBorder: false
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
}
ShaderEffectSource {
id: cacheItem
anchors.fill: shaderItem
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
property string __internalBlurVertexShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/fastblur_internal.vert.qsb"
property string __internalBlurFragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/fastblur_internal.frag.qsb"
ShaderEffect {
id: level0
property variant source: sourceProxy.output
anchors.fill: parent
visible: false
smooth: true
}
ShaderEffectSource {
id: level1
width: Math.ceil(shaderItem.width / 32) * 32
height: Math.ceil(shaderItem.height / 32) * 32
sourceItem: level0
hideSource: rootItem.visible
sourceRect: transparentBorder ? Qt.rect(-64, -64, shaderItem.width, shaderItem.height) : Qt.rect(0,0,0,0)
smooth: true
visible: false
}
ShaderEffect {
id: effect1
property variant source: level1
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level2
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level2
width: level1.width / 2
height: level1.height / 2
sourceItem: effect1
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect2
property variant source: level2
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level3
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level3
width: level2.width / 2
height: level2.height / 2
sourceItem: effect2
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect3
property variant source: level3
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level4
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level4
width: level3.width / 2
height: level3.height / 2
sourceItem: effect3
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect4
property variant source: level4
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level5
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level5
width: level4.width / 2
height: level4.height / 2
sourceItem: effect4
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect5
property variant source: level5
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level6
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level6
width: level5.width / 2
height: level5.height / 2
sourceItem: effect5
hideSource: rootItem.visible
visible: false
smooth: true
}
Item {
id: dummysource
width: 1
height: 1
visible: false
}
ShaderEffectSource {
id: dummy
width: 1
height: 1
sourceItem: dummysource
visible: false
smooth: false
live: false
}
ShaderEffect {
id: shaderItem
x: transparentBorder ? -64 : 0
y: transparentBorder ? -64 : 0
width: transparentBorder ? parent.width + 128 : parent.width
height: transparentBorder ? parent.height + 128 : parent.height
property variant source1: level1
property variant source2: level2
property variant source3: level3
property variant source4: level4
property variant source5: level5
property variant source6: level6
property real lod: rootItem.blur
property real weight1;
property real weight2;
property real weight3;
property real weight4;
property real weight5;
property real weight6;
property real spread: 1.0 - (rootItem.spread * 0.98)
property alias color: rootItem.color
function weight(v) {
if (v <= 0.0)
return 1
if (v >= 0.5)
return 0
return 1.0 - v / 0.5
}
function calculateWeights() {
var w1 = weight(Math.abs(lod - 0.100))
var w2 = weight(Math.abs(lod - 0.300))
var w3 = weight(Math.abs(lod - 0.500))
var w4 = weight(Math.abs(lod - 0.700))
var w5 = weight(Math.abs(lod - 0.900))
var w6 = weight(Math.abs(lod - 1.100))
var sum = w1 + w2 + w3 + w4 + w5 + w6;
weight1 = w1 / sum;
weight2 = w2 / sum;
weight3 = w3 / sum;
weight4 = w4 / sum;
weight5 = w5 / sum;
weight6 = w6 / sum;
upateSources()
}
function upateSources() {
var sources = new Array();
var weights = new Array();
if (weight1 > 0) {
sources.push(level1)
weights.push(weight1)
}
if (weight2 > 0) {
sources.push(level2)
weights.push(weight2)
}
if (weight3 > 0) {
sources.push(level3)
weights.push(weight3)
}
if (weight4 > 0) {
sources.push(level4)
weights.push(weight4)
}
if (weight5 > 0) {
sources.push(level5)
weights.push(weight5)
}
if (weight6 > 0) {
sources.push(level6)
weights.push(weight6)
}
for (var j = sources.length; j < 6; j++) {
sources.push(dummy)
weights.push(0.0)
}
source1 = sources[0]
source2 = sources[1]
source3 = sources[2]
source4 = sources[3]
source5 = sources[4]
source6 = sources[5]
weight1 = weights[0]
weight2 = weights[1]
weight3 = weights[2]
weight4 = weights[3]
weight5 = weights[4]
weight6 = weights[5]
}
Component.onCompleted: calculateWeights()
onLodChanged: calculateWeights()
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/fastglow.frag.qsb"
}
}

View File

@@ -0,0 +1,300 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
Item {
id: rootItem
property variant source
property real blur: 0.0
property real horizontalOffset: 0
property real verticalOffset: 0
property real spread: 0.0
property color color: "black"
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
}
ShaderEffectSource {
id: cacheItem
anchors.fill: shaderItem
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
property string __internalBlurVertexShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/fastblur_internal.vert.qsb"
property string __internalBlurFragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/fastblur_internal.frag.qsb"
ShaderEffect {
id: level0
property variant source: sourceProxy.output
property real horizontalOffset: rootItem.horizontalOffset / rootItem.width
property real verticalOffset: rootItem.verticalOffset / rootItem.width
property color color: rootItem.color
anchors.fill: parent
visible: false
smooth: true
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/fastinnershadow_level0.frag.qsb"
}
ShaderEffectSource {
id: level1
width: Math.ceil(shaderItem.width / 32) * 32
height: Math.ceil(shaderItem.height / 32) * 32
sourceItem: level0
hideSource: rootItem.visible
smooth: true
visible: false
}
ShaderEffect {
id: effect1
property variant source: level1
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level2
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level2
width: level1.width / 2
height: level1.height / 2
sourceItem: effect1
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect2
property variant source: level2
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level3
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level3
width: level2.width / 2
height: level2.height / 2
sourceItem: effect2
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect3
property variant source: level3
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level4
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level4
width: level3.width / 2
height: level3.height / 2
sourceItem: effect3
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect4
property variant source: level4
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level5
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level5
width: level4.width / 2
height: level4.height / 2
sourceItem: effect4
hideSource: rootItem.visible
visible: false
smooth: true
}
ShaderEffect {
id: effect5
property variant source: level5
property real yStep: 1/height
property real xStep: 1/width
anchors.fill: level6
visible: false
smooth: true
vertexShader: __internalBlurVertexShader
fragmentShader: __internalBlurFragmentShader
}
ShaderEffectSource {
id: level6
width: level5.width / 2
height: level5.height / 2
sourceItem: effect5
hideSource: rootItem.visible
visible: false
smooth: true
}
Item {
id: dummysource
width: 1
height: 1
visible: false
}
ShaderEffectSource {
id: dummy
width: 1
height: 1
sourceItem: dummysource
visible: false
smooth: false
live: false
}
ShaderEffect {
id: shaderItem
width: parent.width
height: parent.height
property variant original: sourceProxy.output
property variant source1: level1
property variant source2: level2
property variant source3: level3
property variant source4: level4
property variant source5: level5
property variant source6: level6
property real lod: rootItem.blur
property real weight1;
property real weight2;
property real weight3;
property real weight4;
property real weight5;
property real weight6;
property real spread: 1.0 - (rootItem.spread * 0.98)
property color color: rootItem.color
function weight(v) {
if (v <= 0.0)
return 1
if (v >= 0.5)
return 0
return 1.0 - v / 0.5
}
function calculateWeights() {
var w1 = weight(Math.abs(lod - 0.100))
var w2 = weight(Math.abs(lod - 0.300))
var w3 = weight(Math.abs(lod - 0.500))
var w4 = weight(Math.abs(lod - 0.700))
var w5 = weight(Math.abs(lod - 0.900))
var w6 = weight(Math.abs(lod - 1.100))
var sum = w1 + w2 + w3 + w4 + w5 + w6;
weight1 = w1 / sum;
weight2 = w2 / sum;
weight3 = w3 / sum;
weight4 = w4 / sum;
weight5 = w5 / sum;
weight6 = w6 / sum;
upateSources()
}
function upateSources() {
var sources = new Array();
var weights = new Array();
if (weight1 > 0) {
sources.push(level1)
weights.push(weight1)
}
if (weight2 > 0) {
sources.push(level2)
weights.push(weight2)
}
if (weight3 > 0) {
sources.push(level3)
weights.push(weight3)
}
if (weight4 > 0) {
sources.push(level4)
weights.push(weight4)
}
if (weight5 > 0) {
sources.push(level5)
weights.push(weight5)
}
if (weight6 > 0) {
sources.push(level6)
weights.push(weight6)
}
for (var j = sources.length; j < 6; j++) {
sources.push(dummy)
weights.push(0.0)
}
source1 = sources[0]
source2 = sources[1]
source3 = sources[2]
source4 = sources[3]
source5 = sources[4]
source6 = sources[5]
weight1 = weights[0]
weight2 = weights[1]
weight3 = weights[2]
weight4 = weights[3]
weight5 = weights[4]
weight6 = weights[5]
}
Component.onCompleted: calculateWeights()
onLodChanged: calculateWeights()
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/fastinnershadow.frag.qsb"
}
}

View File

@@ -0,0 +1,256 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
Item {
id: rootItem
property variant source
property real deviation: (radius + 1) / 3.3333
property real radius: 0.0
property int maximumRadius: 0
property real horizontalStep: 0.0
property real verticalStep: 0.0
property bool transparentBorder: false
property bool cached: false
property bool enableColor: false
property color color: "white"
property real spread: 0.0
property bool enableMask: false
property variant maskSource
SourceProxy {
id: sourceProxy
input: rootItem.source
}
SourceProxy {
id: maskSourceProxy
input: rootItem.maskSource
}
ShaderEffectSource {
id: cacheItem
anchors.fill: rootItem
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect {
id: shaderItem
property variant source: sourceProxy.output
property real deviation: Math.max(0.1, rootItem.deviation)
property real radius: rootItem.radius
property int maxRadius: rootItem.maximumRadius
property bool transparentBorder: rootItem.transparentBorder
property real gaussianSum: 0.0
property real startIndex: 0.0
property real deltaFactor: (2 * radius - 1) / (maxRadius * 2 - 1)
property real expandX: transparentBorder && rootItem.horizontalStep > 0 ? maxRadius / width : 0.0
property real expandY: transparentBorder && rootItem.verticalStep > 0 ? maxRadius / height : 0.0
property variant gwts: []
property variant delta: Qt.vector3d(rootItem.horizontalStep * deltaFactor, rootItem.verticalStep * deltaFactor, startIndex);
property variant factor_0_2: Qt.vector3d(gwts[0], gwts[1], gwts[2]);
property variant factor_3_5: Qt.vector3d(gwts[3], gwts[4], gwts[5]);
property variant factor_6_8: Qt.vector3d(gwts[6], gwts[7], gwts[8]);
property variant factor_9_11: Qt.vector3d(gwts[9], gwts[10], gwts[11]);
property variant factor_12_14: Qt.vector3d(gwts[12], gwts[13], gwts[14]);
property variant factor_15_17: Qt.vector3d(gwts[15], gwts[16], gwts[17]);
property variant factor_18_20: Qt.vector3d(gwts[18], gwts[19], gwts[20]);
property variant factor_21_23: Qt.vector3d(gwts[21], gwts[22], gwts[23]);
property variant factor_24_26: Qt.vector3d(gwts[24], gwts[25], gwts[26]);
property variant factor_27_29: Qt.vector3d(gwts[27], gwts[28], gwts[29]);
property variant factor_30_31: Qt.point(gwts[30], gwts[31]);
property color color: rootItem.color
property real spread: 1.0 - (rootItem.spread * 0.98)
property variant maskSource: maskSourceProxy.output
anchors.fill: rootItem
function gausFunc(x){
//Gaussian function = h(x):=(1/sqrt(2*3.14159*(D^2))) * %e^(-(x^2)/(2*(D^2)));
return (1.0 / Math.sqrt(2 * Math.PI * (Math.pow(shaderItem.deviation, 2)))) * Math.pow(Math.E, -((Math.pow(x, 2)) / (2 * (Math.pow(shaderItem.deviation, 2)))));
}
function updateGaussianWeights() {
gaussianSum = 0.0;
startIndex = -maxRadius + 0.5
var n = new Array(32);
for (var j = 0; j < 32; j++)
n[j] = 0;
var max = maxRadius * 2
var delta = (2 * radius - 1) / (max - 1);
for (var i = 0; i < max; i++) {
n[i] = gausFunc(-radius + 0.5 + i * delta);
gaussianSum += n[i];
}
gwts = n;
}
function buildFragmentShader() {
var shaderSteps = [
"fragColor += texture(source, texCoord) * factor_0_2.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_0_2.y; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_0_2.z; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_3_5.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_3_5.y; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_3_5.z; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_6_8.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_6_8.y; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_6_8.z; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_9_11.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_9_11.y; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_9_11.z; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_12_14.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_12_14.y; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_12_14.z; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_15_17.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_15_17.y; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_15_17.z; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_18_20.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_18_20.y; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_18_20.z; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_21_23.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_21_23.y; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_21_23.z; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_24_26.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_24_26.y; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_24_26.z; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_27_29.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_27_29.y; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_27_29.z; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_30_31.x; texCoord += shift;",
"fragColor += texture(source, texCoord) * factor_30_31.y; texCoord += shift;"
]
var shader = fragmentShaderBegin
var samples = maxRadius * 2
if (samples > 32) {
console.log("DirectionalGaussianBlur.qml WARNING: Maximum of blur radius (16) exceeded!")
samples = 32
}
for (var i = 0; i < samples; i++) {
shader += shaderSteps[i]
}
shader += fragmentShaderEnd
var colorizeSteps = ""
var colorizeUniforms = ""
var maskSteps = ""
var maskUniforms = ""
if (enableColor) {
colorizeSteps += "fragColor = mix(vec4(0), color, clamp((fragColor.a - 0.0) / (spread - 0.0), 0.0, 1.0));\n"
colorizeUniforms += "vec4 color;\n"
colorizeUniforms += "float spread;\n"
}
if (enableMask) {
maskSteps += "shift *= texture(maskSource, qt_TexCoord0).a;\n"
maskUniforms += "layout(binding = 2) uniform sampler2D maskSource;\n"
}
shader = shader.replace("PLACEHOLDER_COLORIZE_STEPS", colorizeSteps)
shader = shader.replace("PLACEHOLDER_COLORIZE_UNIFORMS", colorizeUniforms)
shader = shader.replace("PLACEHOLDER_MASK_STEPS", maskSteps)
shader = shader.replace("PLACEHOLDER_MASK_UNIFORMS", maskUniforms)
fragmentShader = ShaderBuilder.buildFragmentShader(shader)
}
onDeviationChanged: updateGaussianWeights()
onRadiusChanged: updateGaussianWeights()
onTransparentBorderChanged: {
buildFragmentShader()
updateGaussianWeights()
}
onMaxRadiusChanged: {
buildFragmentShader()
updateGaussianWeights()
}
Component.onCompleted: {
buildFragmentShader()
updateGaussianWeights()
}
property string fragmentShaderBegin: "#version 440
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
float qt_Opacity;
vec3 delta;
vec3 factor_0_2;
vec3 factor_3_5;
vec3 factor_6_8;
vec3 factor_9_11;
vec3 factor_12_14;
vec3 factor_15_17;
vec3 factor_18_20;
vec3 factor_21_23;
vec3 factor_24_26;
vec3 factor_27_29;
vec2 factor_30_31;
float gaussianSum;
float expandX;
float expandY;
PLACEHOLDER_COLORIZE_UNIFORMS
};
layout(binding = 1) uniform sampler2D source;
PLACEHOLDER_MASK_UNIFORMS
void main() {
vec2 shift = vec2(delta.x, delta.y);
PLACEHOLDER_MASK_STEPS
float index = delta.z;
vec2 texCoord = qt_TexCoord0;
texCoord.s = (texCoord.s - expandX) / (1.0 - 2.0 * expandX);
texCoord.t = (texCoord.t - expandY) / (1.0 - 2.0 * expandY);
texCoord += (shift * index);
fragColor = vec4(0.0, 0.0, 0.0, 0.0);
"
property string fragmentShaderEnd: "
fragColor /= gaussianSum;
PLACEHOLDER_COLORIZE_STEPS
fragColor *= qt_Opacity;
}
"
}
}

View File

@@ -0,0 +1,63 @@
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
Item {
id: rootItem
property variant source
property real radius: 0.0
property int maximumRadius: 0
property real spread: 0.0
property color color: "white"
property bool cached: false
property bool transparentBorder: false
SourceProxy {
id: sourceProxy
input: rootItem.source
sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
}
ShaderEffectSource {
id: cacheItem
anchors.fill: shaderItem
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
GaussianDirectionalBlur {
id: shaderItem
x: transparentBorder ? -maximumRadius - 1 : 0
y: transparentBorder ? -maximumRadius - 1 : 0
width: horizontalBlur.width
height: horizontalBlur.height
horizontalStep: 0.0
verticalStep: 1.0 / parent.height
source: horizontalBlur
radius: rootItem.radius
maximumRadius: rootItem.maximumRadius
transparentBorder: rootItem.transparentBorder
enableColor: true
color: rootItem.color
spread: rootItem.spread
}
GaussianDirectionalBlur {
id: horizontalBlur
width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
horizontalStep: 1.0 / parent.width
verticalStep: 0.0
source: sourceProxy.output
radius: rootItem.radius
maximumRadius: rootItem.maximumRadius
transparentBorder: rootItem.transparentBorder
visible: false
}
}

View File

@@ -0,0 +1,88 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
Item {
id: rootItem
property variant source
property real radius: 0.0
property int maximumRadius: 0
property real horizontalOffset: 0
property real verticalOffset: 0
property real spread: 0
property color color: "black"
property bool cached: false
SourceProxy {
id: sourceProxy
input: rootItem.source
}
ShaderEffectSource {
id: cacheItem
anchors.fill: shaderItem
visible: rootItem.cached
smooth: true
sourceItem: shaderItem
live: true
hideSource: visible
}
ShaderEffect{
id: shadowItem
anchors.fill: parent
property variant original: sourceProxy.output
property color color: rootItem.color
property real horizontalOffset: rootItem.horizontalOffset / rootItem.width
property real verticalOffset: rootItem.verticalOffset / rootItem.height
visible: false
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/gaussianinnershadow_shadow.frag.qsb"
}
GaussianDirectionalBlur {
id: blurItem
anchors.fill: parent
horizontalStep: 0.0
verticalStep: 1.0 / parent.height
source: horizontalBlur
radius: rootItem.radius
maximumRadius: rootItem.maximumRadius
visible: false
}
GaussianDirectionalBlur {
id: horizontalBlur
width: transparentBorder ? parent.width + 2 * maximumRadius : parent.width
height: parent.height
horizontalStep: 1.0 / parent.width
verticalStep: 0.0
source: shadowItem
radius: rootItem.radius
maximumRadius: rootItem.maximumRadius
visible: false
}
ShaderEffectSource {
id: blurredSource
sourceItem: blurItem
live: true
smooth: true
}
ShaderEffect {
id: shaderItem
anchors.fill: parent
property variant original: sourceProxy.output
property variant shadow: blurredSource
property real spread: 1.0 - (rootItem.spread * 0.98)
property color color: rootItem.color
fragmentShader: "qrc:/qt-project.org/imports/Qt5Compat/GraphicalEffects/shaders_ng/gaussianinnershadow.frag.qsb"
}
}

View File

@@ -0,0 +1,69 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// Qt-Security score:significant reason:default
import QtQuick
import Qt5Compat.GraphicalEffects.private
Item {
id: rootItem
property variant source
property variant maskSource
property real radius: 0.0
property int maximumRadius: 0
property bool cached: false
property bool transparentBorder: false
SourceProxy {
id: sourceProxy
input: rootItem.source
sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
}
SourceProxy {
id: maskSourceProxy
input: rootItem.maskSource
sourceRect: rootItem.transparentBorder ? Qt.rect(-1, -1, parent.width + 2.0, parent.height + 2.0) : Qt.rect(0, 0, 0, 0)
}
ShaderEffectSource {
id: cacheItem
anchors.fill: blur
visible: rootItem.cached
smooth: true
sourceItem: blur
live: true
hideSource: visible
}
GaussianDirectionalBlur {
id: blur
x: transparentBorder ? -maximumRadius - 1: 0
y: transparentBorder ? -maximumRadius - 1: 0
width: horizontalBlur.width
height: horizontalBlur.height
horizontalStep: 0.0
verticalStep: 1.0 / parent.height
source: horizontalBlur
enableMask: true
maskSource: maskSourceProxy.output
radius: rootItem.radius
maximumRadius: rootItem.maximumRadius
transparentBorder: rootItem.transparentBorder
}
GaussianDirectionalBlur {
id: horizontalBlur
width: transparentBorder ? parent.width + 2 * maximumRadius + 2 : parent.width
height: transparentBorder ? parent.height + 2 * maximumRadius + 2 : parent.height
horizontalStep: 1.0 / parent.width
verticalStep: 0.0
source: sourceProxy.output
enableMask: true
maskSource: maskSourceProxy.output
radius: rootItem.radius
maximumRadius: rootItem.maximumRadius
transparentBorder: rootItem.transparentBorder
visible: false
}
}

View File

@@ -0,0 +1,120 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {
Component {
file: "qgfxshaderbuilder_p.h"
lineNumber: 20
name: "QGfxShaderBuilder"
accessSemantics: "reference"
prototype: "QObject"
exports: [
"Qt5Compat.GraphicalEffects.private/ShaderBuilder 5.0",
"Qt5Compat.GraphicalEffects.private/ShaderBuilder 6.0"
]
isCreatable: false
isSingleton: true
exportMetaObjectRevisions: [1280, 1536]
Method {
name: "gaussianBlur"
type: "QVariantMap"
lineNumber: 31
Parameter { name: "parameters"; type: "QJSValue" }
}
Method {
name: "buildVertexShader"
type: "QUrl"
lineNumber: 32
Parameter { name: "code"; type: "QByteArray" }
}
Method {
name: "buildFragmentShader"
type: "QUrl"
lineNumber: 33
Parameter { name: "code"; type: "QByteArray" }
}
}
Component {
file: "qgfxsourceproxy_p.h"
lineNumber: 18
name: "QGfxSourceProxy"
accessSemantics: "reference"
defaultProperty: "data"
parentProperty: "parent"
prototype: "QQuickItem"
exports: [
"Qt5Compat.GraphicalEffects.private/SourceProxy 5.0",
"Qt5Compat.GraphicalEffects.private/SourceProxy 6.0",
"Qt5Compat.GraphicalEffects.private/SourceProxy 6.3",
"Qt5Compat.GraphicalEffects.private/SourceProxy 6.7"
]
exportMetaObjectRevisions: [1280, 1536, 1539, 1543]
Enum {
name: "Interpolation"
lineNumber: 35
values: [
"AnyInterpolation",
"NearestInterpolation",
"LinearInterpolation"
]
}
Property {
name: "input"
type: "QQuickItem"
isPointer: true
read: "input"
write: "setInput"
reset: "resetInput"
notify: "inputChanged"
index: 0
lineNumber: 22
}
Property {
name: "output"
type: "QQuickItem"
isPointer: true
read: "output"
notify: "outputChanged"
index: 1
lineNumber: 23
isReadonly: true
}
Property {
name: "sourceRect"
type: "QRectF"
read: "sourceRect"
write: "setSourceRect"
notify: "sourceRectChanged"
index: 2
lineNumber: 24
}
Property {
name: "active"
type: "bool"
read: "isActive"
notify: "activeChanged"
index: 3
lineNumber: 26
isReadonly: true
}
Property {
name: "interpolation"
type: "Interpolation"
read: "interpolation"
write: "setInterpolation"
notify: "interpolationChanged"
index: 4
lineNumber: 27
}
Signal { name: "inputChanged"; lineNumber: 62 }
Signal { name: "outputChanged"; lineNumber: 63 }
Signal { name: "sourceRectChanged"; lineNumber: 64 }
Signal { name: "activeChanged"; lineNumber: 65 }
Signal { name: "interpolationChanged"; lineNumber: 66 }
Method { name: "repolish"; lineNumber: 69 }
}
}

View File

@@ -0,0 +1,22 @@
module Qt5Compat.GraphicalEffects.private
linktarget Qt6::qtgraphicaleffectsprivate
optional plugin qtgraphicaleffectsprivateplugin
classname QtGraphicalEffectsPrivatePlugin
typeinfo plugins.qmltypes
prefer :/qt-project.org/imports/Qt5Compat/GraphicalEffects/private/
DropShadowBase 6.0 DropShadowBase.qml
DropShadowBase 1.0 DropShadowBase.qml
FastGlow 6.0 FastGlow.qml
FastGlow 1.0 FastGlow.qml
FastInnerShadow 6.0 FastInnerShadow.qml
FastInnerShadow 1.0 FastInnerShadow.qml
GaussianDirectionalBlur 6.0 GaussianDirectionalBlur.qml
GaussianDirectionalBlur 1.0 GaussianDirectionalBlur.qml
GaussianGlow 6.0 GaussianGlow.qml
GaussianGlow 1.0 GaussianGlow.qml
GaussianInnerShadow 6.0 GaussianInnerShadow.qml
GaussianInnerShadow 1.0 GaussianInnerShadow.qml
GaussianMaskedBlur 6.0 GaussianMaskedBlur.qml
GaussianMaskedBlur 1.0 GaussianMaskedBlur.qml
depends QtQuick

View File

@@ -0,0 +1,61 @@
module Qt5Compat.GraphicalEffects
linktarget Qt6::qtgraphicaleffectsplugin
optional plugin qtgraphicaleffectsplugin
classname QtGraphicalEffectsPlugin
designersupported
typeinfo qtgraphicaleffectsplugin.qmltypes
depends Qt5Compat.GraphicalEffects.private
depends QtQuick.Window
prefer :/qt-project.org/imports/Qt5Compat/GraphicalEffects/
Blend 6.0 Blend.qml
Blend 1.0 Blend.qml
BrightnessContrast 6.0 BrightnessContrast.qml
BrightnessContrast 1.0 BrightnessContrast.qml
ColorOverlay 6.0 ColorOverlay.qml
ColorOverlay 1.0 ColorOverlay.qml
Colorize 6.0 Colorize.qml
Colorize 1.0 Colorize.qml
ConicalGradient 6.0 ConicalGradient.qml
ConicalGradient 1.0 ConicalGradient.qml
Desaturate 6.0 Desaturate.qml
Desaturate 1.0 Desaturate.qml
DirectionalBlur 6.0 DirectionalBlur.qml
DirectionalBlur 1.0 DirectionalBlur.qml
Displace 6.0 Displace.qml
Displace 1.0 Displace.qml
DropShadow 6.0 DropShadow.qml
DropShadow 1.0 DropShadow.qml
FastBlur 6.0 FastBlur.qml
FastBlur 1.0 FastBlur.qml
GammaAdjust 6.0 GammaAdjust.qml
GammaAdjust 1.0 GammaAdjust.qml
GaussianBlur 6.0 GaussianBlur.qml
GaussianBlur 1.0 GaussianBlur.qml
Glow 6.0 Glow.qml
Glow 1.0 Glow.qml
HueSaturation 6.0 HueSaturation.qml
HueSaturation 1.0 HueSaturation.qml
InnerShadow 6.0 InnerShadow.qml
InnerShadow 1.0 InnerShadow.qml
LevelAdjust 6.0 LevelAdjust.qml
LevelAdjust 1.0 LevelAdjust.qml
LinearGradient 6.0 LinearGradient.qml
LinearGradient 1.0 LinearGradient.qml
MaskedBlur 6.0 MaskedBlur.qml
MaskedBlur 1.0 MaskedBlur.qml
OpacityMask 6.0 OpacityMask.qml
OpacityMask 1.0 OpacityMask.qml
RadialBlur 6.0 RadialBlur.qml
RadialBlur 1.0 RadialBlur.qml
RadialGradient 6.0 RadialGradient.qml
RadialGradient 1.0 RadialGradient.qml
RectangularGlow 6.0 RectangularGlow.qml
RectangularGlow 1.0 RectangularGlow.qml
RecursiveBlur 6.0 RecursiveBlur.qml
RecursiveBlur 1.0 RecursiveBlur.qml
ThresholdMask 6.0 ThresholdMask.qml
ThresholdMask 1.0 ThresholdMask.qml
ZoomBlur 6.0 ZoomBlur.qml
ZoomBlur 1.0 ZoomBlur.qml
depends QtQuick

View File

@@ -0,0 +1,8 @@
import QtQuick.tooling 1.2
// This file describes the plugin-supplied types contained in the library.
// It is used for QML tooling purposes only.
//
// This file was auto-generated by qmltyperegistrar.
Module {}

View File

@@ -0,0 +1,142 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
Column {
anchors.left: parent.left
anchors.right: parent.right
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Title")
SectionLayout {
rows: 1
Label {
text: qsTr("title")
}
SecondColumnLayout {
LineEdit {
backendValue: backendValues.title
Layout.fillWidth: true
}
ExpandingSpacer {
}
}
}
}
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Title Color")
ColorEditor {
caption: qsTr("titleColor")
backendValue: backendValues.titleColor
supportGradient: false
}
}
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Background Color")
ColorEditor {
caption: qsTr("backgroundColor")
backendValue: backendValues.backgroundColor
supportGradient: false
}
}
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Background")
SectionLayout {
rows: 2
Label {
text: qsTr("backgroundRoundness")
tooltip: qsTr("Diameter of the rounding circle at the corners")
Layout.fillWidth: true
}
SecondColumnLayout {
SpinBox {
backendValue: backendValues.backgroundRoundness
minimumValue: 0.1
maximumValue: 100.0
stepSize: 0.1
decimals: 1
Layout.fillWidth: true
}
}
Label {
text: qsTr("dropShadowEnabled")
tooltip: qsTr("Enable border drop shadow")
Layout.fillWidth: true
}
SecondColumnLayout {
CheckBox {
backendValue: backendValues.dropShadowEnabled
Layout.fillWidth: true
}
}
}
}
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Fill Color")
ColorEditor {
caption: qsTr("fillColor")
backendValue: backendValues.fillColor
supportGradient: false
}
}
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Plot Area Color")
ColorEditor {
caption: qsTr("plotAreaColor")
backendValue: backendValues.plotAreaColor
supportGradient: false
}
}
Section {
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Localization")
SectionLayout {
rows: 1
Label {
text: qsTr("localizeNumbers")
tooltip: qsTr("Localize numbers")
Layout.fillWidth: true
}
SecondColumnLayout {
CheckBox {
backendValue: backendValues.localizeNumbers
Layout.fillWidth: true
}
}
}
}
}

View File

@@ -0,0 +1,20 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
AreaSeries {
name: "AreaSeries"
upperSeries: LineSeries {
XYPoint { x: 0; y: 1.5 }
XYPoint { x: 1; y: 3 }
XYPoint { x: 3; y: 4.3 }
XYPoint { x: 6; y: 1.1 }
}
}
}

View File

@@ -0,0 +1,18 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
BarSeries {
name: "BarSeries"
BarSet { label: "Set1"; values: [2, 2, 3] }
BarSet { label: "Set2"; values: [5, 1, 2] }
BarSet { label: "Set3"; values: [3, 5, 8] }
}
}

View File

@@ -0,0 +1,17 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
BoxPlotSeries {
name: "BoxPlotSeries"
BoxSet { label: "Set1"; values: [3, 4, 5.1, 6.2, 8.5] }
BoxSet { label: "Set2"; values: [5, 6, 7.5, 8.6, 11.8] }
BoxSet { label: "Set3"; values: [3.2, 5, 5.7, 8, 9.2] }
}
}

View File

@@ -0,0 +1,18 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
HorizontalBarSeries {
name: "HorizontalBarSeries"
BarSet { label: "Set1"; values: [2, 2, 3] }
BarSet { label: "Set2"; values: [5, 1, 2] }
BarSet { label: "Set3"; values: [3, 5, 8] }
}
}

View File

@@ -0,0 +1,18 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
HorizontalPercentBarSeries {
name: "HorizontalPercentBarSeries"
BarSet { label: "Set1"; values: [2, 2, 3] }
BarSet { label: "Set2"; values: [5, 1, 2] }
BarSet { label: "Set3"; values: [3, 5, 8] }
}
}

View File

@@ -0,0 +1,18 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
HorizontalStackedBarSeries {
name: "HorizontalStackedBarSeries"
BarSet { label: "Set1"; values: [2, 2, 3] }
BarSet { label: "Set2"; values: [5, 1, 2] }
BarSet { label: "Set3"; values: [3, 5, 8] }
}
}

View File

@@ -0,0 +1,19 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
LineSeries {
name: "LineSeries"
XYPoint { x: 0; y: 2 }
XYPoint { x: 1; y: 1.2 }
XYPoint { x: 2; y: 3.3 }
XYPoint { x: 5; y: 2.1 }
}
}

View File

@@ -0,0 +1,18 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
PercentBarSeries {
name: "PercentBarSeries"
BarSet { label: "Set1"; values: [2, 2, 3] }
BarSet { label: "Set2"; values: [5, 1, 2] }
BarSet { label: "Set3"; values: [3, 5, 8] }
}
}

View File

@@ -0,0 +1,17 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
PieSeries {
name: "PieSeries"
PieSlice { label: "Slice1"; value: 13.5 }
PieSlice { label: "Slice2"; value: 10.9 }
PieSlice { label: "Slice3"; value: 8.6 }
}
}

View File

@@ -0,0 +1,49 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
PolarChartView {
width: 300
height: 300
legend.visible: false
ValueAxis {
id: axis1
tickCount: 9
}
ValueAxis {
id: axis2
}
LineSeries {
id: lowerLine
axisAngular: axis1
axisRadial: axis2
XYPoint { x: 1; y: 5 }
XYPoint { x: 2; y: 10 }
XYPoint { x: 3; y: 12 }
XYPoint { x: 4; y: 17 }
XYPoint { x: 5; y: 20 }
}
LineSeries {
id: upperLine
axisAngular: axis1
axisRadial: axis2
XYPoint { x: 1; y: 5 }
XYPoint { x: 2; y: 14 }
XYPoint { x: 3; y: 20 }
XYPoint { x: 4; y: 32 }
XYPoint { x: 5; y: 35 }
}
AreaSeries {
name: "AreaSeries"
axisAngular: axis1
axisRadial: axis2
lowerSeries: lowerLine
upperSeries: upperLine
}
}

View File

@@ -0,0 +1,28 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
PolarChartView {
width: 300
height: 300
LineSeries {
name: "LineSeries"
axisRadial: CategoryAxis {
min: 0
max: 20
}
axisAngular: ValueAxis {
tickCount: 9
}
XYPoint { x: 0; y: 4.3 }
XYPoint { x: 2; y: 4.7 }
XYPoint { x: 4; y: 5.2 }
XYPoint { x: 6; y: 6.1 }
XYPoint { x: 8; y: 12.9 }
XYPoint { x: 9; y: 19.2 }
}
}

View File

@@ -0,0 +1,26 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
PolarChartView {
width: 300
height: 300
ScatterSeries {
name: "ScatterSeries"
axisRadial: CategoryAxis {
min: 0
max: 20
}
axisAngular: ValueAxis {
tickCount: 9
}
XYPoint { x: 0; y: 4.3 }
XYPoint { x: 2; y: 4.7 }
XYPoint { x: 4; y: 5.2 }
XYPoint { x: 8; y: 12.9 }
XYPoint { x: 9; y: 19.2 }
}
}

View File

@@ -0,0 +1,28 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
PolarChartView {
width: 300
height: 300
SplineSeries {
name: "SplineSeries"
axisRadial: CategoryAxis {
min: 0
max: 20
}
axisAngular: ValueAxis {
tickCount: 9
}
XYPoint { x: 0; y: 4.3 }
XYPoint { x: 2; y: 4.7 }
XYPoint { x: 4; y: 5.2 }
XYPoint { x: 6; y: 6.1 }
XYPoint { x: 8; y: 12.9 }
XYPoint { x: 9; y: 19.2 }
}
}

View File

@@ -0,0 +1,18 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
ScatterSeries {
name: "ScatterSeries"
XYPoint { x: 1; y: 1 }
XYPoint { x: 2; y: 4 }
XYPoint { x: 4; y: 2 }
XYPoint { x: 5; y: 5 }
}
}

View File

@@ -0,0 +1,18 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
SplineSeries {
name: "SplineSeries"
XYPoint { x: 0; y: 1 }
XYPoint { x: 3; y: 4.3 }
XYPoint { x: 5; y: 3.1 }
XYPoint { x: 8; y: 5.8 }
}
}

View File

@@ -0,0 +1,18 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick 2.0
import QtCharts 2.0
ChartView {
width: 300
height: 300
StackedBarSeries {
name: "StackedBarSeries"
BarSet { label: "Set1"; values: [2, 2, 3] }
BarSet { label: "Set2"; values: [5, 1, 2] }
BarSet { label: "Set3"; values: [3, 5, 8] }
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More