1// LAF OS Library
2// Copyright (c) 2018-2020 Igara Studio S.A.
3//
4// This file is released under the terms of the MIT license.
5// Read LICENSE.txt for more information.
6
7#ifndef OS_COLOR_SPACE_H_INCLUDED
8#define OS_COLOR_SPACE_H_INCLUDED
9#pragma once
10
11#include "gfx/color_space.h"
12#include "os/ref.h"
13
14#include <cstdint>
15
16namespace os {
17
18 class ColorSpace;
19 using ColorSpaceRef = Ref<ColorSpace>;
20
21 class ColorSpace : public RefCount {
22 public:
23 virtual ~ColorSpace() { }
24 virtual const gfx::ColorSpaceRef& gfxColorSpace() const = 0;
25 virtual const bool isSRGB() const = 0;
26 };
27
28 class ColorSpaceConversion : public RefCount {
29 public:
30 virtual ~ColorSpaceConversion() { }
31 // Transform RGBA pixels between two color spaces.
32 virtual bool convertRgba(uint32_t* dst, const uint32_t* src, int n) = 0;
33 // Transform grayscale pixels (without alpha) between two color spaces.
34 virtual bool convertGray(uint8_t* dst, const uint8_t* src, int n) = 0;
35 };
36
37} // namespace os
38
39#endif
40