CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Common/Data/Color/RGBAUtil.h
Views: 1401
1
#pragma once
2
3
#include <cstdint>
4
5
uint32_t whiteAlpha(float alpha);
6
uint32_t blackAlpha(float alpha);
7
uint32_t colorAlpha(uint32_t color, float alpha);
8
uint32_t colorBlend(uint32_t color, uint32_t color2, float alpha);
9
uint32_t alphaMul(uint32_t color, float alphaMul);
10
uint32_t rgba(float r, float g, float b, float alpha);
11
uint32_t rgba_clamp(float r, float g, float b, float alpha);
12
13
typedef unsigned int Color;
14
15
#define COLOR(i) (((i&0xFF) << 16) | (i & 0xFF00) | ((i & 0xFF0000) >> 16) | 0xFF000000)
16
inline Color darkenColor(Color color) {
17
return (color & 0xFF000000) | ((color >> 1) & 0x7F7F7F);
18
}
19
20
inline Color lightenColor(Color color) {
21
color = ~color;
22
color = (color & 0xFF000000) | ((color >> 1) & 0x7F7F7F);
23
return ~color;
24
}
25
26