Skip to content
36 changes: 36 additions & 0 deletions meshroom/ui/qml/Viewer/HdrImageToolbar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ FloatingPane {
property real gammaValue: Math.pow(gammaCtrl.value, slidersPowerValue)
property alias channelModeValue: channelsCtrl.value
property variant colorRGBA: null
property variant mousePosition: ({x:0, y:0})

property bool colorPickerVisible: true

property variant pixelX: null
property variant pixelY: null

background: Rectangle { color: root.palette.window }

DoubleValidator {
Expand Down Expand Up @@ -136,6 +140,37 @@ FloatingPane {
}
}

RowLayout {

Label {
text: "x"
}
TextField {
id: xPixel
text: root.mousePosition ? root.mousePosition.x : null
Layout.preferredWidth: 50
Comment thread
nicolas-lambert-tc marked this conversation as resolved.
Outdated
validator: IntValidator {}
Comment thread
nicolas-lambert-tc marked this conversation as resolved.
Outdated
onTextEdited: {
const xPixelValue = parseInt(xPixel.text)
pixelX = Number.isNaN(xPixelValue) ? null : xPixelValue
}
}
Label {
text: "y"
}
TextField {
id: yPixel
text: root.mousePosition ? root.mousePosition.y : null
Layout.preferredWidth: 50
Comment thread
nicolas-lambert-tc marked this conversation as resolved.
Outdated
validator: IntValidator {}
Comment thread
nicolas-lambert-tc marked this conversation as resolved.
Outdated
onTextEdited: {
const yPixelValue = parseInt(yPixel.text)
pixelY = Number.isNaN(yPixelValue) ? null : yPixelValue
}
}

}

Rectangle {
visible: colorPickerVisible
Layout.preferredWidth: 20
Expand All @@ -148,6 +183,7 @@ FloatingPane {
RowLayout {
spacing: 1
visible: colorPickerVisible

TextField {
id: red
property real value: root.colorRGBA ? root.colorRGBA.x : 0.0
Expand Down
21 changes: 17 additions & 4 deletions meshroom/ui/qml/Viewer/Viewer2D.qml
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,30 @@ FocusScope {
}

colorRGBA: {

if (!floatImageViewerLoader.item ||
floatImageViewerLoader.item.imageStatus !== Image.Ready) {
return null
}
if (floatImageViewerLoader.item.containsMouse === false) {

/// Get the pixel color value at mouse position (when mouse hover the image)
if (mousePosition && floatImageViewerLoader.item.containsMouse === true) {
return floatImageViewerLoader.item.pixelValueAt( mousePosition.x, mousePosition.y )
}

if ( !Number.isInteger(pixelX) || !Number.isInteger(pixelY) ) {
return null
}
var pix = floatImageViewerLoader.item.pixelValueAt(Math.floor(floatImageViewerLoader.item.mouseX),
Math.floor(floatImageViewerLoader.item.mouseY))
return pix

// Get the pixel color value from text field value (let the possibility to user to set the x,y from ui)
return floatImageViewerLoader.item.pixelValueAt( parseInt(pixelX) , parseInt(pixelY) )

}

mousePosition: (floatImageViewerLoader.item.containsMouse ? {
x: Math.floor(floatImageViewerLoader.item.mouseX),
y: Math.floor(floatImageViewerLoader.item.mouseY)
} : null)
}

LensDistortionToolbar {
Expand Down