Added 1-axis symmetric paint Magic tools (based on the 2-axis Kaleidoscope)

This commit is contained in:
William Kendrick 2010-06-05 01:39:08 +00:00
parent ba4b907d49
commit 9c3b619fca
4 changed files with 48 additions and 11 deletions

View file

@ -8,7 +8,7 @@ http://www.tuxpaint.org/
$Id$ $Id$
2009.May.28 (0.9.22) 2009.June.4 (0.9.22)
* New Tools: * New Tools:
---------- ----------
* Label - A tool to add text to a drawing, which can be modified or * Label - A tool to add text to a drawing, which can be modified or
@ -32,6 +32,11 @@ $Id$
* ROYGBIV Rainbow - Draw a rainbow arc using solid colors of * ROYGBIV Rainbow - Draw a rainbow arc using solid colors of
Red, Orange, Yellow, Green, Blue, Indigo and Violet. Red, Orange, Yellow, Green, Blue, Indigo and Violet.
* Symmetry Left/Right, Symmetry Up/Down - Paint with relfective symmetry
across the horizontal or vertical center of the image.
(Like Kaleidoscope, but only one mirrored brush, either left/right
or up/down.)
* Wet Paint - Draws a light coat of paint, and smudges at the same time. * Wet Paint - Draws a light coat of paint, and smudges at the same time.
(Based on Smudge tool. Requested by gallery artist Angela.) (Based on Smudge tool. Requested by gallery artist Angela.)

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

View file

@ -41,6 +41,19 @@ static Uint8 kalidescope_r, kalidescope_g, kalidescope_b;
Uint32 kalidescope_api_version(void) { return(TP_MAGIC_API_VERSION); } Uint32 kalidescope_api_version(void) { return(TP_MAGIC_API_VERSION); }
enum {
KAL_UD,
KAL_LR,
KAL_BOTH,
KAL_COUNT
};
char * kal_icon_names[KAL_COUNT] = {
"symmetric_updown.png",
"symmetric_leftright.png",
"kalidescope.png",
};
// No setup required: // No setup required:
int kalidescope_init(magic_api * api) int kalidescope_init(magic_api * api)
@ -54,10 +67,9 @@ int kalidescope_init(magic_api * api)
return(1); return(1);
} }
// We have multiple tools:
int kalidescope_get_tool_count(magic_api * api) int kalidescope_get_tool_count(magic_api * api)
{ {
return(1); return(KAL_COUNT);
} }
// Load our icons: // Load our icons:
@ -65,8 +77,8 @@ SDL_Surface * kalidescope_get_icon(magic_api * api, int which)
{ {
char fname[1024]; char fname[1024];
snprintf(fname, sizeof(fname), "%s/images/magic/kalidescope.png", snprintf(fname, sizeof(fname), "%s/images/magic/%s",
api->data_directory); api->data_directory, kal_icon_names[which]);
return(IMG_Load(fname)); return(IMG_Load(fname));
} }
@ -74,13 +86,25 @@ SDL_Surface * kalidescope_get_icon(magic_api * api, int which)
// Return our names, localized: // Return our names, localized:
char * kalidescope_get_name(magic_api * api, int which) char * kalidescope_get_name(magic_api * api, int which)
{ {
return(strdup(gettext_noop("Kaleidoscope"))); if (which == KAL_LR) {
return(strdup(gettext_noop("Symmetric Left/Right")));
} else if (which == KAL_UD) {
return(strdup(gettext_noop("Symmetric Up/Down")));
} else { /* KAL_BOTH */
return(strdup(gettext_noop("Kaleidoscope")));
}
} }
// Return our descriptions, localized: // Return our descriptions, localized:
char * kalidescope_get_description(magic_api * api, int which, int mode) char * kalidescope_get_description(magic_api * api, int which, int mode)
{ {
return(strdup(gettext_noop("Click and drag the mouse to draw with symmetric brushes (a kaleidoscope)."))); if (which == KAL_LR) {
return(strdup(gettext_noop("Click and drag the mouse to draw with two brushes that are symmetric across the left and right of your picture.")));
} else if (which == KAL_UD) {
return(strdup(gettext_noop("Click and drag the mouse to draw with two brushes that are symmetric across the top and bottom of your picture.")));
} else { /* KAL_BOTH */
return(strdup(gettext_noop("Click and drag the mouse to draw with symmetric brushes (a kaleidoscope).")));
}
} }
// Do the effect: // Do the effect:
@ -104,9 +128,17 @@ static void do_kalidescope(void * ptr, int which, SDL_Surface * canvas, SDL_Surf
if (api->in_circle(xx, yy, 8)) if (api->in_circle(xx, yy, 8))
{ {
api->putpixel(canvas, x + xx, y + yy, colr); api->putpixel(canvas, x + xx, y + yy, colr);
api->putpixel(canvas, canvas->w - 1 - x + xx, y + yy, colr);
api->putpixel(canvas, x + xx, canvas->h - 1 - y + yy, colr); if (which == KAL_LR || which == KAL_BOTH) {
api->putpixel(canvas, canvas->w - 1 - x + xx, canvas->h - 1 - y + yy, colr); api->putpixel(canvas, canvas->w - 1 - x + xx, y + yy, colr);
if (which == KAL_BOTH) {
api->putpixel(canvas, canvas->w - 1 - x + xx, canvas->h - 1 - y + yy, colr);
}
}
if (which == KAL_UD || which == KAL_BOTH) {
api->putpixel(canvas, x + xx, canvas->h - 1 - y + yy, colr);
}
} }
} }
} }
@ -124,7 +156,7 @@ void kalidescope_drag(magic_api * api, int which, SDL_Surface * canvas,
update_rect->w = canvas->w; update_rect->w = canvas->w;
update_rect->h = canvas->h; update_rect->h = canvas->h;
api->playsound(kalidescope_snd, 255, 255); api->playsound(kalidescope_snd, 128, 255);
} }
// Affect the canvas on click: // Affect the canvas on click: