1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
SDL_Texture::RGB DLL_ACT SDL_Texture::PixelFonctor::AngulareCircle::operator() (unsigned int x, unsigned int y)
{
//Schéma
//|\_
//| \_
//| \_
//|______\_
// R
//RGB du pixel retourner
RGB Color;
//Aplication d'un modulo pour retoruner a un cercle de rayon R;
int NewR;
if(x%R > y%R)
NewR = (x + R-x%R);
else
NewR = (y + R-y%R);
if( x*x + y*y >= (NewR-BorderW)*(NewR-BorderW) && x*x + y*y <= NewR*NewR )
{
int Cof = 1;
Color.r = (unsigned char)(Cof * (float)M_R);
Color.g = (unsigned char)(Cof * (float)M_G);
Color.b = (unsigned char)(Cof * (float)M_B);
}
else
{
//Les espaces sont les diférence de 0xFF et des masques
Color.r = 0xFF - M_R;
Color.g = 0xFF - M_G;
Color.b = 0xFF - M_B;
}
return Color;
} |
Partager