diff --git a/Tests/LibGfx/TestICCProfile.cpp b/Tests/LibGfx/TestICCProfile.cpp index 5c5386eb1b..4af7ffa61a 100644 --- a/Tests/LibGfx/TestICCProfile.cpp +++ b/Tests/LibGfx/TestICCProfile.cpp @@ -175,7 +175,7 @@ TEST_CASE(to_lab) // // new Color("srgb", [1, 1, 1]).lab.toString(); - Gfx::ICC::Profile::CIELAB expected[] = { + Gfx::CIELAB expected[] = { { 0, 0, 0 }, { 54.29054294696968, 80.80492033462421, 69.89098825896275 }, { 87.81853633115202, -79.27108223854806, 80.99459785152247 }, diff --git a/Userland/Libraries/LibGfx/CIELAB.h b/Userland/Libraries/LibGfx/CIELAB.h new file mode 100644 index 0000000000..6aa54f7a67 --- /dev/null +++ b/Userland/Libraries/LibGfx/CIELAB.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2023, Nico Weber + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +namespace Gfx { + +// https://en.wikipedia.org/wiki/CIELAB_color_space +struct CIELAB { + float L; // L* + float a; // a* + float b; // b* +}; + +} diff --git a/Userland/Libraries/LibGfx/ICC/Profile.cpp b/Userland/Libraries/LibGfx/ICC/Profile.cpp index e0b4c5b44d..4a76a00fde 100644 --- a/Userland/Libraries/LibGfx/ICC/Profile.cpp +++ b/Userland/Libraries/LibGfx/ICC/Profile.cpp @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -1470,7 +1471,7 @@ ErrorOr Profile::to_pcs(ReadonlyBytes color) VERIFY_NOT_REACHED(); } -ErrorOr Profile::to_lab(ReadonlyBytes color) +ErrorOr Profile::to_lab(ReadonlyBytes color) { auto pcs = TRY(to_pcs(color)); if (connection_space() == ColorSpace::PCSLAB) diff --git a/Userland/Libraries/LibGfx/ICC/Profile.h b/Userland/Libraries/LibGfx/ICC/Profile.h index ec0c96f17a..b54b147877 100644 --- a/Userland/Libraries/LibGfx/ICC/Profile.h +++ b/Userland/Libraries/LibGfx/ICC/Profile.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -266,11 +267,6 @@ public: // Call connection_space() to find out the space the result is in. ErrorOr to_pcs(ReadonlyBytes); - struct CIELAB { - float L; // L* - float a; // a* - float b; // b* - }; ErrorOr to_lab(ReadonlyBytes); // Only call these if you know that this is an RGB matrix-based profile.