1// Aseprite
2// Copyright (c) 2018-2020 Igara Studio S.A.
3//
4// This program is distributed under the terms of
5// the End-User License Agreement for Aseprite.
6
7#ifndef APP_COLOR_SPACES_H_INCLUDED
8#define APP_COLOR_SPACES_H_INCLUDED
9#pragma once
10
11#include "gfx/color.h"
12#include "gfx/color_space.h"
13#include "os/color_space.h"
14
15namespace doc {
16 class Sprite;
17}
18
19namespace app {
20 class Preferences;
21
22 void initialize_color_spaces(Preferences& pref);
23
24 os::ColorSpaceRef get_screen_color_space();
25
26 // Returns the color space of the current document.
27 os::ColorSpaceRef get_current_color_space();
28
29 gfx::ColorSpaceRef get_working_rgb_space_from_preferences();
30
31 class ConvertCS {
32 public:
33 ConvertCS();
34 ConvertCS(const os::ColorSpaceRef& srcCS,
35 const os::ColorSpaceRef& dstCS);
36 ConvertCS(ConvertCS&&);
37 ConvertCS& operator=(const ConvertCS&) = delete;
38 gfx::Color operator()(const gfx::Color c);
39 private:
40 os::Ref<os::ColorSpaceConversion> m_conversion;
41 };
42
43 ConvertCS convert_from_current_to_screen_color_space();
44 ConvertCS convert_from_custom_to_srgb(const os::ColorSpaceRef& from);
45
46} // namespace app
47
48#endif
49