#ifndef _PIUMA_LIB_COLOR_H_
#define _PIUMA_LIB_COLOR_H_

#include "math.h"
#include "types.h"

inline u32 convert_color_to_ABGR_u32(v4 color)
{
	u32 r = 0xFF * color.r;
	u32 g = 0xFF * color.g;
	u32 b = 0xFF * color.b;
	u32 a = 0xFF * color.a;
	return (a << 24) | (b << 16) | (g << 8) | (r);
}

inline v4 convert_ABGR_u32_to_color(u32 color)
{
	f32 r = (f32)((color >>  0) & 0xFF) / (f32)(0xFF);
	f32 g = (f32)((color >>  8) & 0xFF) / (f32)(0xFF);
	f32 b = (f32)((color >> 16) & 0xFF) / (f32)(0xFF);
	f32 a = (f32)((color >> 24) & 0xFF) / (f32)(0xFF);
	return v4{r, g, b, a};
}

#endif
