Adding "indent.sh" to re-indent code; ran it!!!
This commit is contained in:
parent
16336cc854
commit
18f9cad6fe
98 changed files with 5798 additions and 9001 deletions
|
|
@ -78,15 +78,12 @@ const char *sharpen_names[sharpen_NUM_TOOLS] = {
|
|||
};
|
||||
|
||||
const char *sharpen_descs[sharpen_NUM_TOOLS][2] = {
|
||||
{gettext_noop
|
||||
("Click and drag the mouse to trace edges in parts of your picture."),
|
||||
{gettext_noop("Click and drag the mouse to trace edges in parts of your picture."),
|
||||
gettext_noop("Click to trace edges in your entire picture."),},
|
||||
{gettext_noop("Click and drag the mouse to sharpen parts of your picture."),
|
||||
gettext_noop("Click to sharpen the entire picture."),},
|
||||
{gettext_noop
|
||||
("Click and drag the mouse to create a black and white silhouette."),
|
||||
gettext_noop
|
||||
("Click to create a black and white silhouette of your entire picture.")},
|
||||
{gettext_noop("Click and drag the mouse to create a black and white silhouette."),
|
||||
gettext_noop("Click to create a black and white silhouette of your entire picture.")},
|
||||
};
|
||||
|
||||
Uint32 sharpen_api_version(void);
|
||||
|
|
@ -97,34 +94,28 @@ char *sharpen_get_name(magic_api * api, int which);
|
|||
int sharpen_get_group(magic_api * api, int which);
|
||||
char *sharpen_get_description(magic_api * api, int which, int mode);
|
||||
static int sharpen_grey(Uint8 r1, Uint8 g1, Uint8 b1);
|
||||
static void do_sharpen_pixel(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y);
|
||||
static void do_sharpen_full(void *ptr, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int which);
|
||||
static void do_sharpen_brush(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y);
|
||||
static void do_sharpen_pixel(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
|
||||
static void do_sharpen_full(void *ptr, SDL_Surface * canvas, SDL_Surface * last, int which);
|
||||
static void do_sharpen_brush(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
|
||||
void sharpen_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
|
||||
void sharpen_click(magic_api * api, int which, int mode, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
|
||||
void sharpen_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
|
||||
void sharpen_shutdown(magic_api * api);
|
||||
void sharpen_set_color(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect);
|
||||
int sharpen_requires_colors(magic_api * api, int which);
|
||||
void sharpen_switchin(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void sharpen_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void sharpen_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void sharpen_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int sharpen_modes(magic_api * api, int which);
|
||||
Uint8 sharpen_accepted_sizes(magic_api * api, int which, int mode);
|
||||
Uint8 sharpen_default_size(magic_api * api, int which, int mode);
|
||||
void sharpen_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect);
|
||||
void sharpen_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size,
|
||||
SDL_Rect * update_rect);
|
||||
|
||||
|
||||
|
||||
|
|
@ -143,8 +134,7 @@ int sharpen_init(magic_api * api, Uint32 disabled_features ATTRIBUTE_UNUSED)
|
|||
|
||||
for (i = 0; i < sharpen_NUM_TOOLS; i++)
|
||||
{
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/%s", api->data_directory,
|
||||
sharpen_snd_filenames[i]);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/%s", api->data_directory, sharpen_snd_filenames[i]);
|
||||
sharpen_snd_effect[i] = Mix_LoadWAV(fname);
|
||||
}
|
||||
|
||||
|
|
@ -162,8 +152,7 @@ SDL_Surface *sharpen_get_icon(magic_api * api, int which)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory,
|
||||
sharpen_icon_filenames[which]);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory, sharpen_icon_filenames[which]);
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
||||
|
|
@ -174,15 +163,13 @@ char *sharpen_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
|
|||
}
|
||||
|
||||
// Return our group (all the same):
|
||||
int sharpen_get_group(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
int sharpen_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return MAGIC_TYPE_DISTORTS;
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char *sharpen_get_description(magic_api * api ATTRIBUTE_UNUSED, int which,
|
||||
int mode)
|
||||
char *sharpen_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
|
||||
{
|
||||
return (strdup(gettext_noop(sharpen_descs[which][mode - 1])));
|
||||
}
|
||||
|
|
@ -194,8 +181,7 @@ static int sharpen_grey(Uint8 r1, Uint8 g1, Uint8 b1)
|
|||
}
|
||||
|
||||
// Do the effect:
|
||||
static void do_sharpen_pixel(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y)
|
||||
static void do_sharpen_pixel(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
|
||||
{
|
||||
magic_api *api = (magic_api *) ptr;
|
||||
|
||||
|
|
@ -222,8 +208,7 @@ static void do_sharpen_pixel(void *ptr, int which, SDL_Surface * canvas,
|
|||
for (j = -1; j < 2; j++)
|
||||
{
|
||||
//No need to check if inside canvas, getpixel does it for us.
|
||||
SDL_GetRGB(api->getpixel(last, x + i, y + j), last->format, &r1, &g1,
|
||||
&b1);
|
||||
SDL_GetRGB(api->getpixel(last, x + i, y + j), last->format, &r1, &g1, &b1);
|
||||
grey = sharpen_grey(r1, g1, b1);
|
||||
sobel_1 += grey * sobel_weights_1[i + 1][j + 1];
|
||||
sobel_2 += grey * sobel_weights_2[i + 1][j + 1];
|
||||
|
|
@ -253,14 +238,12 @@ static void do_sharpen_pixel(void *ptr, int which, SDL_Surface * canvas,
|
|||
api->putpixel(canvas, x, y,
|
||||
SDL_MapRGB(canvas->format,
|
||||
clamp(0.0, r1 + SHARPEN * temp, 255.0),
|
||||
clamp(0.0, g1 + SHARPEN * temp, 255.0),
|
||||
clamp(0.0, b1 + SHARPEN * temp, 255.0)));
|
||||
clamp(0.0, g1 + SHARPEN * temp, 255.0), clamp(0.0, b1 + SHARPEN * temp, 255.0)));
|
||||
}
|
||||
}
|
||||
|
||||
// Do the effect for the full image
|
||||
static void do_sharpen_full(void *ptr, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int which)
|
||||
static void do_sharpen_full(void *ptr, SDL_Surface * canvas, SDL_Surface * last, int which)
|
||||
{
|
||||
magic_api *api = (magic_api *) ptr;
|
||||
|
||||
|
|
@ -281,8 +264,7 @@ static void do_sharpen_full(void *ptr, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
//do the effect for the brush
|
||||
static void do_sharpen_brush(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y)
|
||||
static void do_sharpen_brush(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
|
||||
{
|
||||
int xx, yy;
|
||||
magic_api *api = (magic_api *) ptr;
|
||||
|
|
@ -291,8 +273,7 @@ static void do_sharpen_brush(void *ptr, int which, SDL_Surface * canvas,
|
|||
{
|
||||
for (xx = x - sharpen_RADIUS; xx < x + sharpen_RADIUS; xx++)
|
||||
{
|
||||
if (api->in_circle(xx - x, yy - y, sharpen_RADIUS)
|
||||
&& !api->touched(xx, yy))
|
||||
if (api->in_circle(xx - x, yy - y, sharpen_RADIUS) && !api->touched(xx, yy))
|
||||
{
|
||||
do_sharpen_pixel(api, which, canvas, last, xx, yy);
|
||||
}
|
||||
|
|
@ -302,12 +283,10 @@ static void do_sharpen_brush(void *ptr, int which, SDL_Surface * canvas,
|
|||
|
||||
// Affect the canvas on drag:
|
||||
void sharpen_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
||||
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1,
|
||||
do_sharpen_brush);
|
||||
api->line((void *)api, which, canvas, last, ox, oy, x, y, 1, do_sharpen_brush);
|
||||
|
||||
api->playsound(sharpen_snd_effect[which], (x * 255) / canvas->w, 255);
|
||||
|
||||
|
|
@ -334,8 +313,7 @@ void sharpen_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
|
||||
// Affect the canvas on click:
|
||||
void sharpen_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
if (mode == MODE_PAINT)
|
||||
sharpen_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
|
|
@ -355,8 +333,7 @@ void sharpen_release(magic_api * api ATTRIBUTE_UNUSED,
|
|||
int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -376,32 +353,30 @@ void sharpen_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void sharpen_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
void sharpen_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int sharpen_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
int sharpen_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sharpen_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void sharpen_switchout(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int sharpen_modes(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
int sharpen_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return (MODE_FULLSCREEN | MODE_PAINT);
|
||||
}
|
||||
|
|
@ -421,7 +396,9 @@ Uint8 sharpen_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE
|
|||
return 4;
|
||||
}
|
||||
|
||||
void sharpen_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 size, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
void sharpen_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 size,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
sharpen_RADIUS = size * 4;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue