#include "fx_colors.h"

color GetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
    color c;
    c.r = r;
    c.g = g;
    c.b = b;
	c.a = a;
    return c;
}

void SetPalette(unsigned int *pal, color c0, color c1, int n0, int n1)
{
	float cr = c0.r;
    float cg = c0.g;
    float cb = c0.b;
    float ca = c0.a;

	float dr = (float)(c1.r - c0.r) / (float)(n1 - n0);
	float dg = (float)(c1.g - c0.g) / (float)(n1 - n0);
	float db = (float)(c1.b - c0.b) / (float)(n1 - n0);
	float da = (float)(c1.a - c0.a) / (float)(n1 - n0);

    int i;
	for (i=n0; i<=n1; i++)
	{
    	pal[i]= ((((int)ca)<<24) | ((int)cb)<<16) | (((int)cg)<<8) | ((int)cr);
    	cr+=dr;
        cg+=dg;
        cb+=db;
		ca+=da;
	}
}
