Welcome to mirror list, hosted at ThFree Co, Russian Federation.

color.hpp « drape - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d5f88fc6864b7a6d8d65abcb9b70ce1398cf3aeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once

#include "../std/stdint.hpp"

namespace dp
{

struct Color
{
  Color();
  Color(uint8_t red, uint8_t green, uint8_t blue, uint8_t alfa);

  bool operator <  (Color const & other) const;
  bool operator == (Color const & other) const;

  uint8_t m_red;
  uint8_t m_green;
  uint8_t m_blue;
  uint8_t m_alfa;

  int GetColorInInt() const { return (m_alfa << 24) | (m_blue << 16) | (m_green << 8) | m_red; }
};

struct ColorF
{
  ColorF() {}
  ColorF(Color const & clr);
  ColorF(float r, float g, float b, float a) : m_r (r), m_g (g), m_b (b), m_a (a) {}

  bool operator <  (ColorF const & other) const;
  bool operator == (ColorF const & other) const;

  float m_r;
  float m_g;
  float m_b;
  float m_a;
};

inline uint8_t ExtractRed(uint32_t argb);
inline uint8_t ExtractGreen(uint32_t argb);
inline uint8_t ExtractBlue(uint32_t argb);
inline uint8_t ExtractAlfa(uint32_t argb);
Color Extract(uint32_t argb);
Color Extract(uint32_t xrgb, uint8_t a);
void  Convert(Color const & c, float & r, float & g, float & b, float & a);

}