Negative, Fade, Darken, Tint and Cartoon all now apply with a circular shape, rather than a square.

This commit is contained in:
William Kendrick 2006-02-18 09:53:02 +00:00
parent 7448cd879d
commit 79141902ee
2 changed files with 97 additions and 67 deletions

View file

@ -33,6 +33,10 @@ $Id$
------------------------ ------------------------
* Sparkles can now be different colors. * Sparkles can now be different colors.
* Negative, Fade, Darken, Tint and Cartoon all now apply with a circular
shape, rather than a square.
* Translation Updates: * Translation Updates:
-------------------- --------------------
* Brazilian Portuguese * Brazilian Portuguese

View file

@ -1790,6 +1790,7 @@ static SDL_Surface * duplicate_surface(SDL_Surface * orig);
static void mirror_starter(void); static void mirror_starter(void);
static void flip_starter(void); static void flip_starter(void);
int valid_click(Uint8 button); int valid_click(Uint8 button);
int in_circle(int x, int y);
#ifdef DEBUG #ifdef DEBUG
static char * debug_gettext(const char * str); static char * debug_gettext(const char * str);
@ -4944,6 +4945,8 @@ static void blit_magic(int x, int y, int button_down)
for (yy = y - 16; yy < y + 16; yy++) for (yy = y - 16; yy < y + 16; yy++)
{ {
for (xx = x - 16; xx < x + 16; xx++) for (xx = x - 16; xx < x + 16; xx++)
{
if (in_circle(xx - x, yy - y))
{ {
SDL_GetRGB(getpixel_last(last, xx, yy), last->format, SDL_GetRGB(getpixel_last(last, xx, yy), last->format,
&r, &g, &b); &r, &g, &b);
@ -4955,6 +4958,7 @@ static void blit_magic(int x, int y, int button_down)
putpixel(canvas, xx, yy, SDL_MapRGB(canvas->format, r, g, b)); putpixel(canvas, xx, yy, SDL_MapRGB(canvas->format, r, g, b));
} }
} }
}
SDL_UnlockSurface(canvas); SDL_UnlockSurface(canvas);
SDL_UnlockSurface(last); SDL_UnlockSurface(last);
@ -4967,6 +4971,8 @@ static void blit_magic(int x, int y, int button_down)
for (yy = y - 16; yy < y + 16; yy++) for (yy = y - 16; yy < y + 16; yy++)
{ {
for (xx = x - 16; xx < x + 16; xx++) for (xx = x - 16; xx < x + 16; xx++)
{
if (in_circle(xx - x, yy - y))
{ {
/* Get original color: */ /* Get original color: */
@ -4989,6 +4995,7 @@ static void blit_magic(int x, int y, int button_down)
putpixel(canvas, xx, yy, SDL_MapRGB(canvas->format, r, g, b)); putpixel(canvas, xx, yy, SDL_MapRGB(canvas->format, r, g, b));
} }
} }
}
SDL_UnlockSurface(canvas); SDL_UnlockSurface(canvas);
SDL_UnlockSurface(last); SDL_UnlockSurface(last);
@ -5006,6 +5013,8 @@ static void blit_magic(int x, int y, int button_down)
for (yy = y - 16; yy < y + 16; yy++) for (yy = y - 16; yy < y + 16; yy++)
{ {
for (xx = x - 16; xx < x + 16; xx++) for (xx = x - 16; xx < x + 16; xx++)
{
if (in_circle(xx - x, yy - y))
{ {
/* Get original pixel: */ /* Get original pixel: */
@ -5023,6 +5032,7 @@ static void blit_magic(int x, int y, int button_down)
linear_to_sRGB(bd * old))); linear_to_sRGB(bd * old)));
} }
} }
}
SDL_UnlockSurface(canvas); SDL_UnlockSurface(canvas);
SDL_UnlockSurface(last); SDL_UnlockSurface(last);
@ -5041,6 +5051,8 @@ static void blit_magic(int x, int y, int button_down)
for (yy = y - 16; yy < y + 16; yy = yy + 1) for (yy = y - 16; yy < y + 16; yy = yy + 1)
{ {
for (xx = x - 16; xx < x + 16; xx = xx + 1) for (xx = x - 16; xx < x + 16; xx = xx + 1)
{
if (in_circle(xx - x, yy - y))
{ {
/* Get original color: */ /* Get original color: */
@ -5100,12 +5112,15 @@ static void blit_magic(int x, int y, int button_down)
*/ */
} }
} }
}
/* Then, draw dark outlines where there's a large contrast change */ /* Then, draw dark outlines where there's a large contrast change */
for (yy = y - 16; yy < y + 16; yy++) for (yy = y - 16; yy < y + 16; yy++)
{ {
for (xx = x - 16; xx < x + 16; xx++) for (xx = x - 16; xx < x + 16; xx++)
{
if (in_circle(xx - x, yy - y))
{ {
/* Get original color: */ /* Get original color: */
@ -5133,6 +5148,7 @@ static void blit_magic(int x, int y, int button_down)
} }
} }
} }
}
SDL_UnlockSurface(canvas); SDL_UnlockSurface(canvas);
SDL_UnlockSurface(last); SDL_UnlockSurface(last);
@ -15041,3 +15057,13 @@ int valid_click(Uint8 button)
else else
return(0); return(0);
} }
int in_circle(int x, int y)
{
if ((x * x) + (y * y) - (16 * 16) < 0)
return(1);
else
return(0);
}