get/set clipboard, color hex value

This commit is contained in:
2019-06-24 23:46:55 +02:00
parent 2782d864ed
commit f9cf452af2
7 changed files with 129 additions and 0 deletions

View File

@@ -485,6 +485,22 @@ glm::vec4 rand_color()
return { r, g, b, 1.f };
}
glm::vec3 convert_long_rgb(unsigned long hex)
{
uint8_t b = (hex >> 0) & 0xFF;
uint8_t g = (hex >> 8) & 0xFF;
uint8_t r = (hex >> 16) & 0xFF;
return glm::vec3(r, g, b) / 255.f;
}
unsigned long convert_rgb_long(glm::vec3 rgb)
{
uint8_t r = (uint8_t)(rgb.r * 255.f);
uint8_t g = (uint8_t)(rgb.g * 255.f);
uint8_t b = (uint8_t)(rgb.b * 255.f);
return (r << 16) + (g << 8) + b;
}
glm::vec3 convert_hsv2rgb(const glm::vec3 c)
{
glm::vec4 K = glm::vec4(1.0f, 2.0f / 3.0f, 1.0f / 3.0f, 3.0f);
@@ -594,6 +610,24 @@ std::string str_replace(const std::string& string, const std::string& search, co
return ret;
}
std::string clipboard_get_text()
{
#if _WIN32
extern std::string win32_clipboard_get_text();
return win32_clipboard_get_text();
#elif _IOS_
#endif
}
bool clipboard_set_text(const std::string& s)
{
#if _WIN32
extern bool win32_clipboard_set_text(const std::string & s);
return win32_clipboard_set_text(s);
#elif _IOS_
#endif
}
static const char* gl2str(GLenum err)
{
switch (err)