You are not logged in.
In GRRLIB.h add
u8 GRRLIB_GetRed(u32 color); u8 GRRLIB_GetGreen(u32 color); u8 GRRLIB_GetBlue(u32 color); u8 GRRLIB_GetAlpha(u32 color); u32 GRRLIB_MakeColor(u8 red, u8 green, u8 blue, u8 alpha); u32 GRRLIB_ChangeAlpha(u32 color, u8 alpha);
In GRRLIB.c add
/** * Returns red level of color. * @param color specifies color. * @return red level. */ u8 GRRLIB_GetRed(u32 color) { return (color >> 24) & 0x000000FF; } /** * Returns green level of color. * @param color specifies color. * @return green level. */ u8 GRRLIB_GetGreen(u32 color) { return (color >> 16) & 0x000000FF; } /** * Returns blue level of color. * @param color specifies color. * @return blue level. */ u8 GRRLIB_GetBlue(u32 color) { return (color >> 8) & 0x000000FF; } /** * Returns alpha level of color. * @param color specifies color. * @return alpha level. */ u8 GRRLIB_GetAlpha(u32 color) { return (color & 0x000000FF); } /** * Returns color. * @param red specifies red level. * @param green specifies red level. * @param blue specifies blue level. * @param alpha specifies alpha level. * @return 32-bit color */ u32 GRRLIB_MakeColor(u8 red, u8 green, u8 blue, u8 alpha) { u32 color; color = red; color = (color << 8) | green; color = (color << 8) | blue; color = (color << 8) | alpha; return color; } /** * Returns color with changed alpha level. * @param color specifies original color. * @param a specifies new alpha. * @return color with changed alpha level. */ u32 GRRLIB_ChangeAlpha(u32 color, u8 alpha) { return (color & 0xFFFFFF00) | alpha; }
Last edited by spiffen (2009-02-25 17:20:51)
Offline