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: 16e7c7bac9867f32040b7012fd8dd39b44412b13 (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
#pragma once

#include "std/cstdint.hpp"

namespace dp
{

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

  uint8_t GetRed() const;
  uint8_t GetGreen() const;
  uint8_t GetBlue() const;
  uint8_t GetAlfa() const;

  bool operator< (Color const & other) const { return m_rgba < other.m_rgba; }

  static Color Black()             { return Color(0, 0, 0, 255); }
  static Color White()             { return Color(255, 255, 255, 255); }
  static Color Red()               { return Color(255, 0, 0, 255); }
  static Color Transparent()       { return Color(0, 0, 0, 0); }
  static Color RoadNumberOutline() { return Color(150, 75, 0, 255); }

private:
  uint32_t m_rgba;
};

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);

}