mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-03 03:11:56 +02:00
[ui] Viewer: non-linear gain/gamma sliders
Update param renaming from "offset" to "gain" in QtAliceVision.
This commit is contained in:
parent
7dc44a3441
commit
dd94bc8a91
2 changed files with 23 additions and 22 deletions
|
@ -10,10 +10,11 @@ FloatingPane {
|
||||||
padding: 5
|
padding: 5
|
||||||
radius: 0
|
radius: 0
|
||||||
|
|
||||||
|
property real gainDefaultValue: 1
|
||||||
property real gammaDefaultValue: 1
|
property real gammaDefaultValue: 1
|
||||||
property real offsetDefaultValue: 0
|
property real slidersPowerValue: 4
|
||||||
property real gammaValue: gammaCtrl.value
|
property real gainValue: Math.pow(gainCtrl.value, slidersPowerValue)
|
||||||
property real offsetValue: offsetCtrl.value
|
property real gammaValue: Math.pow(gammaCtrl.value, slidersPowerValue)
|
||||||
property string channelModeValue: channelsCtrl.value
|
property string channelModeValue: channelsCtrl.value
|
||||||
property variant colorRGBA: null
|
property variant colorRGBA: null
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ FloatingPane {
|
||||||
model: channels
|
model: channels
|
||||||
}
|
}
|
||||||
|
|
||||||
// offset slider
|
// gain slider
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: 5
|
spacing: 5
|
||||||
|
|
||||||
|
@ -56,30 +57,30 @@ FloatingPane {
|
||||||
ToolTip.text: "Reset Gain"
|
ToolTip.text: "Reset Gain"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
offsetCtrl.value = offsetDefaultValue;
|
gainCtrl.value = gainDefaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TextField {
|
TextField {
|
||||||
id: offsetLabel
|
id: gainLabel
|
||||||
|
|
||||||
ToolTip.visible: ToolTip.text && hovered
|
ToolTip.visible: ToolTip.text && hovered
|
||||||
ToolTip.delay: 100
|
ToolTip.delay: 100
|
||||||
ToolTip.text: "Color Gain (in linear colorspace)"
|
ToolTip.text: "Color Gain (in linear colorspace)"
|
||||||
|
|
||||||
text: offsetValue.toFixed(2)
|
text: gainValue.toFixed(2)
|
||||||
Layout.preferredWidth: textMetrics_offsetValue.width
|
Layout.preferredWidth: textMetrics_gainValue.width
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
validator: doubleValidator
|
validator: doubleValidator
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
offsetCtrl.value = Number(offsetLabel.text)
|
gainCtrl.value = Math.pow(Number(gainLabel.text), 1.0/slidersPowerValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Slider {
|
Slider {
|
||||||
id: offsetCtrl
|
id: gainCtrl
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
from: -1
|
from: 0.01
|
||||||
to: 1
|
to: 2
|
||||||
value: 0
|
value: gainDefaultValue
|
||||||
stepSize: 0.01
|
stepSize: 0.01
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,19 +108,19 @@ FloatingPane {
|
||||||
ToolTip.text: "Apply Gamma (after Gain and in linear colorspace)"
|
ToolTip.text: "Apply Gamma (after Gain and in linear colorspace)"
|
||||||
|
|
||||||
text: gammaValue.toFixed(2)
|
text: gammaValue.toFixed(2)
|
||||||
Layout.preferredWidth: textMetrics_offsetValue.width
|
Layout.preferredWidth: textMetrics_gainValue.width
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
validator: doubleValidator
|
validator: doubleValidator
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
gammaCtrl.value = Number(offsetLabel.text)
|
gammaCtrl.value = Math.pow(Number(gammaLabel.text), 1.0/slidersPowerValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Slider {
|
Slider {
|
||||||
id: gammaCtrl
|
id: gammaCtrl
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
from: 0.01
|
from: 0.01
|
||||||
to: 16
|
to: 2
|
||||||
value: 1
|
value: gammaDefaultValue
|
||||||
stepSize: 0.01
|
stepSize: 0.01
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +132,7 @@ FloatingPane {
|
||||||
color: root.colorRGBA ? Qt.rgba(red.value_gamma, green.value_gamma, blue.value_gamma, 1.0) : "black"
|
color: root.colorRGBA ? Qt.rgba(red.value_gamma, green.value_gamma, blue.value_gamma, 1.0) : "black"
|
||||||
}
|
}
|
||||||
|
|
||||||
// gamma slider
|
// RGBA colors
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: 1
|
spacing: 1
|
||||||
TextField {
|
TextField {
|
||||||
|
@ -230,8 +231,8 @@ FloatingPane {
|
||||||
text: "1.2345" // use one more than expected to get the correct value (probably needed due to TextField margin)
|
text: "1.2345" // use one more than expected to get the correct value (probably needed due to TextField margin)
|
||||||
}
|
}
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
id: textMetrics_offsetValue
|
id: textMetrics_gainValue
|
||||||
font: offsetLabel.font
|
font: gainLabel.font
|
||||||
text: "-10.01"
|
text: "1.2345"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,7 @@ FocusScope {
|
||||||
setSource("FloatImage.qml", {
|
setSource("FloatImage.qml", {
|
||||||
'source': Qt.binding(function() { return getImageFile(imageType.type); }),
|
'source': Qt.binding(function() { return getImageFile(imageType.type); }),
|
||||||
'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue; }),
|
'gamma': Qt.binding(function() { return hdrImageToolbar.gammaValue; }),
|
||||||
'offset': Qt.binding(function() { return hdrImageToolbar.offsetValue; }),
|
'gain': Qt.binding(function() { return hdrImageToolbar.gainValue; }),
|
||||||
'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue; }),
|
'channelModeString': Qt.binding(function() { return hdrImageToolbar.channelModeValue; }),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue