Re-run indent.sh under GNU indent 2.2.13
Slight change to its default behavior re: pointer variables (before: "type * var"; now seems to prefer: "type *var").
This commit is contained in:
parent
073ac19ce6
commit
44d7d0ee5d
94 changed files with 2831 additions and 2856 deletions
|
|
@ -39,7 +39,8 @@
|
||||||
#include "SDL_image.h"
|
#include "SDL_image.h"
|
||||||
#include "SDL_mixer.h"
|
#include "SDL_mixer.h"
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
TOOL_TYPEWRITER,
|
TOOL_TYPEWRITER,
|
||||||
TOOL_COMPUTER,
|
TOOL_COMPUTER,
|
||||||
NUM_TOOLS
|
NUM_TOOLS
|
||||||
|
|
@ -184,7 +185,8 @@ int ascii_init(magic_api * api, Uint8 disabled_features ATTRIBUTE_UNUSED, Uint8
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
all_clear = 1;
|
all_clear = 1;
|
||||||
for (y = 0; y < ascii_bitmap[i]->h /* && all_clear */; y++) {
|
for (y = 0; y < ascii_bitmap[i]->h /* && all_clear */ ; y++)
|
||||||
|
{
|
||||||
pixel = api->getpixel(ascii_bitmap[i], x, y);
|
pixel = api->getpixel(ascii_bitmap[i], x, y);
|
||||||
if (pixel != clear_pixel)
|
if (pixel != clear_pixel)
|
||||||
all_clear = 0;
|
all_clear = 0;
|
||||||
|
|
@ -250,7 +252,8 @@ int ascii_init(magic_api * api, Uint8 disabled_features ATTRIBUTE_UNUSED, Uint8
|
||||||
/* Calculate the intensity of each character */
|
/* Calculate the intensity of each character */
|
||||||
area = ascii_char_maxwidth[i] * ascii_bitmap[i]->h;
|
area = ascii_char_maxwidth[i] * ascii_bitmap[i]->h;
|
||||||
|
|
||||||
DEBUG_PRINTF("%s max char width is %d -- * %d = area %d\n", fname, ascii_char_maxwidth[i], ascii_bitmap[i]->h, area);
|
DEBUG_PRINTF("%s max char width is %d -- * %d = area %d\n", fname, ascii_char_maxwidth[i], ascii_bitmap[i]->h,
|
||||||
|
area);
|
||||||
|
|
||||||
for (j = 0; j < num_chars; j++)
|
for (j = 0; j < num_chars; j++)
|
||||||
{
|
{
|
||||||
|
|
@ -338,9 +341,11 @@ char *ascii_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mod
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
|
|
||||||
if (mode == MODE_PAINT)
|
if (mode == MODE_PAINT)
|
||||||
snprintf(tmp, sizeof(tmp), gettext("Click and drag to transform parts of your drawing to ASCII art (%s style)."), gettext(ascii_tool_names[which]));
|
snprintf(tmp, sizeof(tmp), gettext("Click and drag to transform parts of your drawing to ASCII art (%s style)."),
|
||||||
|
gettext(ascii_tool_names[which]));
|
||||||
else
|
else
|
||||||
snprintf(tmp, sizeof(tmp), gettext("Click to transform your entire drawing to ASCII art (%s style)."), gettext(ascii_tool_names[which]));
|
snprintf(tmp, sizeof(tmp), gettext("Click to transform your entire drawing to ASCII art (%s style)."),
|
||||||
|
gettext(ascii_tool_names[which]));
|
||||||
|
|
||||||
return (strdup(tmp));
|
return (strdup(tmp));
|
||||||
}
|
}
|
||||||
|
|
@ -421,12 +426,11 @@ void ascii_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
void ascii_set_color(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface *canvas ATTRIBUTE_UNUSED,
|
void ascii_set_color(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface *canvas ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
SDL_Surface *last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b,
|
||||||
|
SDL_Rect *update_rect ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
/* If the bitmap's "clear" color, choose the opposite! */
|
/* If the bitmap's "clear" color, choose the opposite! */
|
||||||
if (abs(r - ascii_clear_r[which]) < 8 &&
|
if (abs(r - ascii_clear_r[which]) < 8 && abs(g - ascii_clear_g[which]) < 8 && abs(b - ascii_clear_b[which]) < 8)
|
||||||
abs(g - ascii_clear_g[which]) < 8 &&
|
|
||||||
abs(b - ascii_clear_b[which]) < 8)
|
|
||||||
{
|
{
|
||||||
r = 255 - r;
|
r = 255 - r;
|
||||||
g = 255 - g;
|
g = 255 - g;
|
||||||
|
|
@ -610,8 +614,7 @@ void do_ascii_effect(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * l
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (rr == ascii_computer_colors[i][0] &&
|
if (rr == ascii_computer_colors[i][0] &&
|
||||||
gg == ascii_computer_colors[i][1] &&
|
gg == ascii_computer_colors[i][1] && bb == ascii_computer_colors[i][2])
|
||||||
bb == ascii_computer_colors[i][2])
|
|
||||||
{
|
{
|
||||||
/* Exact match */
|
/* Exact match */
|
||||||
best = i;
|
best = i;
|
||||||
|
|
@ -629,8 +632,7 @@ void do_ascii_effect(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * l
|
||||||
bb == ascii_computer_colors[i][2] &&
|
bb == ascii_computer_colors[i][2] &&
|
||||||
abs(rr - ascii_computer_colors[i][0]) <= 0x55) ||
|
abs(rr - ascii_computer_colors[i][0]) <= 0x55) ||
|
||||||
(bb == ascii_computer_colors[i][2] &&
|
(bb == ascii_computer_colors[i][2] &&
|
||||||
rr == ascii_computer_colors[i][0] &&
|
rr == ascii_computer_colors[i][0] && abs(gg - ascii_computer_colors[i][1]) <= 0x55))
|
||||||
abs(gg - ascii_computer_colors[i][1]) <= 0x55))
|
|
||||||
{
|
{
|
||||||
/* Very close match */
|
/* Very close match */
|
||||||
best = i;
|
best = i;
|
||||||
|
|
@ -649,8 +651,7 @@ void do_ascii_effect(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * l
|
||||||
abs(bb - ascii_computer_colors[i][2]) <= 0x55 &&
|
abs(bb - ascii_computer_colors[i][2]) <= 0x55 &&
|
||||||
abs(rr - ascii_computer_colors[i][0]) <= 0x55) ||
|
abs(rr - ascii_computer_colors[i][0]) <= 0x55) ||
|
||||||
(bb == ascii_computer_colors[i][2] &&
|
(bb == ascii_computer_colors[i][2] &&
|
||||||
abs(rr - ascii_computer_colors[i][0]) <= 0x55 &&
|
abs(rr - ascii_computer_colors[i][0]) <= 0x55 && abs(gg - ascii_computer_colors[i][1]) <= 0x55))
|
||||||
abs(gg - ascii_computer_colors[i][1]) <= 0x55))
|
|
||||||
{
|
{
|
||||||
/* Pretty close match */
|
/* Pretty close match */
|
||||||
best = i;
|
best = i;
|
||||||
|
|
|
||||||
|
|
@ -458,8 +458,7 @@ int calligraphy_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Uint8 calligraphy_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
Uint8 calligraphy_accepted_sizes(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
int mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,7 @@ void checkerboard_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUT
|
||||||
checkerboard_b = b;
|
checkerboard_b = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
int checkerboard_init(magic_api * api, Uint8 disabled_features ATTRIBUTE_UNUSED,
|
int checkerboard_init(magic_api *api, Uint8 disabled_features ATTRIBUTE_UNUSED, Uint8 complexity_level ATTRIBUTE_UNUSED)
|
||||||
Uint8 complexity_level ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
|
|
||||||
|
|
@ -271,8 +270,7 @@ void checkerboard_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkerboard_switchout(magic_api *api ATTRIBUTE_UNUSED,
|
void checkerboard_switchout(magic_api *api ATTRIBUTE_UNUSED,
|
||||||
int which ATTRIBUTE_UNUSED,
|
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface *canvas ATTRIBUTE_UNUSED)
|
||||||
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ static Mix_Chunk *comicdot_snd;
|
||||||
static int comicdot_radius = 16;
|
static int comicdot_radius = 16;
|
||||||
static int comicdot_r, comicdot_g, comicdot_b;
|
static int comicdot_r, comicdot_g, comicdot_b;
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
COMICDOT_LG,
|
COMICDOT_LG,
|
||||||
COMICDOT_SM,
|
COMICDOT_SM,
|
||||||
NUM_COMICDOT_SIZES
|
NUM_COMICDOT_SIZES
|
||||||
|
|
@ -103,8 +104,7 @@ int comicdot_init(magic_api * api, Uint8 disabled_features ATTRIBUTE_UNUSED, Uin
|
||||||
size = (100 * (NUM_COMICDOT_SIZES - i)) / NUM_COMICDOT_SIZES;
|
size = (100 * (NUM_COMICDOT_SIZES - i)) / NUM_COMICDOT_SIZES;
|
||||||
|
|
||||||
comicdot_pattern[i] = api->scale(comicdot_pattern[0],
|
comicdot_pattern[i] = api->scale(comicdot_pattern[0],
|
||||||
(comicdot_pattern[0]->w * size) / 100,
|
(comicdot_pattern[0]->w * size) / 100, (comicdot_pattern[0]->h * size) / 100, 1);
|
||||||
(comicdot_pattern[0]->h * size) / 100, 1);
|
|
||||||
if (comicdot_pattern[i] == NULL)
|
if (comicdot_pattern[i] == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Can't scale %s (%d%%)\n", fname, size);
|
fprintf(stderr, "Can't scale %s (%d%%)\n", fname, size);
|
||||||
|
|
@ -152,11 +152,11 @@ char *comicdot_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRI
|
||||||
return (strdup(gettext("Click to apply a dot pattern on your entire picture")));
|
return (strdup(gettext("Click to apply a dot pattern on your entire picture")));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_comicdot(void *ptr, int which,
|
static void do_comicdot(void *ptr, int which, SDL_Surface *canvas, SDL_Surface *last, int x, int y)
|
||||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y)
|
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
Uint8 r1, g1, b1, r, g, b, n, _;
|
Uint8 r1, g1, b1, r, g, b, n, _;
|
||||||
|
|
||||||
// Uint8 nr, ng, nb;
|
// Uint8 nr, ng, nb;
|
||||||
Uint32 pixel;
|
Uint32 pixel;
|
||||||
int offx, offy;
|
int offx, offy;
|
||||||
|
|
@ -281,9 +281,9 @@ void comicdot_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void comicdot_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
void comicdot_set_color(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b,
|
SDL_Surface *canvas ATTRIBUTE_UNUSED, SDL_Surface *last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g,
|
||||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
Uint8 b, SDL_Rect *update_rect ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
comicdot_r = r;
|
comicdot_r = r;
|
||||||
comicdot_g = g;
|
comicdot_g = g;
|
||||||
|
|
|
||||||
|
|
@ -160,8 +160,7 @@ void do_crescent(magic_api * api, SDL_Surface * canvas, int x, int y, SDL_Rect *
|
||||||
yy = crescent_cy + yr;
|
yy = crescent_cy + yr;
|
||||||
|
|
||||||
/* Within the canvas? */
|
/* Within the canvas? */
|
||||||
if (xx >= 0 && xx < canvas->w &&
|
if (xx >= 0 && xx < canvas->w && yy >= 0 && yy < canvas->h)
|
||||||
yy >= 0 && yy < canvas->h)
|
|
||||||
{
|
{
|
||||||
/* Within the overall circle? */
|
/* Within the overall circle? */
|
||||||
if (api->in_circle(xr, yr, radius))
|
if (api->in_circle(xr, yr, radius))
|
||||||
|
|
@ -218,9 +217,7 @@ void crescent_click(magic_api * api, int which ATTRIBUTE_UNUSED, int mode ATTRIB
|
||||||
}
|
}
|
||||||
|
|
||||||
void crescent_release(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
void crescent_release(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * canvas,
|
SDL_Surface *canvas, SDL_Surface *last ATTRIBUTE_UNUSED, int x, int y, SDL_Rect *update_rect)
|
||||||
SDL_Surface * last ATTRIBUTE_UNUSED, int x,
|
|
||||||
int y, SDL_Rect * update_rect)
|
|
||||||
{
|
{
|
||||||
do_crescent(api, canvas, x, y, update_rect, 1);
|
do_crescent(api, canvas, x, y, update_rect, 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,8 +161,7 @@ int distortion_get_order(int which ATTRIBUTE_UNUSED)
|
||||||
|
|
||||||
// Report our "Magic" tool descriptions
|
// Report our "Magic" tool descriptions
|
||||||
|
|
||||||
char *distortion_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
char *distortion_get_description(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
return (strdup(gettext("Click and drag the mouse to cause distortion in your picture.")));
|
return (strdup(gettext("Click and drag the mouse to cause distortion in your picture.")));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -400,8 +400,7 @@ int fade_darken_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Uint8 fade_darken_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
Uint8 fade_darken_accepted_sizes(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
int mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
if (mode == MODE_PAINT)
|
if (mode == MODE_PAINT)
|
||||||
return 8;
|
return 8;
|
||||||
|
|
|
||||||
|
|
@ -429,8 +429,7 @@ inline Uint8 fold_what_corner(int x, int y, SDL_Surface * canvas)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fold_print_line(void *ptr, int which ATTRIBUTE_UNUSED,
|
static void fold_print_line(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface *canvas, SDL_Surface *last, int x, int y)
|
||||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y)
|
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@
|
||||||
|
|
||||||
#define NUM_TOOLS 4
|
#define NUM_TOOLS 4
|
||||||
|
|
||||||
typedef struct fract_opt_s {
|
typedef struct fract_opt_s
|
||||||
|
{
|
||||||
int angle;
|
int angle;
|
||||||
float scale;
|
float scale;
|
||||||
} fract_opt_t;
|
} fract_opt_t;
|
||||||
|
|
@ -46,7 +47,8 @@ fract_opt_t fract_opt[NUM_TOOLS] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct pt_s {
|
typedef struct pt_s
|
||||||
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
} pt_t;
|
} pt_t;
|
||||||
|
|
||||||
|
|
@ -93,7 +95,8 @@ Uint8 fractal_accepted_sizes(magic_api * api, int which, int mode);
|
||||||
Uint8 fractal_default_size(magic_api * api, int which, int mode);
|
Uint8 fractal_default_size(magic_api * api, int which, int mode);
|
||||||
void fractal_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size,
|
void fractal_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size,
|
||||||
SDL_Rect * update_rect);
|
SDL_Rect * update_rect);
|
||||||
void do_fractal(magic_api * api, int which, SDL_Surface * canvas, int iter, float cx, float cy, float angle, float scale, float opacity, int final);
|
void do_fractal(magic_api * api, int which, SDL_Surface * canvas, int iter, float cx, float cy, float angle,
|
||||||
|
float scale, float opacity, int final);
|
||||||
|
|
||||||
Uint32 fractal_api_version(void)
|
Uint32 fractal_api_version(void)
|
||||||
{
|
{
|
||||||
|
|
@ -150,16 +153,22 @@ char *fractal_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int m
|
||||||
{
|
{
|
||||||
if (fract_opt[which].angle != 0)
|
if (fract_opt[which].angle != 0)
|
||||||
{
|
{
|
||||||
snprintf(tmp, sizeof(tmp), gettext("Click and drag to sketch a shape. It will repeat, %1$s %2$d%% and rotating %3$d degrees."), (fract_opt[which].scale > 1.0 ? gettext("scaling up") : gettext("scaling down")), (int) (fract_opt[which].scale * 100), fract_opt[which].angle);
|
snprintf(tmp, sizeof(tmp),
|
||||||
|
gettext("Click and drag to sketch a shape. It will repeat, %1$s %2$d%% and rotating %3$d degrees."),
|
||||||
|
(fract_opt[which].scale > 1.0 ? gettext("scaling up") : gettext("scaling down")),
|
||||||
|
(int)(fract_opt[which].scale * 100), fract_opt[which].angle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf(tmp, sizeof(tmp), gettext("Click and drag to sketch a shape. It will repeat, %1$s %2$d%%."), (fract_opt[which].scale > 1.0 ? gettext("scaling up") : gettext("scaling down")), (int) (fract_opt[which].scale * 100));
|
snprintf(tmp, sizeof(tmp), gettext("Click and drag to sketch a shape. It will repeat, %1$s %2$d%%."),
|
||||||
|
(fract_opt[which].scale > 1.0 ? gettext("scaling up") : gettext("scaling down")),
|
||||||
|
(int)(fract_opt[which].scale * 100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf(tmp, sizeof(tmp), gettext("Click and drag to sketch a shape. It will repeat, rotating %d degrees."), fract_opt[which].angle);
|
snprintf(tmp, sizeof(tmp), gettext("Click and drag to sketch a shape. It will repeat, rotating %d degrees."),
|
||||||
|
fract_opt[which].angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (strdup(tmp));
|
return (strdup(tmp));
|
||||||
|
|
@ -197,7 +206,8 @@ static void do_fractal_circle(void *ptr, int which ATTRIBUTE_UNUSED,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_fractal(magic_api * api, int which, SDL_Surface * canvas, int iter, float cx, float cy, float angle, float scale, float opacity, int final)
|
void do_fractal(magic_api *api, int which, SDL_Surface *canvas, int iter, float cx, float cy, float angle, float scale,
|
||||||
|
float opacity, int final)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float x1, y1, x2, y2, nx, ny;
|
float x1, y1, x2, y2, nx, ny;
|
||||||
|
|
@ -206,7 +216,8 @@ void do_fractal(magic_api * api, int which, SDL_Surface * canvas, int iter, floa
|
||||||
co = cosf(angle);
|
co = cosf(angle);
|
||||||
si = sinf(angle);
|
si = sinf(angle);
|
||||||
|
|
||||||
for (i = 0; i < num_pts - 1; i++) {
|
for (i = 0; i < num_pts - 1; i++)
|
||||||
|
{
|
||||||
x1 = (float)(pts[i].x);
|
x1 = (float)(pts[i].x);
|
||||||
y1 = (float)(pts[i].y);
|
y1 = (float)(pts[i].y);
|
||||||
x2 = (float)(pts[i + 1].x);
|
x2 = (float)(pts[i + 1].x);
|
||||||
|
|
@ -243,19 +254,23 @@ void do_fractal(magic_api * api, int which, SDL_Surface * canvas, int iter, floa
|
||||||
|
|
||||||
fractal_radius_cur = (iter / 2) + 1;
|
fractal_radius_cur = (iter / 2) + 1;
|
||||||
fractal_opacity_cur = opacity;
|
fractal_opacity_cur = opacity;
|
||||||
api->line((void *)api, which, canvas, NULL, (int) x1, (int) y1, (int) x2, (int) y2, (final ? 1 : 10), do_fractal_circle);
|
api->line((void *)api, which, canvas, NULL, (int)x1, (int)y1, (int)x2, (int)y2, (final ? 1 : 10),
|
||||||
|
do_fractal_circle);
|
||||||
|
|
||||||
if (final && ((i % ((num_pts / 3) + 1)) == 1) && (iter > 1))
|
if (final && ((i % ((num_pts / 3) + 1)) == 1) && (iter > 1))
|
||||||
{
|
{
|
||||||
do_fractal(api, which, canvas, iter - 1, x2, y2, angle + ((float) fract_opt[which].angle / 180.0 * M_PI), scale * fract_opt[which].scale, opacity * 0.5, final);
|
do_fractal(api, which, canvas, iter - 1, x2, y2, angle + ((float)fract_opt[which].angle / 180.0 * M_PI),
|
||||||
|
scale * fract_opt[which].scale, opacity * 0.5, final);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fractal_drag(magic_api *api, int which, SDL_Surface *canvas,
|
void fractal_drag(magic_api *api, int which, SDL_Surface *canvas,
|
||||||
SDL_Surface * last, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y, SDL_Rect * update_rect)
|
SDL_Surface *last, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y,
|
||||||
|
SDL_Rect *update_rect)
|
||||||
|
{
|
||||||
|
if (num_pts < MAX_PTS)
|
||||||
{
|
{
|
||||||
if (num_pts < MAX_PTS) {
|
|
||||||
pts[num_pts].x = x;
|
pts[num_pts].x = x;
|
||||||
pts[num_pts].y = y;
|
pts[num_pts].y = y;
|
||||||
num_pts++;
|
num_pts++;
|
||||||
|
|
@ -287,8 +302,7 @@ void fractal_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||||
|
|
||||||
void fractal_release(magic_api *api, int which,
|
void fractal_release(magic_api *api, int which,
|
||||||
SDL_Surface *canvas,
|
SDL_Surface *canvas,
|
||||||
SDL_Surface * last, int x ATTRIBUTE_UNUSED,
|
SDL_Surface *last, int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect *update_rect)
|
||||||
int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect)
|
|
||||||
{
|
{
|
||||||
SDL_BlitSurface(last, NULL, canvas, NULL);
|
SDL_BlitSurface(last, NULL, canvas, NULL);
|
||||||
|
|
||||||
|
|
@ -308,8 +322,9 @@ void fractal_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
Mix_FreeChunk(fractal_snd);
|
Mix_FreeChunk(fractal_snd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fractal_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
void fractal_set_color(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
SDL_Surface *canvas ATTRIBUTE_UNUSED, SDL_Surface *last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g,
|
||||||
|
Uint8 b, SDL_Rect *update_rect ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
fractal_r = r;
|
fractal_r = r;
|
||||||
fractal_g = g;
|
fractal_g = g;
|
||||||
|
|
|
||||||
|
|
@ -216,8 +216,7 @@ int googlyeyes_get_order(int which)
|
||||||
return 200 + which;
|
return 200 + which;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *googlyeyes_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
char *googlyeyes_get_description(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
if (googlyeyes_limited)
|
if (googlyeyes_limited)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -210,8 +210,7 @@ kaleidox_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
update_rect->h = canvas->h;
|
update_rect->h = canvas->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void kaleidox_render(magic_api * api, int which, SDL_Surface * canvas,
|
void kaleidox_render(magic_api *api, int which, SDL_Surface *canvas, SDL_Surface *snapshot, int x, int y, int preview)
|
||||||
SDL_Surface * snapshot, int x, int y, int preview)
|
|
||||||
{
|
{
|
||||||
int off_x, off_y, sides, max_radius;
|
int off_x, off_y, sides, max_radius;
|
||||||
float angle, angle_offset;
|
float angle, angle_offset;
|
||||||
|
|
|
||||||
|
|
@ -189,8 +189,7 @@ char *kalidescope_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, i
|
||||||
|
|
||||||
// Do the effect:
|
// Do the effect:
|
||||||
|
|
||||||
static void do_kalidescope(void *ptr, int which, SDL_Surface * canvas,
|
static void do_kalidescope(void *ptr, int which, SDL_Surface *canvas, SDL_Surface *last ATTRIBUTE_UNUSED, int x, int y)
|
||||||
SDL_Surface * last ATTRIBUTE_UNUSED, int x, int y)
|
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
int xx, yy;
|
int xx, yy;
|
||||||
|
|
@ -289,8 +288,7 @@ void kalidescope_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use sizes:
|
// Use sizes:
|
||||||
Uint8 kalidescope_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED,
|
Uint8 kalidescope_accepted_sizes(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
return KAL_MAX_SIZE;
|
return KAL_MAX_SIZE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -214,8 +214,7 @@ maze_click(magic_api * api, int which, int mode,
|
||||||
|
|
||||||
void
|
void
|
||||||
maze_drag(magic_api *api ATTRIBUTE_UNUSED, int which, SDL_Surface *canvas,
|
maze_drag(magic_api *api ATTRIBUTE_UNUSED, int which, SDL_Surface *canvas,
|
||||||
SDL_Surface * snapshot, int ox ATTRIBUTE_UNUSED,
|
SDL_Surface *snapshot, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y, SDL_Rect *update_rect)
|
||||||
int oy ATTRIBUTE_UNUSED, int x, int y, SDL_Rect * update_rect)
|
|
||||||
{
|
{
|
||||||
if (!check_arrays())
|
if (!check_arrays())
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,7 @@ int metalpaint_get_order(int which ATTRIBUTE_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return our descriptions, localized:
|
// Return our descriptions, localized:
|
||||||
char *metalpaint_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
char *metalpaint_get_description(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
return (strdup(gettext("Click and drag the mouse to paint with a metallic color.")));
|
return (strdup(gettext("Click and drag the mouse to paint with a metallic color.")));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -866,8 +866,7 @@ Uint8 mosaic_shaped_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which A
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint8 mosaic_shaped_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
Uint8 mosaic_shaped_default_size(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
int mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -873,8 +873,7 @@ void perspective_line(void *ptr_to_api, int which ATTRIBUTE_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Uint8 perspective_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
Uint8 perspective_accepted_sizes(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
int mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -391,8 +391,7 @@ static void realrainbow_linecb(void *ptr, int which ATTRIBUTE_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Uint8 realrainbow_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
Uint8 realrainbow_accepted_sizes(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
int mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,7 @@ int reflection_get_order(int which ATTRIBUTE_UNUSED)
|
||||||
return 400;
|
return 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *reflection_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
char *reflection_get_description(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
|
||||||
{
|
{
|
||||||
return (strdup(gettext("Click and drag the mouse around to add a reflection to your picture.")));
|
return (strdup(gettext("Click and drag the mouse around to add a reflection to your picture.")));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,8 +136,7 @@ void ripples_drag(magic_api * api ATTRIBUTE_UNUSED,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ripples_linecb(void *ptr, int which ATTRIBUTE_UNUSED,
|
static void ripples_linecb(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface *canvas, SDL_Surface *last, int x, int y)
|
||||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y)
|
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
Uint8 r, g, b;
|
Uint8 r, g, b;
|
||||||
|
|
|
||||||
|
|
@ -179,13 +179,11 @@ void rotate_drag(magic_api * api, int which ATTRIBUTE_UNUSED, SDL_Surface * canv
|
||||||
/* Draw indicator lines */
|
/* Draw indicator lines */
|
||||||
xx = (canvas->w / 2) + ((int)(cos(ang) * 100));
|
xx = (canvas->w / 2) + ((int)(cos(ang) * 100));
|
||||||
yy = (canvas->h / 2) - ((int)(sin(ang) * 100));
|
yy = (canvas->h / 2) - ((int)(sin(ang) * 100));
|
||||||
api->line((void *)api, which, canvas, last, canvas->w / 2, canvas->h / 2, xx, yy, 1,
|
api->line((void *)api, which, canvas, last, canvas->w / 2, canvas->h / 2, xx, yy, 1, rotate_xorline_callback);
|
||||||
rotate_xorline_callback);
|
|
||||||
|
|
||||||
xx = (canvas->w / 2) + ((int)(cos(ang + (M_PI / 2)) * 200));
|
xx = (canvas->w / 2) + ((int)(cos(ang + (M_PI / 2)) * 200));
|
||||||
yy = (canvas->h / 2) - ((int)(sin(ang + (M_PI / 2)) * 200));
|
yy = (canvas->h / 2) - ((int)(sin(ang + (M_PI / 2)) * 200));
|
||||||
api->line((void *)api, which, canvas, last, canvas->w / 2, canvas->h / 2, xx, yy, 1,
|
api->line((void *)api, which, canvas, last, canvas->w / 2, canvas->h / 2, xx, yy, 1, rotate_xorline_callback);
|
||||||
rotate_xorline_callback);
|
|
||||||
|
|
||||||
update_rect->x = 0;
|
update_rect->x = 0;
|
||||||
update_rect->y = 0;
|
update_rect->y = 0;
|
||||||
|
|
@ -218,8 +216,7 @@ void rotate_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
void rotate_release(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
void rotate_release(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * canvas,
|
SDL_Surface *canvas, SDL_Surface *last ATTRIBUTE_UNUSED, int x, int y, SDL_Rect *update_rect)
|
||||||
SDL_Surface * last ATTRIBUTE_UNUSED, int x, int y, SDL_Rect * update_rect)
|
|
||||||
{
|
{
|
||||||
/* Final rotation work; and now, record the final angle
|
/* Final rotation work; and now, record the final angle
|
||||||
* we landed at, so we can reuse it -- both for stacking up
|
* we landed at, so we can reuse it -- both for stacking up
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@
|
||||||
#include "SDL_image.h"
|
#include "SDL_image.h"
|
||||||
#include "SDL_mixer.h"
|
#include "SDL_mixer.h"
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
TOOL_SPIRAL_CIRCLE,
|
TOOL_SPIRAL_CIRCLE,
|
||||||
TOOL_SPIRAL_SQUARE,
|
TOOL_SPIRAL_SQUARE,
|
||||||
TOOL_CONCENTRIC_CIRCLE,
|
TOOL_CONCENTRIC_CIRCLE,
|
||||||
|
|
@ -115,8 +116,7 @@ void spiral_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas,
|
||||||
SDL_Rect * update_rect);
|
SDL_Rect * update_rect);
|
||||||
|
|
||||||
void do_spiral(magic_api * api, int which, SDL_Surface * canvas,
|
void do_spiral(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, int final);
|
||||||
int final);
|
|
||||||
|
|
||||||
Uint32 spiral_api_version(void)
|
Uint32 spiral_api_version(void)
|
||||||
{
|
{
|
||||||
|
|
@ -201,8 +201,7 @@ static void do_spiral_render(void *ptr, int which,
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_spiral(magic_api *api, int which, SDL_Surface *canvas,
|
void do_spiral(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, int final)
|
||||||
int final)
|
|
||||||
{
|
{
|
||||||
float radius = 0, i, xx, yy, xsgn, ysgn, stp, oxx, oyy;
|
float radius = 0, i, xx, yy, xsgn, ysgn, stp, oxx, oyy;
|
||||||
int vol;
|
int vol;
|
||||||
|
|
@ -239,8 +238,7 @@ void do_spiral(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
{
|
{
|
||||||
api->line((void *)api, which, canvas, NULL,
|
api->line((void *)api, which, canvas, NULL,
|
||||||
((int)oxx) + spiral_cx, ((int)oyy) + spiral_cy,
|
((int)oxx) + spiral_cx, ((int)oyy) + spiral_cy,
|
||||||
((int) xx) + spiral_cx, ((int) yy) + spiral_cy,
|
((int)xx) + spiral_cx, ((int)yy) + spiral_cy, 1, do_spiral_render);
|
||||||
1, do_spiral_render);
|
|
||||||
oxx = xx;
|
oxx = xx;
|
||||||
oyy = yy;
|
oyy = yy;
|
||||||
}
|
}
|
||||||
|
|
@ -264,23 +262,19 @@ void do_spiral(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
if (dir == 0) // right
|
if (dir == 0) // right
|
||||||
api->line((void *)api, which, canvas, NULL,
|
api->line((void *)api, which, canvas, NULL,
|
||||||
spiral_cx - (ooi * xsgn), spiral_cy - (oi * ysgn),
|
spiral_cx - (ooi * xsgn), spiral_cy - (oi * ysgn),
|
||||||
spiral_cx + (i * xsgn), spiral_cy - (oi * ysgn),
|
spiral_cx + (i * xsgn), spiral_cy - (oi * ysgn), 1, do_spiral_render);
|
||||||
1, do_spiral_render);
|
|
||||||
else if (dir == 1) // down
|
else if (dir == 1) // down
|
||||||
api->line((void *)api, which, canvas, NULL,
|
api->line((void *)api, which, canvas, NULL,
|
||||||
spiral_cx + (oi * xsgn), spiral_cy - (ooi * ysgn),
|
spiral_cx + (oi * xsgn), spiral_cy - (ooi * ysgn),
|
||||||
spiral_cx + (oi * xsgn), spiral_cy + (i * ysgn),
|
spiral_cx + (oi * xsgn), spiral_cy + (i * ysgn), 1, do_spiral_render);
|
||||||
1, do_spiral_render);
|
|
||||||
else if (dir == 2) // left
|
else if (dir == 2) // left
|
||||||
api->line((void *)api, which, canvas, NULL,
|
api->line((void *)api, which, canvas, NULL,
|
||||||
spiral_cx + (ooi * xsgn), spiral_cy + (oi * ysgn),
|
spiral_cx + (ooi * xsgn), spiral_cy + (oi * ysgn),
|
||||||
spiral_cx - (i * xsgn), spiral_cy + (oi * ysgn),
|
spiral_cx - (i * xsgn), spiral_cy + (oi * ysgn), 1, do_spiral_render);
|
||||||
1, do_spiral_render);
|
|
||||||
else if (dir == 3) // up
|
else if (dir == 3) // up
|
||||||
api->line((void *)api, which, canvas, NULL,
|
api->line((void *)api, which, canvas, NULL,
|
||||||
spiral_cx - (oi * xsgn), spiral_cy + (ooi * ysgn),
|
spiral_cx - (oi * xsgn), spiral_cy + (ooi * ysgn),
|
||||||
spiral_cx - (oi * xsgn), spiral_cy - (i * ysgn),
|
spiral_cx - (oi * xsgn), spiral_cy - (i * ysgn), 1, do_spiral_render);
|
||||||
1, do_spiral_render);
|
|
||||||
|
|
||||||
dir = (dir + 1) % 4;
|
dir = (dir + 1) % 4;
|
||||||
|
|
||||||
|
|
@ -311,8 +305,7 @@ void do_spiral(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
{
|
{
|
||||||
api->line((void *)api, which, canvas, NULL,
|
api->line((void *)api, which, canvas, NULL,
|
||||||
((int)oxx) + spiral_cx, ((int)oyy) + spiral_cy,
|
((int)oxx) + spiral_cx, ((int)oyy) + spiral_cy,
|
||||||
((int) xx) + spiral_cx, ((int) yy) + spiral_cy,
|
((int)xx) + spiral_cx, ((int)yy) + spiral_cy, 1, do_spiral_render);
|
||||||
1, do_spiral_render);
|
|
||||||
oxx = xx;
|
oxx = xx;
|
||||||
oyy = yy;
|
oyy = yy;
|
||||||
}
|
}
|
||||||
|
|
@ -330,21 +323,13 @@ void do_spiral(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
for (i = spiral_thickness; i < radius; i += spiral_thickness * 8)
|
for (i = spiral_thickness; i < radius; i += spiral_thickness * 8)
|
||||||
{
|
{
|
||||||
api->line((void *)api, which, canvas, NULL,
|
api->line((void *)api, which, canvas, NULL,
|
||||||
spiral_cx - i, spiral_cy - i,
|
spiral_cx - i, spiral_cy - i, spiral_cx + i, spiral_cy - i, 1, do_spiral_render);
|
||||||
spiral_cx + i, spiral_cy - i,
|
|
||||||
1, do_spiral_render);
|
|
||||||
api->line((void *)api, which, canvas, NULL,
|
api->line((void *)api, which, canvas, NULL,
|
||||||
spiral_cx + i, spiral_cy - i,
|
spiral_cx + i, spiral_cy - i, spiral_cx + i, spiral_cy + i, 1, do_spiral_render);
|
||||||
spiral_cx + i, spiral_cy + i,
|
|
||||||
1, do_spiral_render);
|
|
||||||
api->line((void *)api, which, canvas, NULL,
|
api->line((void *)api, which, canvas, NULL,
|
||||||
spiral_cx + i, spiral_cy + i,
|
spiral_cx + i, spiral_cy + i, spiral_cx - i, spiral_cy + i, 1, do_spiral_render);
|
||||||
spiral_cx - i, spiral_cy + i,
|
|
||||||
1, do_spiral_render);
|
|
||||||
api->line((void *)api, which, canvas, NULL,
|
api->line((void *)api, which, canvas, NULL,
|
||||||
spiral_cx - i, spiral_cy + i,
|
spiral_cx - i, spiral_cy + i, spiral_cx - i, spiral_cy - i, 1, do_spiral_render);
|
||||||
spiral_cx - i, spiral_cy - i,
|
|
||||||
1, do_spiral_render);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -364,7 +349,8 @@ void do_spiral(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
}
|
}
|
||||||
|
|
||||||
void spiral_drag(magic_api *api, int which, SDL_Surface *canvas,
|
void spiral_drag(magic_api *api, int which, SDL_Surface *canvas,
|
||||||
SDL_Surface * last, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y, SDL_Rect * update_rect)
|
SDL_Surface *last, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y,
|
||||||
|
SDL_Rect *update_rect)
|
||||||
{
|
{
|
||||||
spiral_has_dragged = 1;
|
spiral_has_dragged = 1;
|
||||||
do_spiral(api, which, canvas, last, x, y, update_rect, 0);
|
do_spiral(api, which, canvas, last, x, y, update_rect, 0);
|
||||||
|
|
@ -383,9 +369,7 @@ void spiral_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
void spiral_release(magic_api *api, int which,
|
void spiral_release(magic_api *api, int which,
|
||||||
SDL_Surface * canvas,
|
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)
|
|
||||||
{
|
{
|
||||||
float radius;
|
float radius;
|
||||||
|
|
||||||
|
|
@ -406,7 +390,8 @@ void spiral_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
void spiral_set_color(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface *canvas,
|
void spiral_set_color(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface *canvas,
|
||||||
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
SDL_Surface *last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b,
|
||||||
|
SDL_Rect *update_rect ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
spiral_color = SDL_MapRGB(canvas->format, r, g, b);
|
spiral_color = SDL_MapRGB(canvas->format, r, g, b);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -215,8 +215,8 @@ void spraypaint_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
Mix_FreeChunk(spraypaint_snd_shake);
|
Mix_FreeChunk(spraypaint_snd_shake);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spraypaint_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
void spraypaint_set_color(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g,
|
SDL_Surface *canvas ATTRIBUTE_UNUSED, SDL_Surface *last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g,
|
||||||
Uint8 b, SDL_Rect *update_rect ATTRIBUTE_UNUSED)
|
Uint8 b, SDL_Rect *update_rect ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
spraypaint_r = r;
|
spraypaint_r = r;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@
|
||||||
#define REPEAT_CNT 3
|
#define REPEAT_CNT 3
|
||||||
#define SIN_60DEG 0.866025403784439
|
#define SIN_60DEG 0.866025403784439
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
TOOL_TESSELL_POINTY_TOP,
|
TOOL_TESSELL_POINTY_TOP,
|
||||||
TOOL_TESSELL_FLAT_TOP,
|
TOOL_TESSELL_FLAT_TOP,
|
||||||
NUM_TOOLS
|
NUM_TOOLS
|
||||||
|
|
@ -205,8 +206,8 @@ void tessell_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
Mix_FreeChunk(tessell_snd);
|
Mix_FreeChunk(tessell_snd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tessell_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
void tessell_set_color(magic_api *api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g,
|
SDL_Surface *canvas ATTRIBUTE_UNUSED, SDL_Surface *last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g,
|
||||||
Uint8 b, SDL_Rect *update_rect ATTRIBUTE_UNUSED)
|
Uint8 b, SDL_Rect *update_rect ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
tessell_color = SDL_MapRGB(canvas->format, r, g, b);
|
tessell_color = SDL_MapRGB(canvas->format, r, g, b);
|
||||||
|
|
@ -217,8 +218,7 @@ int tessell_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUT
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tessell_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
void tessell_switchin(magic_api *api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED, SDL_Surface *canvas)
|
||||||
int which, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas)
|
|
||||||
{
|
{
|
||||||
int tessell_mult;
|
int tessell_mult;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,7 @@ void load_from_assets(SDL_Surface * screen, SDL_Texture * texture,
|
||||||
void (*fn)(SDL_Surface *screen, SDL_Texture *texture,
|
void (*fn)(SDL_Surface *screen, SDL_Texture *texture,
|
||||||
SDL_Renderer *renderer,
|
SDL_Renderer *renderer,
|
||||||
const char *restrict const dir,
|
const char *restrict const dir,
|
||||||
unsigned dirlen, tp_ftw_str * files,
|
unsigned dirlen, tp_ftw_str *files, unsigned count, const char *restrict const locale))
|
||||||
unsigned count, const char *restrict const locale))
|
|
||||||
{
|
{
|
||||||
unsigned num_file_names = 0;
|
unsigned num_file_names = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,7 @@ static int f2dec(float f)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actually save the PostScript data to the file stream: */
|
/* Actually save the PostScript data to the file stream: */
|
||||||
int do_ps_save(FILE * fi,
|
int do_ps_save(FILE *fi, const char *restrict const fname, SDL_Surface *surf, const char *restrict pprsize, int is_pipe)
|
||||||
const char *restrict const fname, SDL_Surface * surf, const char *restrict pprsize, int is_pipe)
|
|
||||||
{
|
{
|
||||||
const struct paper *ppr;
|
const struct paper *ppr;
|
||||||
int img_w = surf->w;
|
int img_w = surf->w;
|
||||||
|
|
|
||||||
|
|
@ -1975,8 +1975,7 @@ enum
|
||||||
|
|
||||||
static SDL_Surface *img_cur_brush;
|
static SDL_Surface *img_cur_brush;
|
||||||
static int img_cur_brush_frame_w, img_cur_brush_w, img_cur_brush_h,
|
static int img_cur_brush_frame_w, img_cur_brush_w, img_cur_brush_h,
|
||||||
img_cur_brush_frames, img_cur_brush_directional, img_cur_brush_rotate,
|
img_cur_brush_frames, img_cur_brush_directional, img_cur_brush_rotate, img_cur_brush_chaotic, img_cur_brush_spacing;
|
||||||
img_cur_brush_chaotic, img_cur_brush_spacing;
|
|
||||||
static int brush_counter, brush_frame;
|
static int brush_counter, brush_frame;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
@ -5524,7 +5523,8 @@ static void mainloop(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
draw_color = SDL_MapRGB(canvas->format,
|
draw_color = SDL_MapRGB(canvas->format,
|
||||||
color_hexes[cur_color][0], color_hexes[cur_color][1], color_hexes[cur_color][2]);
|
color_hexes[cur_color][0], color_hexes[cur_color][1],
|
||||||
|
color_hexes[cur_color][2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
would_fill = would_flood_fill(canvas, draw_color, canv_color);
|
would_fill = would_flood_fill(canvas, draw_color, canv_color);
|
||||||
|
|
@ -5558,8 +5558,7 @@ static void mainloop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur_fill == FILL_FLOOD ||
|
if (cur_fill == FILL_FLOOD || (cur_fill == FILL_ERASER && img_starter_bkgd == NULL))
|
||||||
(cur_fill == FILL_ERASER && img_starter_bkgd == NULL))
|
|
||||||
{
|
{
|
||||||
/* Flood fill a solid color */
|
/* Flood fill a solid color */
|
||||||
|
|
||||||
|
|
@ -5621,6 +5620,7 @@ static void mainloop(void)
|
||||||
else if (cur_fill == FILL_ERASER)
|
else if (cur_fill == FILL_ERASER)
|
||||||
{
|
{
|
||||||
void (*putpixel)(SDL_Surface *, int, int, Uint32) = putpixels[canvas->format->BytesPerPixel];
|
void (*putpixel)(SDL_Surface *, int, int, Uint32) = putpixels[canvas->format->BytesPerPixel];
|
||||||
|
|
||||||
Uint32(*getpixel) (SDL_Surface *, int, int) = getpixels[img_starter_bkgd->format->BytesPerPixel];
|
Uint32(*getpixel) (SDL_Surface *, int, int) = getpixels[img_starter_bkgd->format->BytesPerPixel];
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
@ -7390,14 +7390,15 @@ static void blit_brush(int x, int y, int direction, double rotation, int *w, int
|
||||||
{
|
{
|
||||||
SDL_Surface *brush_frame_surf;
|
SDL_Surface *brush_frame_surf;
|
||||||
|
|
||||||
brush_frame_surf =
|
brush_frame_surf = SDL_CreateRGBSurface(0, src.w, src.h, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
|
||||||
SDL_CreateRGBSurface(0, src.w, src.h, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
|
|
||||||
|
|
||||||
if (brush_frame_surf != NULL)
|
if (brush_frame_surf != NULL)
|
||||||
{
|
{
|
||||||
/* Ensure any semi-transparent areas or edges match the same color as we're painting
|
/* Ensure any semi-transparent areas or edges match the same color as we're painting
|
||||||
(and not cause a black halo; see https://sourceforge.net/p/tuxpaint/bugs/259/ -bjk 2024.10.11) */
|
(and not cause a black halo; see https://sourceforge.net/p/tuxpaint/bugs/259/ -bjk 2024.10.11) */
|
||||||
SDL_FillRect(brush_frame_surf, NULL, SDL_MapRGBA(brush_frame_surf->format, color_hexes[cur_color][0], color_hexes[cur_color][1], color_hexes[cur_color][2], 0));
|
SDL_FillRect(brush_frame_surf, NULL,
|
||||||
|
SDL_MapRGBA(brush_frame_surf->format, color_hexes[cur_color][0], color_hexes[cur_color][1],
|
||||||
|
color_hexes[cur_color][2], 0));
|
||||||
|
|
||||||
/* 2021/09/28 SDL(2)_gfxBlitRGBA() is not available in the SDL2_gfx library, using plain SDL_BlitSurface() instead. Pere
|
/* 2021/09/28 SDL(2)_gfxBlitRGBA() is not available in the SDL2_gfx library, using plain SDL_BlitSurface() instead. Pere
|
||||||
SDL_gfxBlitRGBA(img_cur_brush, &src, brush_frame_surf, NULL); */
|
SDL_gfxBlitRGBA(img_cur_brush, &src, brush_frame_surf, NULL); */
|
||||||
|
|
@ -8369,8 +8370,7 @@ static unsigned compute_default_scale_factor(double ratio)
|
||||||
*/
|
*/
|
||||||
static void loadbrush_callback(SDL_Surface *screen,
|
static void loadbrush_callback(SDL_Surface *screen,
|
||||||
__attribute__((unused)) SDL_Texture *texture,
|
__attribute__((unused)) SDL_Texture *texture,
|
||||||
__attribute__((unused)) SDL_Renderer *
|
__attribute__((unused)) SDL_Renderer *renderer, const char *restrict const dir,
|
||||||
renderer, const char *restrict const dir,
|
|
||||||
unsigned dirlen, tp_ftw_str *files, unsigned i, const char *restrict const locale)
|
unsigned dirlen, tp_ftw_str *files, unsigned i, const char *restrict const locale)
|
||||||
{
|
{
|
||||||
FILE *fi;
|
FILE *fi;
|
||||||
|
|
@ -9283,8 +9283,7 @@ static void get_stamp_thumb(stamp_type * sd, int process_sound)
|
||||||
*/
|
*/
|
||||||
static void loadstamp_callback(SDL_Surface *screen,
|
static void loadstamp_callback(SDL_Surface *screen,
|
||||||
__attribute__((unused)) SDL_Texture *texture,
|
__attribute__((unused)) SDL_Texture *texture,
|
||||||
__attribute__((unused)) SDL_Renderer *
|
__attribute__((unused)) SDL_Renderer *renderer, const char *restrict const dir,
|
||||||
renderer, const char *restrict const dir,
|
|
||||||
unsigned dirlen, tp_ftw_str *files, unsigned i, const char *restrict const locale)
|
unsigned dirlen, tp_ftw_str *files, unsigned i, const char *restrict const locale)
|
||||||
{
|
{
|
||||||
(void)locale;
|
(void)locale;
|
||||||
|
|
@ -13710,8 +13709,7 @@ static int SDLCALL NondefectiveBlit(SDL_Surface * src, const SDL_Rect * srcrect,
|
||||||
*/
|
*/
|
||||||
static void autoscale_copy_smear_free(SDL_Surface *src, SDL_Surface *dst,
|
static void autoscale_copy_smear_free(SDL_Surface *src, SDL_Surface *dst,
|
||||||
int SDLCALL(*blit) (SDL_Surface *src,
|
int SDLCALL(*blit) (SDL_Surface *src,
|
||||||
const SDL_Rect * srcrect,
|
const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect))
|
||||||
SDL_Surface * dst, SDL_Rect * dstrect))
|
|
||||||
{
|
{
|
||||||
SDL_Surface *src1;
|
SDL_Surface *src1;
|
||||||
SDL_Rect dest;
|
SDL_Rect dest;
|
||||||
|
|
@ -22046,8 +22044,9 @@ static void load_magic_plugins(void)
|
||||||
{
|
{
|
||||||
if (magics[group][j].order == magics[group][idx].order)
|
if (magics[group][j].order == magics[group][idx].order)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Warning: In group %d, tool %d (%s) has the same order (%d) as tool %d (%s)\n",
|
fprintf(stderr,
|
||||||
group, idx, magics[group][idx].name, magics[group][j].order, j, magics[group][j].name);
|
"Warning: In group %d, tool %d (%s) has the same order (%d) as tool %d (%s)\n", group,
|
||||||
|
idx, magics[group][idx].name, magics[group][j].order, j, magics[group][j].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22431,6 +22430,7 @@ static int magic_playingsound(void)
|
||||||
{
|
{
|
||||||
#ifndef NOSOUND
|
#ifndef NOSOUND
|
||||||
int is_playing;
|
int is_playing;
|
||||||
|
|
||||||
is_playing = Mix_Playing(0);
|
is_playing = Mix_Playing(0);
|
||||||
return is_playing;
|
return is_playing;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -29526,8 +29526,7 @@ int TP_EventFilter( __attribute__((unused))
|
||||||
event->type == SDL_APP_WILLENTERBACKGROUND ||
|
event->type == SDL_APP_WILLENTERBACKGROUND ||
|
||||||
event->type == SDL_APP_WILLENTERFOREGROUND ||
|
event->type == SDL_APP_WILLENTERFOREGROUND ||
|
||||||
event->type == SDL_APP_DIDENTERBACKGROUND ||
|
event->type == SDL_APP_DIDENTERBACKGROUND ||
|
||||||
event->type == SDL_APP_DIDENTERFOREGROUND ||
|
event->type == SDL_APP_DIDENTERFOREGROUND || event->type == TP_USEREVENT_PLAYDESCSOUND)
|
||||||
event->type == TP_USEREVENT_PLAYDESCSOUND)
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue