2018-10-19 02:29:16 +08:00
|
|
|
// Aseprite
|
2025-09-16 02:49:09 +08:00
|
|
|
// Copyright (c) 2018-2025 Igara Studio S.A.
|
2018-10-19 02:29:16 +08:00
|
|
|
//
|
|
|
|
// This program is distributed under the terms of
|
|
|
|
// the End-User License Agreement for Aseprite.
|
|
|
|
|
|
|
|
#ifndef APP_COLOR_SPACES_H_INCLUDED
|
|
|
|
#define APP_COLOR_SPACES_H_INCLUDED
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "gfx/color.h"
|
2018-10-24 02:03:38 +08:00
|
|
|
#include "gfx/color_space.h"
|
2018-10-19 02:29:16 +08:00
|
|
|
#include "os/color_space.h"
|
|
|
|
|
2018-10-24 02:03:38 +08:00
|
|
|
namespace doc {
|
|
|
|
class Sprite;
|
|
|
|
}
|
|
|
|
|
2025-09-16 02:49:09 +08:00
|
|
|
namespace ui {
|
|
|
|
class Display;
|
|
|
|
}
|
|
|
|
|
2018-10-19 02:29:16 +08:00
|
|
|
namespace app {
|
2025-09-16 02:49:09 +08:00
|
|
|
class Doc;
|
2019-12-11 23:27:56 +08:00
|
|
|
class Preferences;
|
2018-10-19 02:29:16 +08:00
|
|
|
|
2019-12-11 23:27:56 +08:00
|
|
|
void initialize_color_spaces(Preferences& pref);
|
2019-04-02 02:44:49 +08:00
|
|
|
|
2018-10-19 02:29:16 +08:00
|
|
|
// Returns the color space of the current document.
|
2025-09-16 02:49:09 +08:00
|
|
|
os::ColorSpaceRef get_current_color_space(ui::Display* display, Doc* doc = nullptr);
|
2018-10-19 02:29:16 +08:00
|
|
|
|
2020-07-08 06:06:48 +08:00
|
|
|
gfx::ColorSpaceRef get_working_rgb_space_from_preferences();
|
2018-10-24 02:03:38 +08:00
|
|
|
|
2018-10-19 02:29:16 +08:00
|
|
|
class ConvertCS {
|
|
|
|
public:
|
2025-09-16 02:49:09 +08:00
|
|
|
ConvertCS() = delete;
|
|
|
|
ConvertCS(ui::Display* display, Doc* doc = nullptr);
|
2020-07-08 06:06:48 +08:00
|
|
|
ConvertCS(const os::ColorSpaceRef& srcCS, const os::ColorSpaceRef& dstCS);
|
2018-10-19 02:29:16 +08:00
|
|
|
ConvertCS(ConvertCS&&);
|
|
|
|
ConvertCS& operator=(const ConvertCS&) = delete;
|
|
|
|
gfx::Color operator()(const gfx::Color c);
|
|
|
|
|
2024-12-17 01:52:19 +08:00
|
|
|
private:
|
2020-07-08 06:06:48 +08:00
|
|
|
os::Ref<os::ColorSpaceConversion> m_conversion;
|
2024-12-17 01:52:19 +08:00
|
|
|
};
|
|
|
|
|
2025-09-16 02:49:09 +08:00
|
|
|
ConvertCS convert_from_current_to_display_color_space(ui::Display* display);
|
2020-07-08 06:06:48 +08:00
|
|
|
ConvertCS convert_from_custom_to_srgb(const os::ColorSpaceRef& from);
|
2018-10-19 02:29:16 +08:00
|
|
|
|
|
|
|
} // namespace app
|
|
|
|
|
|
|
|
#endif
|