diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt
index 575e4b5fe..a595b146f 100644
--- a/docs/CHANGES.txt
+++ b/docs/CHANGES.txt
@@ -8,7 +8,14 @@ http://www.tuxpaint.org/
$Id$
-2021.September.2 (0.9.27)
+2021.September.4 (0.9.27)
+ * New Magic Tools:
+ ----------------
+ * "Panels" - Convert your picture to 4-panel-comic-style
+ 2x2 image, repeating the original. (Repeat for "compound eye"
+ style effects!)
+ (Closes https://sourceforge.net/p/tuxpaint/feature-requests/204/)
+
* Documentation updates
---------------------
* Ensured Tux Paint's built-in help ("tuxpaint --help"),
diff --git a/magic/docs/en/README.txt b/magic/docs/en/README.txt
index f5173ae38..672494c2d 100644
--- a/magic/docs/en/README.txt
+++ b/magic/docs/en/README.txt
@@ -1,6 +1,6 @@
Creating Tux Paint Magic Tool Plugins
- Copyright 2007-2018 by various contributors; see AUTHORS.txt
+ Copyright 2007-2021 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/
July 5, 2007 - February 20, 2021
diff --git a/magic/docs/en/html/README.html b/magic/docs/en/html/README.html
index e6fcd52ef..23b246a99 100644
--- a/magic/docs/en/html/README.html
+++ b/magic/docs/en/html/README.html
@@ -9,7 +9,7 @@ alink="#FF00FF">
Creating Tux Paint Magic Tool Plugins
-Copyright 2007-2018 by various contributors; see AUTHORS.txt
+
Copyright 2007-2021 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/
July 5, 2007 - February 20, 2021
diff --git a/magic/icons/panels.png b/magic/icons/panels.png
new file mode 100644
index 000000000..7da5adb71
Binary files /dev/null and b/magic/icons/panels.png differ
diff --git a/magic/magic-docs/en/html/index.html b/magic/magic-docs/en/html/index.html
index ed77bc230..b50bcda63 100644
--- a/magic/magic-docs/en/html/index.html
+++ b/magic/magic-docs/en/html/index.html
@@ -39,6 +39,7 @@
Square Mosaic
Negative
Noise
+Panels
Pattern
Perspective
Picasso
diff --git a/magic/magic-docs/en/html/panels.html b/magic/magic-docs/en/html/panels.html
new file mode 100644
index 000000000..b7db99cf6
--- /dev/null
+++ b/magic/magic-docs/en/html/panels.html
@@ -0,0 +1,9 @@
+
+Tux Paint "Magic" Tool: Panels
+
+
+
+Tux Paint "Magic" Tool: Panels
+
+Shrink the image and repeat it four times in a 2-by-2 grid. Useful for creating 4-panel comics. Can also be used to create a compound-eye effect.
+
\ No newline at end of file
diff --git a/magic/magic-docs/en/index.txt b/magic/magic-docs/en/index.txt
index 667124e6b..7d4cdcf23 100644
--- a/magic/magic-docs/en/index.txt
+++ b/magic/magic-docs/en/index.txt
@@ -35,6 +35,7 @@
* Square Mosaic
* Negative
* Noise
+ * Panels
* Pattern
* Perspective
* Picasso
diff --git a/magic/magic-docs/en/panels.txt b/magic/magic-docs/en/panels.txt
new file mode 100644
index 000000000..a5201368a
--- /dev/null
+++ b/magic/magic-docs/en/panels.txt
@@ -0,0 +1,6 @@
+ Tux Paint "Magic" Tool: Panels
+
+ By Bill Kendrick
+
+ Shrink the image and repeat it four times in a 2-by-2 grid. Useful for
+ creating 4-panel comics. Can also be used to create a compound-eye effect.
diff --git a/magic/magic-docs/src/magic-docs.php b/magic/magic-docs/src/magic-docs.php
index 2904c7b98..1b852e004 100644
--- a/magic/magic-docs/src/magic-docs.php
+++ b/magic/magic-docs/src/magic-docs.php
@@ -221,6 +221,10 @@ $tools = array(
'desc'=>'Add random noise and static to your picture.',
'author'=>$AUTHOR_ANDREWC),
+ array('name'=>'Panels',
+ 'desc'=>'Shrink the image and repeat it four times in a 2-by-2 grid. Useful for creating 4-panel comics. Can also be used to create a compound-eye effect.',
+ 'author'=>$AUTHOR_KENDRICK),
+
array('name'=>'Pattern',
'desc'=>'Draws a tiled pattern around the picture.',
'author'=>$AUTHOR_PERE,
diff --git a/magic/src/perspective.c b/magic/src/perspective.c
index b8d087d4a..692805769 100644
--- a/magic/src/perspective.c
+++ b/magic/src/perspective.c
@@ -8,7 +8,7 @@
Credits: Andrew Corcoran
- Copyright (c) 2002-2019 by Bill Kendrick and others; see AUTHORS.txt
+ Copyright (c) 2002-2021 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
@@ -27,7 +27,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
- Last updated: August 29, 2019
+ Last updated: September 4, 2021
$Id$
*/
@@ -114,6 +114,7 @@ float top_advc_y, right_advc_y, bottom_advc_y, left_advc_y;
enum
{
TOOL_PERSPECTIVE,
+ TOOL_PANELS,
TOOL_ZOOM,
perspective_NUM_TOOLS
};
@@ -134,28 +135,29 @@ static Mix_Chunk *perspective_snd_effect[perspective_NUM_TOOLS + 1];
const char *perspective_snd_filenames[perspective_NUM_TOOLS + 1] = {
"perspective.ogg",
+ "zoom_down.ogg", /* TODO: Could use a different sound */
"zoom_up.ogg",
"zoom_down.ogg",
};
const char *perspective_icon_filenames[perspective_NUM_TOOLS] = {
"perspective.png",
+ "panels.png",
"zoom.png",
};
const char *perspective_names[perspective_NUM_TOOLS] = {
gettext_noop("Perspective"),
+ gettext_noop("Panels"),
gettext_noop("Zoom"),
-
};
const char *perspective_descs[perspective_NUM_TOOLS] = {
gettext_noop("Click on the corners and drag where you want to stretch the picture."),
+ gettext_noop("Click to turn your picture into 2-by-2 panels."),
gettext_noop("Click and drag up to zoom in or drag down to zoom out the picture."),
-
-
};
Uint32 perspective_api_version(void)
@@ -358,8 +360,56 @@ void perspective_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
old_h = new_h;
}
break;
+ case TOOL_PANELS:
+ {
+ SDL_Surface *scaled_surf;
+
+ scaled_surf = api->scale(canvas, canvas->w / 2, canvas->h / 2, 0);
+
+ /* Top left */
+ update_rect->x = 0;
+ update_rect->y = 0;
+ update_rect->w = scaled_surf->w;
+ update_rect->h = scaled_surf->h;
+ SDL_BlitSurface(scaled_surf, NULL, canvas, update_rect);
+
+ /* Top right */
+ update_rect->x = scaled_surf->w;
+ update_rect->y = 0;
+ update_rect->w = scaled_surf->w;
+ update_rect->h = scaled_surf->h;
+ SDL_BlitSurface(scaled_surf, NULL, canvas, update_rect);
+
+ /* Bottom left */
+ update_rect->x = 0;
+ update_rect->y = scaled_surf->h;
+ update_rect->w = scaled_surf->w;
+ update_rect->h = scaled_surf->h;
+ SDL_BlitSurface(scaled_surf, NULL, canvas, update_rect);
+
+ /* Bottom right */
+ update_rect->x = scaled_surf->w;
+ update_rect->y = scaled_surf->h;
+ update_rect->w = scaled_surf->w;
+ update_rect->h = scaled_surf->h;
+ SDL_BlitSurface(scaled_surf, NULL, canvas, update_rect);
+
+ update_rect->x = 0;
+ update_rect->y = 0;
+ update_rect->w = canvas->w;
+ update_rect->h = canvas->h;
+
+ SDL_FreeSurface(scaled_surf);
+
+ api->playsound(perspective_snd_effect[which], 127, 255);
+ }
+ break;
+ }
+
+ if (which != TOOL_PANELS)
+ {
+ perspective_drag(api, which, canvas, last, x, y, x, y, update_rect);
}
- perspective_drag(api, which, canvas, last, x, y, x, y, update_rect);
}
@@ -482,7 +532,6 @@ void perspective_preview(magic_api * api, int which ATTRIBUTE_UNUSED,
}
}
-// No setup happened:
void perspective_shutdown(magic_api * api ATTRIBUTE_UNUSED)
{
//Clean up sounds
@@ -546,9 +595,13 @@ void perspective_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE
SDL_FreeSurface(canvas_back);
}
-int perspective_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
+int perspective_modes(magic_api * api ATTRIBUTE_UNUSED, int which)
{
- return (MODE_PAINT_WITH_PREVIEW);
+ if (which == TOOL_PANELS) {
+ return (MODE_FULLSCREEN);
+ } else {
+ return (MODE_PAINT_WITH_PREVIEW);
+ }
}
void perspective_line(void *ptr_to_api, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,