Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwkendrick <wkendrick>2010-06-05 01:39:08 (GMT)
committer wkendrick <wkendrick>2010-06-05 01:39:08 (GMT)
commit04be8c278a1290dea6ebe4e8750363059c44ff23 (patch)
treefa9f6aa17f2833d7706efc229d318a9cd8203a5f
parent020f528509332c2282f07bf2112f38e46437b1d1 (diff)
Added 1-axis symmetric paint Magic tools (based on the 2-axis Kaleidoscope)
-rw-r--r--docs/CHANGES.txt9
-rw-r--r--magic/icons/symmetric_leftright.pngbin0 -> 798 bytes
-rw-r--r--magic/icons/symmetric_updown.pngbin0 -> 962 bytes
-rw-r--r--magic/src/kalidescope.c54
4 files changed, 50 insertions, 13 deletions
diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt
index b63112a..e233191 100644
--- a/docs/CHANGES.txt
+++ b/docs/CHANGES.txt
@@ -6,9 +6,9 @@ Copyright (c) 2002-2009 by Bill Kendrick and others
bill@newbreedsoftware.com
http://www.tuxpaint.org/
-$Id: CHANGES.txt,v 1.738 2010/05/28 23:00:39 wkendrick Exp $
+$Id: CHANGES.txt,v 1.739 2010/06/05 01:39:08 wkendrick Exp $
-2009.May.28 (0.9.22)
+2009.June.4 (0.9.22)
* New Tools:
----------
* Label - A tool to add text to a drawing, which can be modified or
@@ -32,6 +32,11 @@ $Id: CHANGES.txt,v 1.738 2010/05/28 23:00:39 wkendrick Exp $
* ROYGBIV Rainbow - Draw a rainbow arc using solid colors of
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.
(Based on Smudge tool. Requested by gallery artist Angela.)
diff --git a/magic/icons/symmetric_leftright.png b/magic/icons/symmetric_leftright.png
new file mode 100644
index 0000000..ec466cd
--- /dev/null
+++ b/magic/icons/symmetric_leftright.png
Binary files differ
diff --git a/magic/icons/symmetric_updown.png b/magic/icons/symmetric_updown.png
new file mode 100644
index 0000000..7b61ebf
--- /dev/null
+++ b/magic/icons/symmetric_updown.png
Binary files differ
diff --git a/magic/src/kalidescope.c b/magic/src/kalidescope.c
index 9ece5c3..4ab84bb 100644
--- a/magic/src/kalidescope.c
+++ b/magic/src/kalidescope.c
@@ -24,7 +24,7 @@
(See COPYING.txt)
Last updated: July 8, 2008
- $Id: kalidescope.c,v 1.11 2008/07/10 20:26:39 wkendrick Exp $
+ $Id: kalidescope.c,v 1.12 2010/06/05 01:39:09 wkendrick Exp $
*/
#include <stdio.h>
@@ -41,6 +41,19 @@ static Uint8 kalidescope_r, kalidescope_g, kalidescope_b;
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:
int kalidescope_init(magic_api * api)
@@ -54,10 +67,9 @@ int kalidescope_init(magic_api * api)
return(1);
}
-// We have multiple tools:
int kalidescope_get_tool_count(magic_api * api)
{
- return(1);
+ return(KAL_COUNT);
}
// Load our icons:
@@ -65,8 +77,8 @@ SDL_Surface * kalidescope_get_icon(magic_api * api, int which)
{
char fname[1024];
- snprintf(fname, sizeof(fname), "%s/images/magic/kalidescope.png",
- api->data_directory);
+ snprintf(fname, sizeof(fname), "%s/images/magic/%s",
+ api->data_directory, kal_icon_names[which]);
return(IMG_Load(fname));
}
@@ -74,13 +86,25 @@ SDL_Surface * kalidescope_get_icon(magic_api * api, int which)
// Return our names, localized:
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:
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:
@@ -104,9 +128,17 @@ static void do_kalidescope(void * ptr, int which, SDL_Surface * canvas, SDL_Surf
if (api->in_circle(xx, yy, 8))
{
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);
- api->putpixel(canvas, canvas->w - 1 - x + xx, canvas->h - 1 - y + yy, colr);
+
+ if (which == KAL_LR || which == KAL_BOTH) {
+ 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->h = canvas->h;
- api->playsound(kalidescope_snd, 255, 255);
+ api->playsound(kalidescope_snd, 128, 255);
}
// Affect the canvas on click: