Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/Common/Data/Color/RGBAUtil.h
5669 views
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 colorAdd(uint32_t color, uint32_t color2);
10
uint32_t alphaMul(uint32_t color, float alphaMul);
11
uint32_t rgba(float r, float g, float b, float alpha);
12
uint32_t rgba_clamp(float r, float g, float b, float alpha);
13
14
typedef unsigned int Color;
15
16
#define COLOR(i) (((i&0xFF) << 16) | (i & 0xFF00) | ((i & 0xFF0000) >> 16) | 0xFF000000)
17
inline Color darkenColor(Color color) {
18
return (color & 0xFF000000) | ((color >> 1) & 0x7F7F7F);
19
}
20
21
inline Color lightenColor(Color color) {
22
color = ~color;
23
color = (color & 0xFF000000) | ((color >> 1) & 0x7F7F7F);
24
return ~color;
25
}
26
27