1 /*****************************************************************************
2 
3         RgbSystem.h
4         Author: Laurent de Soras, 2016
5 
6 --- Legal stuff ---
7 
8 This program is free software. It comes without any warranty, to
9 the extent permitted by applicable law. You can redistribute it
10 and/or modify it under the terms of the Do What The Fuck You Want
11 To Public License, Version 2, as published by Sam Hocevar. See
12 http://sam.zoy.org/wtfpl/COPYING for more details.
13 
14 *Tab=3***********************************************************************/
15 
16 
17 
18 #pragma once
19 #if ! defined (fmtcl_RgbSystem_HEADER_INCLUDED)
20 #define fmtcl_RgbSystem_HEADER_INCLUDED
21 
22 #if defined (_MSC_VER)
23 	#pragma warning (4 : 4250)
24 #endif
25 
26 
27 
28 /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
29 
30 #include "fmtcl/PrimariesPreset.h"
31 
32 #include <array>
33 
34 
35 
36 namespace fmtcl
37 {
38 
39 
40 
41 class RgbSystem
42 {
43 
44 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
45 
46 public:
47 
48 	static constexpr int _nbr_planes = 3;
49 
50 	class Vec2
51 	:	public std::array <double, _nbr_planes - 1>
52 	{
53 		typedef std::array <double, _nbr_planes - 1> Inherited;
54 	public:
55 		               Vec2 () = default;
56 		               Vec2 (double c0, double c1);
57 	};
58 
59 	               RgbSystem ();
60 	               RgbSystem (const RgbSystem &other)  = default;
61 	               RgbSystem (RgbSystem &&other)       = default;
62 	virtual        ~RgbSystem ()                       = default;
63 	RgbSystem &    operator = (const RgbSystem &other) = default;
64 	RgbSystem &    operator = (RgbSystem &&other)      = default;
65 
66 	void           set (PrimariesPreset preset);
67 	bool           is_ready () const;
68 
69 	std::array <Vec2, _nbr_planes>      // x,y coordinates for R, G and B
70 	               _rgb;
71 	Vec2           _white;              // XYZ coordinates for the ref. white
72 	std::array <bool, _nbr_planes + 1>  // R, G, B, W
73 	               _init_flag_arr;
74 	fmtcl::PrimariesPreset              // If known
75 	               _preset;
76 
77 
78 
79 /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
80 
81 protected:
82 
83 
84 
85 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
86 
87 private:
88 
89 
90 
91 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
92 
93 private:
94 
95 	bool           operator == (const RgbSystem &other) const = delete;
96 	bool           operator != (const RgbSystem &other) const = delete;
97 
98 }; // class RgbSystem
99 
100 
101 
102 }  // namespace fmtcl
103 
104 
105 
106 //#include "fmtcl/RgbSystem.hpp"
107 
108 
109 
110 #endif   // fmtcl_RgbSystem_HEADER_INCLUDED
111 
112 
113 
114 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
115