You are not logged in.
/**
* Change a texture to sepia (old photo style).
* @see GRRLIB_FlushTex
* @param texsrc The texture source.
* @param texdest The texture grayscaled destination.
*/
void GRRLIB_BMFX_Sepia (const GRRLIB_texImg *texsrc,
GRRLIB_texImg *texdest) {
unsigned int x, y;
u16 sr,sg,sb;
u32 color;
for (y = 0; y < texsrc->h; y++) {
for (x = 0; x < texsrc->w; x++) {
color = GRRLIB_GetPixelFromtexImg(x, y, texsrc);
sr = R(color)*0.393 + G(color)*0.769 + B(color)*0.189;
sg = R(color)*0.349 + G(color)*0.686 + B(color)*0.168;
sb = R(color)*0.272 + G(color)*0.534 + B(color)*0.131;
if (sr>255) sr=255; if (sg>255) sg=255; if (sb>255) sb=255;
GRRLIB_SetPixelTotexImg(x, y, texdest,GRRLIB_GetColor(sr,sg,sb,color&0xFF));
}
}
GRRLIB_SetHandle( texdest, 0, 0 );
}based on the Grayscale effect combined with the Sepia ColorMatrix! enjoy
Offline
That's nice, I'm going to test it and certainly add it to the project (GRRLIB_bmfx.c) and lesson 2 this weekend. Thanks.
Offline
Cheers dude ![]()
svn update ![]()
Offline
LOL we both hit send at the same time
I will let you update the demo ![]()
Offline