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
|
|
@ -42,30 +42,25 @@ SDL_Surface *negative_get_icon(magic_api * api, int which);
|
|||
char *negative_get_name(magic_api * api, int which);
|
||||
int negative_get_group(magic_api * api, int which);
|
||||
char *negative_get_description(magic_api * api, int which, int mode);
|
||||
static void do_negative(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y);
|
||||
static void do_negative(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
|
||||
void negative_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 negative_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);
|
||||
void negative_release(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void negative_shutdown(magic_api * api);
|
||||
void negative_set_color(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect);
|
||||
int negative_requires_colors(magic_api * api, int which);
|
||||
void negative_switchin(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void negative_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void negative_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void negative_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int negative_modes(magic_api * api, int which);
|
||||
Uint8 negative_accepted_sizes(magic_api * api, int which, int mode);
|
||||
Uint8 negative_default_size(magic_api * api, int which, int mode);
|
||||
void negative_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect);
|
||||
void negative_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size,
|
||||
SDL_Rect * update_rect);
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
@ -86,14 +81,11 @@ const char *negative_names[negative_NUM_TOOLS] = {
|
|||
|
||||
const char *negative_descs[negative_NUM_TOOLS][2] = {
|
||||
{
|
||||
gettext_noop
|
||||
("Click and drag the mouse around to make your painting negative."),
|
||||
gettext_noop("Click and drag the mouse around to make your painting negative."),
|
||||
gettext_noop("Click to turn your painting into its negative.")},
|
||||
{
|
||||
gettext_noop
|
||||
("Click and drag the mouse around to change colors to their opposites -- their complementary colors."),
|
||||
gettext_noop
|
||||
("Click to turn all colors in your painting into their opposites -- their complementary colors.")},
|
||||
gettext_noop("Click and drag the mouse around to change colors to their opposites -- their complementary colors."),
|
||||
gettext_noop("Click to turn all colors in your painting into their opposites -- their complementary colors.")},
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -101,8 +93,7 @@ int negative_init(magic_api * api, Uint32 disabled_features ATTRIBUTE_UNUSED)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/negative.wav",
|
||||
api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/negative.wav", api->data_directory);
|
||||
|
||||
negative_snd = Mix_LoadWAV(fname);
|
||||
|
||||
|
|
@ -124,8 +115,7 @@ SDL_Surface *negative_get_icon(magic_api * api, int which)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory,
|
||||
negative_icon_filenames[which]);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory, negative_icon_filenames[which]);
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
||||
|
|
@ -136,15 +126,13 @@ char *negative_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
|
|||
}
|
||||
|
||||
// Return our group (both the same):
|
||||
int negative_get_group(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
int negative_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return MAGIC_TYPE_COLOR_FILTERS;
|
||||
}
|
||||
|
||||
// Return our description, localized:
|
||||
char *negative_get_description(magic_api * api ATTRIBUTE_UNUSED, int which,
|
||||
int mode)
|
||||
char *negative_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
|
||||
{
|
||||
int mode_idx;
|
||||
|
||||
|
|
@ -164,8 +152,7 @@ char *negative_get_description(magic_api * api ATTRIBUTE_UNUSED, int which,
|
|||
return (strdup(gettext_noop(negative_descs[which][mode_idx])));
|
||||
}
|
||||
|
||||
static void negative_calc(void *ptr, int which, Uint8 r, Uint8 g, Uint8 b,
|
||||
Uint8 * new_r, Uint8 * new_g, Uint8 * new_b)
|
||||
static void negative_calc(void *ptr, int which, Uint8 r, Uint8 g, Uint8 b, Uint8 * new_r, Uint8 * new_g, Uint8 * new_b)
|
||||
{
|
||||
float h, s, v, new_h;
|
||||
magic_api *api = (magic_api *) ptr;
|
||||
|
|
@ -189,8 +176,7 @@ static void negative_calc(void *ptr, int which, Uint8 r, Uint8 g, Uint8 b,
|
|||
}
|
||||
|
||||
// Callback that does the negative color effect on a circle centered around x,y
|
||||
static void do_negative(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y)
|
||||
static void do_negative(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
|
||||
{
|
||||
int xx, yy;
|
||||
Uint8 r, g, b, new_r, new_g, new_b;
|
||||
|
|
@ -204,8 +190,7 @@ static void do_negative(void *ptr, int which, SDL_Surface * canvas,
|
|||
{
|
||||
SDL_GetRGB(api->getpixel(last, xx, yy), last->format, &r, &g, &b);
|
||||
negative_calc(api, which, r, g, b, &new_r, &new_g, &new_b);
|
||||
api->putpixel(canvas, xx, yy,
|
||||
SDL_MapRGB(canvas->format, new_r, new_g, new_b));
|
||||
api->putpixel(canvas, xx, yy, SDL_MapRGB(canvas->format, new_r, new_g, new_b));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -213,13 +198,12 @@ static void do_negative(void *ptr, int which, SDL_Surface * canvas,
|
|||
|
||||
// Ask Tux Paint to call our 'do_negative()' callback over a line
|
||||
void negative_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)
|
||||
{
|
||||
SDL_LockSurface(last);
|
||||
SDL_LockSurface(canvas);
|
||||
|
||||
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_negative);
|
||||
api->line((void *)api, which, canvas, last, ox, oy, x, y, 1, do_negative);
|
||||
|
||||
if (ox > x)
|
||||
{
|
||||
|
|
@ -250,8 +234,7 @@ void negative_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
|
||||
// Ask Tux Paint to call our 'do_negative()' callback at a single point
|
||||
void negative_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)
|
||||
negative_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
|
|
@ -266,8 +249,7 @@ void negative_click(magic_api * api, int which, int mode,
|
|||
{
|
||||
SDL_GetRGB(api->getpixel(last, xx, yy), last->format, &r, &g, &b);
|
||||
negative_calc(api, which, r, g, b, &new_r, &new_g, &new_b);
|
||||
api->putpixel(canvas, xx, yy,
|
||||
SDL_MapRGB(canvas->format, new_r, new_g, new_b));
|
||||
api->putpixel(canvas, xx, yy, SDL_MapRGB(canvas->format, new_r, new_g, new_b));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -285,8 +267,7 @@ void negative_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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -298,38 +279,37 @@ void negative_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
}
|
||||
|
||||
// We don't use colors
|
||||
void negative_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 negative_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)
|
||||
{
|
||||
}
|
||||
|
||||
// We don't use colors
|
||||
int negative_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
int negative_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void negative_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 negative_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 negative_modes(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
int negative_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return (MODE_PAINT | MODE_FULLSCREEN);
|
||||
}
|
||||
|
||||
|
||||
Uint8 negative_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode) {
|
||||
Uint8 negative_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
|
||||
{
|
||||
if (mode == MODE_PAINT)
|
||||
return 8;
|
||||
else
|
||||
|
|
@ -341,7 +321,9 @@ Uint8 negative_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUT
|
|||
return 4;
|
||||
}
|
||||
|
||||
void negative_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 negative_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)
|
||||
{
|
||||
negative_radius = size * 4;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue