Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
26
libs/kml/color_parser.hpp
Normal file
26
libs/kml/color_parser.hpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
|
||||
#include "types.hpp"
|
||||
|
||||
namespace kml
|
||||
{
|
||||
|
||||
template <typename Channel>
|
||||
constexpr uint32_t ToRGBA(Channel red, Channel green, Channel blue, Channel alpha = Channel(255))
|
||||
{
|
||||
return static_cast<uint8_t>(red) << 24 | static_cast<uint8_t>(green) << 16 | static_cast<uint8_t>(blue) << 8 |
|
||||
static_cast<uint8_t>(alpha);
|
||||
}
|
||||
|
||||
std::optional<uint32_t> ParseHexColor(std::string_view c);
|
||||
std::optional<uint32_t> ParseGarminColor(std::string_view c);
|
||||
std::optional<uint32_t> ParseOSMColor(std::string_view c);
|
||||
|
||||
PredefinedColor MapPredefinedColor(uint32_t rgba);
|
||||
std::string_view MapGarminColor(uint32_t rgba);
|
||||
|
||||
} // namespace kml
|
||||
Loading…
Add table
Add a link
Reference in a new issue