diff --git a/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs b/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs index ab3a3fa17..e30e9438d 100644 --- a/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs +++ b/Source/Editor/GUI/Dialogs/ColorPickerDialog.cs @@ -1,6 +1,7 @@ // Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. using FlaxEditor.GUI.Input; +using FlaxEditor.Windows; using FlaxEngine; using FlaxEngine.GUI; using System; @@ -212,7 +213,15 @@ namespace FlaxEditor.GUI.Dialogs private void OnEyedropColor() { - Editor.Log("Color: " + Screenshot.GetPixelAt(7, 6).ToString()); + Float2 mousePosition = new Float2(0, 0); + foreach (EditorWindow window in Editor.Instance.Windows.Windows) + { + if (window.IsMouseOver) + { + mousePosition = window.RootWindow.MousePosition; + } + } + Editor.Log("Color: " + Screenshot.GetPixelAt(Mathf.FloorToInt(mousePosition.X), Mathf.FloorToInt(mousePosition.Y)).ToString()); } private void OnRGBAChanged() diff --git a/Source/Engine/Utilities/Screenshot.cpp b/Source/Engine/Utilities/Screenshot.cpp index 553801e5b..c946ef695 100644 --- a/Source/Engine/Utilities/Screenshot.cpp +++ b/Source/Engine/Utilities/Screenshot.cpp @@ -174,10 +174,11 @@ bool GetPixelData::Run() TextureMipData *mipData = _data.GetData(0, 0); Array pixels; mipData->GetPixels(pixels, _data.Width, _data.Height, _data.Format); - - _color = pixels[(y * _data.Width) + x]; - LOG(Warning, "really real"); - LOG(Warning, "Color: {0} {1} {2}", _color.R, _color.B, _color.G); + + LOG(Warning, "{0}, {1} ({2} at {3})", x, y, pixels.Count(), (y * _data.Width) + x); + //_color = pixels[(y * _data.Width) + x]; + //LOG(Warning, "really real"); + //LOG(Warning, "Color: {0} {1} {2}", _color.R, _color.B, _color.G); return false; }