mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-29 02:08:08 +02:00
Merge pull request #1092 from alicevision/dev/viewerGainGamma
[ui] Viewer: fix gain/gamma and use non-linear sliders
This commit is contained in:
commit
42913c2da3
2 changed files with 23 additions and 22 deletions
|
@ -10,10 +10,11 @@ FloatingPane {
|
|||
padding: 5
|
||||
radius: 0
|
||||
|
||||
property real gainDefaultValue: 1
|
||||
property real gammaDefaultValue: 1
|
||||
property real offsetDefaultValue: 0
|
||||
property real gammaValue: gammaCtrl.value
|
||||
property real offsetValue: offsetCtrl.value
|
||||
property real slidersPowerValue: 4
|
||||
property real gainValue: Math.pow(gainCtrl.value, slidersPowerValue)
|
||||
property real gammaValue: Math.pow(gammaCtrl.value, slidersPowerValue)
|
||||
property string channelModeValue: channelsCtrl.value
|
||||
property variant colorRGBA: null
|
||||
|
||||
|
@ -44,7 +45,7 @@ FloatingPane {
|
|||
model: channels
|
||||
}
|
||||
|
||||
// offset slider
|
||||
// gain slider
|
||||
RowLayout {
|
||||
spacing: 5
|
||||
|
||||
|
@ -56,30 +57,30 @@ FloatingPane {
|
|||
ToolTip.text: "Reset Gain"
|
||||
|
||||
onClicked: {
|
||||
offsetCtrl.value = offsetDefaultValue;
|
||||
gainCtrl.value = gainDefaultValue;
|
||||
}
|
||||
}
|
||||
TextField {
|
||||
id: offsetLabel
|
||||
id: gainLabel
|
||||
|
||||
ToolTip.visible: ToolTip.text && hovered
|
||||
ToolTip.delay: 100
|
||||
ToolTip.text: "Color Gain (in linear colorspace)"
|
||||
|
||||
text: offsetValue.toFixed(2)
|
||||
Layout.preferredWidth: textMetrics_offsetValue.width
|
||||
text: gainValue.toFixed(2)
|
||||
Layout.preferredWidth: textMetrics_gainValue.width
|
||||
selectByMouse: true
|
||||
validator: doubleValidator
|
||||
onAccepted: {
|
||||
offsetCtrl.value = Number(offsetLabel.text)
|
||||
gainCtrl.value = Math.pow(Number(gainLabel.text), 1.0/slidersPowerValue)
|
||||
}
|
||||
}
|
||||
Slider {
|
||||
id: offsetCtrl
|
||||
id: gainCtrl
|
||||
Layout.fillWidth: true
|
||||
from: -1
|
||||
to: 1
|
||||
value: 0
|
||||
from: 0.01
|
||||
to: 2
|
||||
value: gainDefaultValue
|
||||
stepSize: 0.01
|
||||
}
|
||||
}
|
||||
|
@ -107,19 +108,19 @@ FloatingPane {
|
|||
ToolTip.text: "Apply Gamma (after Gain and in linear colorspace)"
|
||||
|
||||
text: gammaValue.toFixed(2)
|
||||
Layout.preferredWidth: textMetrics_offsetValue.width
|
||||
Layout.preferredWidth: textMetrics_gainValue.width
|
||||
selectByMouse: true
|
||||
validator: doubleValidator
|
||||
onAccepted: {
|
||||
gammaCtrl.value = Number(offsetLabel.text)
|
||||
gammaCtrl.value = Math.pow(Number(gammaLabel.text), 1.0/slidersPowerValue)
|
||||
}
|
||||
}
|
||||
Slider {
|
||||
id: gammaCtrl
|
||||
Layout.fillWidth: true
|
||||
from: 0.01
|
||||
to: 16
|
||||
value: 1
|
||||
to: 2
|
||||
value: gammaDefaultValue
|
||||
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"
|
||||
}
|
||||
|
||||
// gamma slider
|
||||
// RGBA colors
|
||||
RowLayout {
|
||||
spacing: 1
|
||||
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)
|
||||
}
|
||||
TextMetrics {
|
||||
id: textMetrics_offsetValue
|
||||
font: offsetLabel.font
|
||||
text: "-10.01"
|
||||
id: textMetrics_gainValue
|
||||
font: gainLabel.font
|
||||
text: "1.2345"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ FocusScope {
|
|||
setSource("FloatImage.qml", {
|
||||
'source': Qt.binding(function() { return getImageFile(imageType.type); }),
|
||||
'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; }),
|
||||
})
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue