Merge branch 'master' into sdl2.0

This commit is contained in:
Pere Pujal i Carabantes 2021-09-27 23:32:48 +02:00
commit b6b0636eb5
340 changed files with 28445 additions and 40745 deletions

View file

@ -3,7 +3,7 @@
Copyright 2007-2021 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/
July 5, 2007 - February 20, 2021
July 5, 2007 - September 21, 2021
----------------------------------------------------------------------
@ -204,6 +204,33 @@ Interfaces
Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()").
* int get_group(magic_api * api, int which)
Use this to group tools together within sections of the 'Magic'
selector. A number of groups are pre-defined within an enum
found in "tp_magic_api.h":
* MAGIC_TYPE_DISTORTS mdash; Tools that distort the shape of
the image, like Blur, Emboss, and Ripples
* MAGIC_TYPE_COLOR_FILTERS mdash; Tools that mostly affect
the colors of the image without distortion, like Darken,
Negative, and Tint
* MAGIC_TYPE_PICTURE_WARPS mdash; Tools that warp or move the
entire picture, like Shift, Flip, and Waves
* MAGIC_TYPE_PAINTING mdash; Tools that generally paint new
content at the cursor position, like Grass, Bricks, and
Rails
* MAGIC_TYPE_PATTERN_PAINTING mdash; Tools that paint in
multiple places at once, like Kaleidoscope and the Symmetry
tools
* MAGIC_TYPE_PICTURE_DECORATIONS mdash; Tools that apply
decorations to the entire picture, like Blinds and
Checkboard
* MAGIC_TYPE_ARTISTIC mdash; Special-purpose artistic tools,
like Flower, the String tools, and the Rainbow-arc-drawing
tools.
Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()").
Note: Added to Tux Paint 0.9.27; Magic API version '0x00000005'
* SDL_Surface * get_icon(magic_api * api, int which)
This should return an SDL_Surface containing the icon
representing the tool. (A greyscale image with alpha, no larger

View file

@ -12,7 +12,7 @@ alink="#FF00FF">
<p>Copyright 2007-2021 by various contributors; see AUTHORS.txt<br/>
<a href="http://www.tuxpaint.org/">http://www.tuxpaint.org/</a></p>
<p>July 5, 2007 - February 20, 2021</p>
<p>July 5, 2007 - September 21, 2021</p>
</center>
<hr size=2 noshade>
@ -266,6 +266,26 @@ then the names of your functions must begin with "<code><b>zoom_</b></code>"
contain (by your "<code>get_tool_count()</code>").<br>
<br>
<li><code><b>int get_group(magic_api&nbsp;*&nbsp;api,
int&nbsp;which)</b></code><br>
Use this to group tools together within sections of the
'Magic' selector. A number of groups are pre-defined within
an <code>enum</code> found in "<code>tp_magic_api.h</code>":
<ul>
<li><code>MAGIC_TYPE_DISTORTS</code> mdash; Tools that distort the shape of the image, like Blur, Emboss, and Ripples</li>
<li><code>MAGIC_TYPE_COLOR_FILTERS</code> mdash; Tools that mostly affect the colors of the image without distortion, like Darken, Negative, and Tint</li>
<li><code>MAGIC_TYPE_PICTURE_WARPS</code> mdash; Tools that warp or move the entire picture, like Shift, Flip, and Waves</li>
<li><code>MAGIC_TYPE_PAINTING</code> mdash; Tools that generally paint new content at the cursor position, like Grass, Bricks, and Rails</li>
<li><code>MAGIC_TYPE_PATTERN_PAINTING</code> mdash; Tools that paint in multiple places at once, like Kaleidoscope and the Symmetry tools</li>
<li><code>MAGIC_TYPE_PICTURE_DECORATIONS</code> mdash; Tools that apply decorations to the entire picture, like Blinds and Checkboard</li>
<li><code>MAGIC_TYPE_ARTISTIC</code> mdash; Special-purpose artistic tools, like Flower, the String tools, and the Rainbow-arc-drawing tools.</li>
</ul>
<b>Note:</b> Called once for each Magic tool your plugin claims to
contain (by your "<code>get_tool_count()</code>").<br>
<i>Note: Added to Tux&nbsp;Paint 0.9.27; Magic API version
'0x00000005'</i><br>
<br>
<li><code><b>SDL_Surface * get_icon(magic_api&nbsp;*&nbsp;api,
int&nbsp;which)</b></code><br>
This should return an SDL_Surface containing the icon representing

View file

@ -1,7 +1,7 @@
/* tp_magic_example.c
An example of a "Magic" tool plugin for Tux Paint
Last modified: 2008.07.10
Last modified: 2021.09.21
*/
@ -56,6 +56,15 @@ const char *names[NUM_TOOLS] = {
};
/* How to group the tools with other similar tools,
within the 'Magic' selector: */
const int groups[NUM_TOOLS] = {
MAGIC_TYPE_PAINTING,
MAGIC_TYPE_DISTORTS
};
/* A list of descriptions of the tools */
const char *descs[NUM_TOOLS] = {
@ -225,6 +234,22 @@ char *example_get_name(magic_api * api, int which)
}
// Report our "Magic" tool groups
//
// When Tux Paint is starting up and loading plugins, it asks us to
// specify where the tool should be grouped.
int example_get_group(magic_api * api, int which)
{
// Return our group from the "groups[]" array.
//
// We use 'which' (which of our tools Tux Paint is asking about)
// as an index into the array.
return (groups[which]);
}
// Report our "Magic" tool descriptions
//
// When Tux Paint is starting up and loading plugins, it asks us to

BIN
magic/icons/lightning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -0,0 +1,5 @@
Tux Paint "Magic" Tool: Fretwork
By Pere Pujal i Carabantes <pere@fornol.no-ip.org>
Draw an interlaced decorative design that looks like wooden fretwork.

View file

@ -0,0 +1,7 @@
Tux Paint "Magic" Tool: Halftone
By Bill Kendrick <bill@newbreedsoftware.com>
This makes parts of your picture look like newsprint. Different sizes of
cyan, magenta, yellow, and black "ink" will appear in place of your
picture.

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<body><html><head><title>Tux Paint "Magic" Tool: Fretwork</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#FF0000" alink="#FF00FF">
<h1 align="center">Tux Paint "Magic" Tool: Fretwork</h1>
<h2 align="center">By Pere Pujal i Carabantes &lt;<a href="mailto:pere@fornol.no-ip.org">pere@fornol.no-ip.org</a>&gt;</h2>
<p>Draw an interlaced decorative design that looks like wooden fretwork.</p>
</body></html>

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<body><html><head><title>Tux Paint "Magic" Tool: Halftone</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#FF0000" alink="#FF00FF">
<h1 align="center">Tux Paint "Magic" Tool: Halftone</h1>
<h2 align="center">By Bill Kendrick &lt;<a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a>&gt;</h2>
<p>This makes parts of your picture look like newsprint. Different sizes of cyan, magenta, yellow, and black "ink" will appear in place of your picture.</p>
</body></html>

View file

@ -26,11 +26,14 @@
<li><a href="flower.html">Flower</a></li>
<li><a href="foam.html">Foam</a></li>
<li><a href="fold.html">Fold</a></li>
<li><a href="fretwork.html">Fretwork</a></li>
<li><a href="glass_tile.html">Glass Tile</a></li>
<li><a href="grass.html">Grass</a></li>
<li><a href="halftone.html">Halftone</a></li>
<li><a href="kaleidoscope.html">Kaleidoscope</a></li>
<li><a href="light.html">Light</a></li>
<li><a href="lighten.html">Lighten</a></li>
<li><a href="lightning.html">Lightning</a></li>
<li><a href="metal_paint.html">Metal Paint</a></li>
<li><a href="mirror.html">Mirror</a></li>
<li><a href="mosaic.html">Mosaic</a></li>
@ -56,6 +59,7 @@
<li><a href="sharpen.html">Sharpen</a></li>
<li><a href="shift.html">Shift</a></li>
<li><a href="silhouette.html">Silhouette</a></li>
<li><a href="smooth_rainbow.html">Smooth Rainbow</a></li>
<li><a href="smudge.html">Smudge</a></li>
<li><a href="snow_ball.html">Snow Ball</a></li>
<li><a href="snow_flake.html">Snow Flake</a></li>

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<body><html><head><title>Tux Paint "Magic" Tool: Lightning</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#FF0000" alink="#FF00FF">
<h1 align="center">Tux Paint "Magic" Tool: Lightning</h1>
<h2 align="center">By Bill Kendrick &lt;<a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a>&gt;</h2>
<p>Draws a lightning bolt between two points on the picture.</p>
</body></html>

View file

@ -6,4 +6,5 @@
<h1 align="center">Tux Paint "Magic" Tool: Rainbow</h1>
<h2 align="center">By Bill Kendrick &lt;<a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a>&gt;</h2>
<p>This is similar to the paint brush, but as you move the mouse around, it cycles through a spectrum of bright colors.</p>
<p>See also: <a href="smooth_rainbow.html">Smooth Rainbow</a> </p>
</body></html>

View file

@ -0,0 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<body><html><head><title>Tux Paint "Magic" Tool: Smooth Rainbow</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#FF0000" alink="#FF00FF">
<h1 align="center">Tux Paint "Magic" Tool: Smooth Rainbow</h1>
<h2 align="center">By Bill Kendrick &lt;<a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a>&gt;</h2>
<p>This is similar to Rainbow magic tool &mdash; as you move the mouse around, it cycles through a spectrum of colors &mdash; except the colors blend smoothly as you draw.</p>
<p>See also: <a href="rainbow.html">Rainbow</a> </p>
</body></html>

View file

@ -22,11 +22,14 @@
* Flower
* Foam
* Fold
* Fretwork
* Glass Tile
* Grass
* Halftone
* Kaleidoscope
* Light
* Lighten
* Lightning
* Metal Paint
* Mirror
* Mosaic
@ -35,6 +38,7 @@
* Square Mosaic
* Negative
* Noise
* Opposite
* Panels
* Pattern
* Perspective
@ -51,6 +55,7 @@
* Sharpen
* Shift
* Silhouette
* Smooth Rainbow
* Smudge
* Snow Ball
* Snow Flake

View file

@ -0,0 +1,5 @@
Tux Paint "Magic" Tool: Lightning
By Bill Kendrick <bill@newbreedsoftware.com>
Draws a lightning bolt between two points on the picture.

View file

@ -3,4 +3,5 @@
By Bill Kendrick <bill@newbreedsoftware.com>
This inverts the colors wherever you drag the mouse. (e.g., white becomes
black, and vice versa.)
black, and vice versa.) It inverts the values of the Red, Green, and Blue
components of the pixels.

View file

@ -0,0 +1,8 @@
Tux Paint "Magic" Tool: Opposite
By Bill Kendrick <bill@newbreedsoftware.com>
This converts the colors wherever you drag the mouse into their
complementary (opposite) colors. (e.g., blue becomes orange, and vice
versa.) It changes the Hue compoment of the pixels, without affecting the
Saturation or Lightness.

View file

@ -4,3 +4,5 @@
This is similar to the paint brush, but as you move the mouse around, it
cycles through a spectrum of bright colors.
See also: Smooth Rainbow

View file

@ -0,0 +1,9 @@
Tux Paint "Magic" Tool: Smooth Rainbow
By Bill Kendrick <bill@newbreedsoftware.com>
This is similar to Rainbow magic tool — as you move the mouse around, it
cycles through a spectrum of colors — except the colors blend smoothly as
you draw.
See also: Rainbow

View file

@ -5,7 +5,7 @@ individual HTML files for each of them, and an index.html that links to
them all. */
/* Bill Kendrick <bill@newbreedsoftware.com> */
/* Oct. 8, 2009 - September 6, 2021 */
/* Oct. 8, 2009 - September 27, 2021 */
/* Authors of the Magic tools: */
@ -145,6 +145,10 @@ $tools = array(
'desc'=>'Click a corner of your picture and drag towards the center to fold it up like a piece of paper.',
'author'=>array($AUTHOR_ADAMR, $AUTHOR_KENDRICK, $AUTHOR_PERE)),
array('name'=>'Fretwork',
'desc'=>'Draw an interlaced decorative design that looks like wooden fretwork.',
'author'=>$AUTHOR_PERE),
array('name'=>'Glass Tile',
'desc'=>'Click and drag over your picture to make it look like it\'s being seen through glass tiles.',
'author'=>$AUTHOR_KENDRICK),
@ -154,6 +158,10 @@ $tools = array(
'author'=>$AUTHOR_ALBERT,
'see'=>'Flower'),
array('name'=>'Halftone',
'desc'=>'This makes parts of your picture look like newsprint. Different sizes of cyan, magenta, yellow, and black "ink" will appear in place of your picture.',
'author'=>$AUTHOR_KENDRICK),
array('name'=>'Kaleidoscope',
'desc'=>'This paint brush draws in four places at the same time, mirroring symmetrically, both horizontally and vertically. It uses the currently selected color.',
'author'=>$AUTHOR_KENDRICK,
@ -168,6 +176,10 @@ $tools = array(
'author'=>$AUTHOR_KENDRICK,
'see'=>array('Darken', 'Tint')),
array('name'=>'Lightning',
'desc'=>'Draws a lightning bolt between two points on the picture.',
'author'=>$AUTHOR_KENDRICK),
array('name'=>'Metal Paint',
'desc'=>'Click and drag to draw shiny metal using the current color.',
'author'=>$AUTHOR_KENDRICK),
@ -263,7 +275,8 @@ $tools = array(
array('name'=>'Rainbow',
'desc'=>'This is similar to the paint brush, but as you move the mouse around, it cycles through a spectrum of bright colors.',
'author'=>$AUTHOR_KENDRICK),
'author'=>$AUTHOR_KENDRICK,
'see'=>array('Smooth Rainbow')),
array('name'=>'Real Rainbow',
'desc'=>'Draw a transparent arc that looks like a real rainbow.',
@ -296,6 +309,11 @@ $tools = array(
'author'=>$AUTHOR_ANDREWC,
'see'=>array('Edges', 'Emboss')),
array('name'=>'Smooth Rainbow',
'desc'=>'This is similar to Rainbow magic tool &mdash; as you move the mouse around, it cycles through a spectrum of colors &mdash; except the colors blend smoothly as you draw.',
'author'=>$AUTHOR_KENDRICK,
'see'=>array('Rainbow')),
array('name'=>'Smudge',
'desc'=>'This pushes the colors around under the mouse, like finger painting with wet paint.',
'author'=>$AUTHOR_ALBERT,

BIN
magic/sounds/lightning.ogg Normal file

Binary file not shown.

View file

@ -6,7 +6,7 @@
Credits: Andrew Corcoran <akanewbie@gmail.com> inspired by the Alien Map GIMP plugin
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/
@ -25,7 +25,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: August 29, 2019
Last updated: September 20, 2021
$Id$
*/
@ -68,6 +68,10 @@ const char *alien_names[alien_NUM_TOOLS] = {
gettext_noop("Color Shift"),
};
const int alien_groups[alien_NUM_TOOLS] = {
MAGIC_TYPE_COLOR_FILTERS,
};
const char *alien_descs[alien_NUM_TOOLS][2] = {
{gettext_noop("Click and drag the mouse to change the colors in parts of your picture."),
gettext_noop("Click to change the colors in your entire picture."),},
@ -79,6 +83,7 @@ int alien_init(magic_api * api);
int alien_get_tool_count(magic_api * api);
SDL_Surface *alien_get_icon(magic_api * api, int which);
char *alien_get_name(magic_api * api, int which);
int alien_get_group(magic_api * api, int which);
char *alien_get_description(magic_api * api, int which, int mode);
void alien_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
@ -136,6 +141,11 @@ char *alien_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(alien_names[which])));
}
int alien_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
{
return alien_groups[which];
}
// Return our descriptions, localized:
char *alien_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{

View file

@ -58,6 +58,7 @@ int blind_init(magic_api * api);
int blind_get_tool_count(magic_api * api);
SDL_Surface *blind_get_icon(magic_api * api, int which);
char *blind_get_name(magic_api * api, int which);
int blind_get_group(magic_api * api, int which);
char *blind_get_description(magic_api * api, int which, int mode);
int blind_requires_colors(magic_api * api, int which);
void blind_release(magic_api * api, int which,
@ -115,6 +116,11 @@ char *blind_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE
return strdup(gettext_noop("Blind"));
}
int blind_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PICTURE_DECORATIONS;
}
char *blind_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return

View file

@ -4,7 +4,7 @@
Blocks, Chalk and Drip Magic Tools Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 20, 2021
$Id$
*/
@ -56,6 +56,7 @@ Uint32 blocks_chalk_drip_api_version(void);
int blocks_chalk_drip_get_tool_count(magic_api * api);
SDL_Surface *blocks_chalk_drip_get_icon(magic_api * api, int which);
char *blocks_chalk_drip_get_name(magic_api * api, int which);
int blocks_chalk_drip_get_group(magic_api * api, int which);
char *blocks_chalk_drip_get_description(magic_api * api, int which, int mode);
static void blocks_chalk_drip_linecb(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -135,6 +136,12 @@ char *blocks_chalk_drip_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (NULL);
}
// Return our group (all the same):
int blocks_chalk_drip_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
// Return our descriptions, localized:
char *blocks_chalk_drip_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{

View file

@ -6,7 +6,7 @@
Credits: Bill Kendrick<bill@newbreedsoftware.com> & Andrew Corcoran <akanewbie@gmail.com>
Copyright (c) 2002-2008 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/
@ -25,7 +25,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 20, 2021
$Id$
*/
@ -44,6 +44,7 @@ int blur_init(magic_api * api);
int blur_get_tool_count(magic_api * api);
SDL_Surface *blur_get_icon(magic_api * api, int which);
char *blur_get_name(magic_api * api, int which);
int blur_get_group(magic_api * api, int which);
char *blur_get_description(magic_api * api, int which, int mode);
void blur_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
@ -80,6 +81,10 @@ const char *blur_names[blur_NUM_TOOLS] = {
gettext_noop("Blur"),
};
const int blur_groups[blur_NUM_TOOLS] = {
MAGIC_TYPE_DISTORTS,
};
const char *blur_descs[blur_NUM_TOOLS][2] = {
{gettext_noop("Click and drag the mouse around to blur the image."),
gettext_noop("Click to blur the entire image.")},
@ -125,6 +130,12 @@ char *blur_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(blur_names[which])));
}
// Return our group
int blur_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
{
return blur_groups[which];
}
// Return our descriptions, localized:
char *blur_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{

View file

@ -6,7 +6,7 @@
Albert Cahalan <albert@users.sf.net>
Copyright (c) 2002-2008 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/
@ -25,7 +25,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 20, 2021
$Id$
*/
@ -60,6 +60,7 @@ Uint32 bricks_api_version(void);
int bricks_get_tool_count(magic_api * api);
SDL_Surface *bricks_get_icon(magic_api * api, int which);
char *bricks_get_name(magic_api * api, int which);
int bricks_get_group(magic_api * api, int which);
char *bricks_get_description(magic_api * api, int which, int mode);
void bricks_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
@ -120,6 +121,12 @@ char *bricks_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUS
return (strdup(gettext_noop("Bricks")));
}
// Return our group (both the same):
int bricks_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
// Return our descriptions, localized:
char *bricks_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{

View file

@ -4,7 +4,7 @@
Calligraphy Magic Tool Plugin
Tux Paint - A simple drawing program for children.
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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: August 29, 2019
Last updated: September 20, 2021
$Id$
*/
@ -57,6 +57,7 @@ Uint32 calligraphy_api_version(void);
int calligraphy_get_tool_count(magic_api * api);
SDL_Surface *calligraphy_get_icon(magic_api * api, int which);
char *calligraphy_get_name(magic_api * api, int which);
int calligraphy_get_group(magic_api * api, int which);
char *calligraphy_get_description(magic_api * api, int which, int mode);
void calligraphy_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
@ -124,6 +125,12 @@ char *calligraphy_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE
return (strdup(gettext_noop("Calligraphy")));
}
// Return our group
int calligraphy_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
// Return our description, localized:
char *calligraphy_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED)

View file

@ -4,7 +4,7 @@
Cartoon Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 21, 2021
$Id$
*/
@ -48,6 +48,7 @@ Uint32 cartoon_api_version(void);
int cartoon_get_tool_count(magic_api * api);
SDL_Surface *cartoon_get_icon(magic_api * api, int which);
char *cartoon_get_name(magic_api * api, int which);
int cartoon_get_group(magic_api * api, int which);
char *cartoon_get_description(magic_api * api, int which, int mode);
static void do_cartoon(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
void cartoon_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -103,6 +104,12 @@ char *cartoon_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNU
return (strdup(gettext_noop("Cartoon")));
}
// Return our groups
int cartoon_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_COLOR_FILTERS;
}
// Return our descriptions, localized:
char *cartoon_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{

View file

@ -42,6 +42,7 @@ int checkerboard_init(magic_api * api);
int checkerboard_get_tool_count(magic_api * api);
SDL_Surface *checkerboard_get_icon(magic_api * api, int which);
char *checkerboard_get_name(magic_api * api, int which);
int checkerboard_get_group(magic_api * api, int which);
char *checkerboard_get_description(magic_api * api, int which, int mode);
int checkerboard_requires_colors(magic_api * api, int which);
void checkerboard_release(magic_api * api, int which,
@ -99,6 +100,11 @@ char *checkerboard_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUT
return strdup(gettext_noop("Checkerboard"));
}
int checkerboard_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PICTURE_DECORATIONS;
}
char *checkerboard_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return
@ -124,7 +130,7 @@ void checkerboard_shutdown(magic_api * api ATTRIBUTE_UNUSED)
// Interactivity functions
void checkerboard_drag(magic_api * api, int which, SDL_Surface * canvas,
void checkerboard_drag(magic_api * api, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
SDL_Surface * snapshot,
int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED,
int x, int y, SDL_Rect * update_rect)
@ -219,7 +225,7 @@ void checkerboard_drag(magic_api * api, int which, SDL_Surface * canvas,
api->playsound(checkerboard_snd, 128, 255);
}
void checkerboard_click(magic_api * api, int which, int mode,
void checkerboard_click(magic_api * api, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas, SDL_Surface * last,
int x, int y,
SDL_Rect * update_rect)

View file

@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: February 20, 2021
Last updated: September 21, 2021
$Id$
*/
@ -70,6 +70,7 @@ Uint32 clone_api_version(void);
int clone_get_tool_count(magic_api * api);
SDL_Surface *clone_get_icon(magic_api * api, int which);
char *clone_get_name(magic_api * api, int which);
int clone_get_group(magic_api * api, int which);
char *clone_get_description(magic_api * api, int which, int mode);
void clone_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
@ -132,6 +133,12 @@ char *clone_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE
return (strdup(gettext_noop("Clone")));
}
// Return our groups:
int clone_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
// Return our descriptions, localized:
char *clone_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{

View file

@ -1,3 +1,5 @@
/* Last updated 2021-09-21 */
#include <time.h> //For time()
#include "tp_magic_api.h"
@ -27,6 +29,7 @@ int confetti_init(magic_api * api);
int confetti_get_tool_count(magic_api * api);
SDL_Surface *confetti_get_icon(magic_api * api, int which);
char *confetti_get_name(magic_api * api, int which);
int confetti_get_group(magic_api * api, int which);
char *confetti_get_description(magic_api * api, int which, int mode);
int confetti_requires_colors(magic_api * api, int which);
void confetti_release(magic_api * api, int which,
@ -87,6 +90,11 @@ char *confetti_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UN
return strdup(gettext_noop("Confetti"));
}
int confetti_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
char *confetti_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return strdup(gettext_noop("Click to throw confetti!"));

View file

@ -4,7 +4,7 @@
Distortion Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 21, 2021
$Id$
*/
@ -59,6 +59,7 @@ int distortion_init(magic_api * api);
int distortion_get_tool_count(magic_api * api);
SDL_Surface *distortion_get_icon(magic_api * api, int which);
char *distortion_get_name(magic_api * api, int which);
int distortion_get_group(magic_api * api, int which);
char *distortion_get_description(magic_api * api, int which, int mode);
int distortion_requires_colors(magic_api * api, int which);
void distortion_shutdown(magic_api * api);
@ -135,6 +136,14 @@ char *distortion_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_
}
// Report our "Magic" tool groups
int distortion_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
// Report our "Magic" tool descriptions
char *distortion_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,

View file

@ -4,7 +4,7 @@
Emboss Magic Tool Plugin
Tux Paint - A simple drawing program for children.
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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: August 29, 2019
Last updated: September 20, 2021
$Id$
*/
@ -43,6 +43,7 @@ int emboss_init(magic_api * api);
int emboss_get_tool_count(magic_api * api);
SDL_Surface *emboss_get_icon(magic_api * api, int which);
char *emboss_get_name(magic_api * api, int which);
int emboss_get_group(magic_api * api, int which);
char *emboss_get_description(magic_api * api, int which, int mode);
void emboss_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -101,23 +102,56 @@ char *emboss_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUS
return (strdup(gettext_noop("Emboss")));
}
// Return our groups:
int emboss_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
// Return our descriptions, localized:
char *emboss_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return (strdup(gettext_noop("Click and drag the mouse to emboss the picture.")));
}
// Do the effect:
static void do_emboss(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
{
// Do the effect (single pixel; used by do_emboss() (painted circle)
// and emboss_click() when in fullscreen mode):
static void emboss_pixel(void * ptr, SDL_Surface * last, int x, int y, SDL_Surface * canvas) {
magic_api *api = (magic_api *) ptr;
int xx, yy;
Uint8 r1, g1, b1, r2, g2, b2;
int r;
float h, s, v;
int avg1, avg2;
SDL_GetRGB(api->getpixel(last, x, y), last->format, &r1, &g1, &b1);
SDL_GetRGB(api->getpixel(last, x + 2, y + 2), last->format, &r2, &g2, &b2);
avg1 = (r1 + g1 + b1) / 3;
avg2 = (r2 + g2 + b2) / 3;
api->rgbtohsv(r1, g1, b1, &h, &s, &v);
r = 128 + (((avg1 - avg2) * 3) / 2);
if (r < 0)
r = 0;
if (r > 255)
r = 255;
v = (r / 255.0);
api->hsvtorgb(h, s, v, &r1, &g1, &b1);
api->putpixel(canvas, x, y, SDL_MapRGB(canvas->format, r1, g1, b1));
}
// Do the effect (a circle around a touch point):
static void do_emboss(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
{
magic_api *api = (magic_api *) ptr;
int xx, yy;
for (yy = -16; yy < 16; yy++)
{
for (xx = -16; xx < 16; xx++)
@ -126,25 +160,7 @@ static void do_emboss(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canva
{
if (!api->touched(x + xx, y + yy))
{
SDL_GetRGB(api->getpixel(last, x + xx, y + yy), last->format, &r1, &g1, &b1);
SDL_GetRGB(api->getpixel(last, x + xx + 2, y + yy + 2), last->format, &r2, &g2, &b2);
avg1 = (r1 + g1 + b1) / 3;
avg2 = (r2 + g2 + b2) / 3;
api->rgbtohsv(r1, g1, b1, &h, &s, &v);
r = 128 + (((avg1 - avg2) * 3) / 2);
if (r < 0)
r = 0;
if (r > 255)
r = 255;
v = (r / 255.0);
api->hsvtorgb(h, s, v, &r1, &g1, &b1);
api->putpixel(canvas, x + xx, y + yy, SDL_MapRGB(canvas->format, r1, g1, b1));
emboss_pixel(api, last, x + xx, y + yy, canvas);
}
}
}
@ -181,10 +197,23 @@ void emboss_drag(magic_api * api, int which, SDL_Surface * canvas,
}
// Affect the canvas on click:
void emboss_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
void emboss_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect)
{
emboss_drag(api, which, canvas, last, x, y, x, y, update_rect);
if (mode == MODE_PAINT) {
emboss_drag(api, which, canvas, last, x, y, x, y, update_rect);
} else {
for (y = 0; y < canvas->h; y++) {
for (x = 0; x < canvas->w; x++) {
emboss_pixel(api, last, x, y, canvas);
}
}
update_rect->x = 0;
update_rect->y = 0;
update_rect->w = canvas->w;
update_rect->h = canvas->h;
api->playsound(emboss_snd, 128, 255);
}
}
// Affect the canvas on release:
@ -225,5 +254,5 @@ void emboss_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUS
int emboss_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return (MODE_PAINT); /* FIXME - Can also be turned into a full-image effect */
return (MODE_PAINT | MODE_FULLSCREEN);
}

View file

@ -4,7 +4,7 @@
Fade and Darken Magic Tools Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 9, 2008
Last updated: September 20, 2021
$Id$
*/
@ -49,6 +49,7 @@ int fade_darken_init(magic_api * api);
Uint32 fade_darken_api_version(void);
int fade_darken_get_tool_count(magic_api * api);
SDL_Surface *fade_darken_get_icon(magic_api * api, int which);
int fade_darken_get_group(magic_api * api, int which);
char *fade_darken_get_name(magic_api * api, int which);
char *fade_darken_get_description(magic_api * api, int which, int mode);
static void do_fade_darken(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
@ -118,6 +119,12 @@ char *fade_darken_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (NULL);
}
// Return our group (all the same):
int fade_darken_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_COLOR_FILTERS;
}
// Return our description, localized:
char *fade_darken_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{

View file

@ -41,6 +41,7 @@ int fisheye_init(magic_api * api);
int fisheye_get_tool_count(magic_api * api);
SDL_Surface *fisheye_get_icon(magic_api * api, int which);
char *fisheye_get_name(magic_api * api, int which);
int fisheye_get_group(magic_api * api, int which);
char *fisheye_get_description(magic_api * api, int which, int mode);
int fisheye_requires_colors(magic_api * api, int which);
void fisheye_release(magic_api * api, int which,
@ -99,7 +100,12 @@ SDL_Surface *fisheye_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
char *fisheye_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return strdup(gettext_noop("Fisheye"));
} //Needs better name
}
int fisheye_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
char *fisheye_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{

View file

@ -4,7 +4,7 @@
Flower Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,13 +23,14 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: April 26, 2011
Last updated: September 21, 2021
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "tp_magic_api.h"
#include "SDL_image.h"
#include "SDL_mixer.h"
@ -69,6 +70,7 @@ int flower_init(magic_api * api);
int flower_get_tool_count(magic_api * api);
SDL_Surface *flower_get_icon(magic_api * api, int which);
char *flower_get_name(magic_api * api, int which);
int flower_get_group(magic_api * api, int which);
char *flower_get_description(magic_api * api, int which, int mode);
static void flower_predrag(magic_api * api, SDL_Surface * canvas, SDL_Surface * last, int ox, int oy, int x, int y);
void flower_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -144,6 +146,12 @@ char *flower_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUS
return (strdup(gettext_noop("Flower")));
}
// Return our groups:
int flower_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_ARTISTIC;
}
// Return our descriptions, localized:
char *flower_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
@ -381,7 +389,7 @@ static void flower_drawstalk(magic_api * api ATTRIBUTE_UNUSED, SDL_Surface * can
else
side = LEAFSIDE_RIGHT_UP;
}
else if (abs(curve[i - 2].x - curve[i + 2].x) < 5)
else if (fabs(curve[i - 2].x - curve[i + 2].x) < 5)
{
/* Mostly up; stick left- or right-downward: */

View file

@ -4,7 +4,7 @@
Foam Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 21, 2021
$Id$
*/
@ -53,6 +53,7 @@ void foam_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
SDL_Surface *foam_get_icon(magic_api * api, int which);
char *foam_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED);
int foam_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED);
void foam_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
void foam_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
void foam_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
@ -114,6 +115,12 @@ char *foam_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED
return (strdup(gettext_noop("Foam")));
}
// Return our groups
int foam_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
// Return our descriptions, localized:
char *foam_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{

View file

@ -1,7 +1,7 @@
/*
* Folds the picture down from the corners.
*
* Last updated: 2019-08-29
* Last updated: 2021-09-20
*/
//optimized version soon :)
@ -47,6 +47,7 @@ int fold_init(magic_api * api);
int fold_get_tool_count(magic_api * api);
SDL_Surface *fold_get_icon(magic_api * api, int which);
char *fold_get_name(magic_api * api, int which);
int fold_get_group(magic_api * api, int which);
char *fold_get_description(magic_api * api, int which, int mode);
int fold_requires_colors(magic_api * api, int which);
void fold_release(magic_api * api, int which,
@ -107,6 +108,11 @@ char *fold_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED
return (gettext_noop("Fold"));
}
int fold_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PICTURE_WARPS;
}
char *fold_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return strdup(gettext_noop("Choose a background color and click to turn the corner of the page over."));

View file

@ -1,7 +1,7 @@
/*
* Draws fretwork
*
* Last updated: 2019-08-29
* Last updated: 2021-09-20
*/
#include "tp_magic_api.h"
@ -62,6 +62,7 @@ int fretwork_init(magic_api * api);
int fretwork_get_tool_count(magic_api * api);
SDL_Surface *fretwork_get_icon(magic_api * api, int which);
char *fretwork_get_name(magic_api * api, int which);
int fretwork_get_group(magic_api * api, int which);
char *fretwork_get_description(magic_api * api, int which, int mode);
int fretwork_requires_colors(magic_api * api, int which);
void fretwork_release(magic_api * api, int which,
@ -175,6 +176,11 @@ SDL_Surface *fretwork_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
return (IMG_Load(fname));
}
int fretwork_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
char *fretwork_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return strdup(gettext_noop("Fretwork"));
@ -183,7 +189,7 @@ char *fretwork_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UN
char *fretwork_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
{
if (mode == MODE_PAINT)
return strdup(gettext_noop("Click and drag to draw repetitive patterns. "));
return strdup(gettext_noop("Click and drag to draw repetitive patterns."));
else
return strdup(gettext_noop("Click to surround your picture with repetitive patterns."));
}

View file

@ -4,7 +4,7 @@
Glass Tile Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 9, 2008
Last updated: September 21, 2021
$Id$
*/
@ -44,6 +44,7 @@ int glasstile_init(magic_api * api);
int glasstile_get_tool_count(magic_api * api);
SDL_Surface *glasstile_get_icon(magic_api * api, int which);
char *glasstile_get_name(magic_api * api, int which);
int glasstile_get_group(magic_api * api, int which);
char *glasstile_get_description(magic_api * api, int which, int mode);
static void do_glasstile(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
void glasstile_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -104,6 +105,12 @@ char *glasstile_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_U
return (strdup(gettext_noop("Glass Tile")));
}
// Return our groups
int glasstile_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
// Return our descriptions, localized:
char *glasstile_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
{

View file

@ -5,7 +5,7 @@
Tux Paint - A simple drawing program for children.
by Albert Cahalan <albert@users.sf.net>
Copyright (c) 2002-2008 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/
@ -24,7 +24,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 21, 2021
$Id$
*/
@ -47,6 +47,7 @@ Uint32 grass_api_version(void);
int grass_get_tool_count(magic_api * api);
SDL_Surface *grass_get_icon(magic_api * api, int which);
char *grass_get_name(magic_api * api, int which);
int grass_get_group(magic_api * api, int which);
char *grass_get_description(magic_api * api, int which, int mode);
void grass_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
@ -107,6 +108,12 @@ char *grass_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE
return (strdup(gettext_noop("Grass")));
}
// Return our groups:
int grass_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
// Return our descriptions, localized:
char *grass_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{

View file

@ -1,6 +1,6 @@
/* halftone.c
Last modified: 2021.09.04
Last modified: 2021.09.21
*/
@ -41,6 +41,10 @@ const char *names[NUM_TOOLS] = {
gettext_noop("Halftone"),
};
const int groups[NUM_TOOLS] = {
MAGIC_TYPE_DISTORTS,
};
const char *descs[NUM_TOOLS] = {
gettext_noop("Click and drag to turn your drawing into a newspaper."),
};
@ -59,6 +63,7 @@ int halftone_init(magic_api * api);
int halftone_get_tool_count(magic_api * api);
SDL_Surface *halftone_get_icon(magic_api * api, int which);
char *halftone_get_name(magic_api * api, int which);
int halftone_get_group(magic_api * api, int which);
char *halftone_get_description(magic_api * api, int which, int mode);
int halftone_requires_colors(magic_api * api, int which);
int halftone_modes(magic_api * api, int which);
@ -121,6 +126,11 @@ char *halftone_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(our_name_localized));
}
int halftone_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
{
return groups[which];
}
char *halftone_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{
const char *our_desc_english;

View file

@ -4,7 +4,7 @@
Kaleidoscope Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 21, 2021
$Id$
*/
@ -65,6 +65,7 @@ int kalidescope_init(magic_api * api);
int kalidescope_get_tool_count(magic_api * api);
SDL_Surface *kalidescope_get_icon(magic_api * api, int which);
char *kalidescope_get_name(magic_api * api, int which);
int kalidescope_get_group(magic_api * api, int which);
char *kalidescope_get_description(magic_api * api, int which, int mode);
static void do_kalidescope(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
void kalidescope_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -136,6 +137,13 @@ char *kalidescope_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
}
}
// Return our group (all the same):
int kalidescope_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PATTERN_PAINTING;
}
// Return our descriptions, localized:
char *kalidescope_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{

View file

@ -4,7 +4,7 @@
Light Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 21, 2021
$Id$
*/
@ -45,6 +45,7 @@ int light_init(magic_api * api);
int light_get_tool_count(magic_api * api);
SDL_Surface *light_get_icon(magic_api * api, int which);
char *light_get_name(magic_api * api, int which);
int light_get_group(magic_api * api, int which);
char *light_get_description(magic_api * api, int which, int mode);
static void do_light(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
void light_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -103,6 +104,12 @@ char *light_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE
return (strdup(gettext_noop("Light")));
}
// Return our groups:
int light_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
// Return our descriptions, localized:
char *light_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{

278
magic/src/lightning.c Normal file
View file

@ -0,0 +1,278 @@
/* lightning.c
Draws a lightning strike between the click
and drag+release positions.
Last modified: 2021.09.27
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
#include <math.h>
#include "tp_magic_api.h"
#include "SDL_image.h"
#include "SDL_mixer.h"
Mix_Chunk *snd_effect;
float lightning_h, lightning_s, lightning_v;
int sx, sy;
void lightning_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect);
void lightning_line_callback_drag(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
void lightning_draw_bolt(void * ptr, SDL_Surface * canvas, SDL_Surface * snapshot, float sx, float sy, float angle, float len, int thickness);
Uint32 lightning_api_version(void)
{
return (TP_MAGIC_API_VERSION);
}
int lightning_init(magic_api * api)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%s/sounds/magic/lightning.ogg", api->data_directory);
snd_effect = Mix_LoadWAV(fname);
return (1);
}
int lightning_get_tool_count(magic_api * api)
{
return (1);
}
SDL_Surface *lightning_get_icon(magic_api * api, int which)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%s/images/magic/lightning.png", api->data_directory);
return (IMG_Load(fname));
}
char *lightning_get_name(magic_api * api, int which)
{
return strdup(gettext("Lightning"));
}
int lightning_get_group(magic_api * api, int which)
{
return MAGIC_TYPE_ARTISTIC;
}
char *lightning_get_description(magic_api * api, int which, int mode)
{
return strdup(gettext("Click, drag, and release to a lightning bolt between two points."));
}
int lightning_requires_colors(magic_api * api, int which)
{
return 1;
}
int lightning_modes(magic_api * api, int which)
{
return MODE_PAINT;
}
void lightning_shutdown(magic_api * api)
{
if (snd_effect != NULL)
Mix_FreeChunk(snd_effect);
}
void
lightning_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
{
sx = x;
sy = y;
lightning_drag(api, which, canvas, snapshot, x, y, x, y, update_rect);
}
void
lightning_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect)
{
/* FIXME: This could be made more efficient
(only blit and update between (sx,sy) and (x,y), though
it should also cover the area extending to (ox,oy),
to avoid leaving trails */
update_rect->x = 0;
update_rect->y = 0;
update_rect->w = canvas->w;
update_rect->h = canvas->h;
SDL_BlitSurface(snapshot, update_rect, canvas, update_rect);
api->line((void *)api, which, canvas, snapshot, sx, sy, x, y, 1, lightning_line_callback_drag);
}
void
lightning_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
{
float a, b, len, angle;
int thickness;
/* FIXME: This could be made more efficient
(only blit and update between (sx,sy) and (x,y), though
it should also cover the area extending to (ox,oy),
to avoid leaving trails */
update_rect->x = 0;
update_rect->y = 0;
update_rect->w = canvas->w;
update_rect->h = canvas->h;
SDL_BlitSurface(snapshot, update_rect, canvas, update_rect);
api->stopsound();
api->playsound(snd_effect, (x * 255) / canvas->w, 255);
a = (x - sx);
b = (y - sy);
len = sqrt((a * a) + (b * b));
if (len < 100)
len = 100;
angle = acos((x - sx) / len) * 180.0 / M_PI;
if (y < sy)
angle = -angle;
#ifdef DEBUG
printf("(%d,%d)->(%d,%d) => a = %.2f, b = %.2f, c (len) = %.2f; angle = %.2f degrees\n",
sx, sy, x, y, a, b, len, angle);
fflush(stdout);
#endif
thickness = len / 50;
if (thickness < 4)
thickness = 4;
lightning_draw_bolt((void *) api, canvas, snapshot, (float) sx, (float) sy, angle, len, thickness);
}
void lightning_draw_bolt(void * ptr, SDL_Surface * canvas, SDL_Surface * snapshot, float sx, float sy, float angle, float len, int thickness)
{
magic_api *api = (magic_api *) ptr;
float i;
float x, y, orig_angle, pct;
int xx, yy, t;
Uint8 r, g, b, or, og, ob;
float h, s, v, new_h, new_s, new_v;
float adj;
x = sx;
y = sy;
orig_angle = angle;
t = thickness / 3;
if (t < 1)
t = 1;
for (i = 0; i < len; i++)
{
x = x + cos(angle * M_PI / 180.0);
y = y + sin(angle * M_PI / 180.0);
angle = angle + ((float) (rand() % 15) - 7.5);
if (angle < orig_angle - 10.0)
angle = orig_angle - 10.0;
else if (angle > orig_angle + 10.0)
angle = orig_angle + 10.0;
for (yy = -t; yy <= t; yy++)
{
for (xx = -t; xx <= t; xx++)
{
if (api->in_circle(xx, yy, t))
{
float light_h, light_s, light_v;
light_h = lightning_h;
light_s = lightning_s;
light_v = lightning_v;
SDL_GetRGB(api->getpixel(canvas, x + xx, y + yy), canvas->format, &r, &g, &b);
api->rgbtohsv(r, g, b, &h, &s, &v);
adj = 1.0 - (sqrt((xx * xx) + (yy * yy)) / t);
new_v = v + adj;
if (new_v > 1.0)
{
light_s = light_s / (new_v * 2);
new_v = 1.0;
}
if (light_h == -1)
{
new_h = h;
new_s = (s * 25) / 100;
}
else
{
new_h = ((light_h * 75) + (h * 25)) / 100;
new_s = ((light_s * 75) + (s * 25)) / 100;
}
api->hsvtorgb(new_h, new_s, new_v, &r, &g, &b);
api->putpixel(canvas, x + xx, y + yy, SDL_MapRGB(canvas->format, r, g, b));
}
}
}
if (((rand() % 50) == 0 || (int) i == (int) (len / 2)) && thickness > 1 && len >= 4)
{
float new_angle;
if ((rand() % 10) == 0)
{
new_angle = angle + ((float) (rand() % 180) - 90.0);
}
else
{
new_angle = angle + ((float) (rand() % 90) - 45.0);
}
lightning_draw_bolt((void *) api, canvas, snapshot, x, y,
new_angle,
((len / 8) + (rand() % (int) (len / 4))),
thickness - 1
);
}
}
}
void lightning_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
{
api->rgbtohsv(r, g, b, &lightning_h, &lightning_s, &lightning_v);
}
void lightning_line_callback_drag(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y)
{
magic_api *api = (magic_api *) ptr;
api->xorpixel(canvas, x, y);
}
void lightning_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
{
}
void lightning_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
{
}

View file

@ -4,7 +4,7 @@
Metal Paint Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 21, 2021
$Id$
*/
@ -43,6 +43,7 @@ int metalpaint_init(magic_api * api);
int metalpaint_get_tool_count(magic_api * api);
SDL_Surface *metalpaint_get_icon(magic_api * api, int which);
char *metalpaint_get_name(magic_api * api, int which);
int metalpaint_get_group(magic_api * api, int which);
char *metalpaint_get_description(magic_api * api, int which, int mode);
static void do_metalpaint(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -98,6 +99,12 @@ char *metalpaint_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_
return (strdup(gettext_noop("Metal Paint")));
}
// Return our groups:
int metalpaint_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
// Return our descriptions, localized:
char *metalpaint_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED)

View file

@ -4,7 +4,7 @@
Mirror and Flip Magic Tools Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 20, 2021
$Id$
*/
@ -50,6 +50,7 @@ Uint32 mirror_flip_api_version(void);
int mirror_flip_get_tool_count(magic_api *);
SDL_Surface *mirror_flip_get_icon(magic_api *, int);
char *mirror_flip_get_name(magic_api *, int);
int mirror_flip_get_group(magic_api *, int);
char *mirror_flip_get_description(magic_api *, int, int);
void mirror_flip_drag(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int, SDL_Rect *);
void mirror_flip_release(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int, SDL_Rect *);
@ -114,6 +115,12 @@ char *mirror_flip_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (NULL);
}
// Return our group (the same):
int mirror_flip_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PICTURE_WARPS;
}
// Return our descriptions, localized:
char *mirror_flip_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{

View file

@ -7,7 +7,7 @@
Credits: Andrew Corcoran <akanewbie@gmail.com>
Copyright (c) 2002-2009 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/
@ -26,7 +26,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: May 6, 2009
Last updated: September 21, 2021
$Id$
*/
@ -56,6 +56,7 @@ int mosaic_init(magic_api *);
int mosaic_get_tool_count(magic_api *);
SDL_Surface *mosaic_get_icon(magic_api *, int);
char *mosaic_get_name(magic_api *, int);
int mosaic_get_group(magic_api *, int);
char *mosaic_get_description(magic_api *, int, int);
void mosaic_paint(void *, int, SDL_Surface *, SDL_Surface *, int, int);
void mosaic_drag(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int, SDL_Rect *);
@ -96,6 +97,10 @@ const char *mosaic_names[mosaic_NUM_TOOLS] = {
gettext_noop("Mosaic"),
};
const int mosaic_groups[mosaic_NUM_TOOLS] = {
MAGIC_TYPE_DISTORTS,
};
const char *mosaic_descs[mosaic_NUM_TOOLS][2] = {
{gettext_noop("Click and drag the mouse to add a mosaic effect to parts of your picture."),
gettext_noop("Click to add a mosaic effect to your entire picture."),},
@ -142,6 +147,12 @@ char *mosaic_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(mosaic_names[which])));
}
// Return our groups:
int mosaic_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
{
return mosaic_groups[which];
}
// Return our descriptions, localized:
char *mosaic_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{

View file

@ -11,7 +11,7 @@
* Pere Pujal for joining all toghether
* Caroline Ford for the text descriptions
Copyright (c) 2002-2009 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/
@ -30,7 +30,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: May 6, 2009
Last updated: September 21, 2021
$Id$
*/
@ -63,6 +63,7 @@ int mosaic_shaped_init(magic_api * api);
int mosaic_shaped_get_tool_count(magic_api * api);
SDL_Surface *mosaic_shaped_get_icon(magic_api * api, int which);
char *mosaic_shaped_get_name(magic_api * api, int which);
int mosaic_shaped_get_group(magic_api * api, int which);
char *mosaic_shaped_get_description(magic_api * api, int which, int mode);
@ -194,6 +195,12 @@ char *mosaic_shaped_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(mosaic_shaped_names[which])));
}
// Return our groups (all the same!)
int mosaic_shaped_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
// Return our descriptions, localized:
char *mosaic_shaped_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{

View file

@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: September 6, 2021
Last updated: September 21, 2021
$Id$
*/
@ -40,6 +40,7 @@ Uint32 negative_api_version(void);
int negative_get_tool_count(magic_api * api);
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);
void negative_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -121,6 +122,12 @@ char *negative_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(negative_names[which])));
}
// Return our group (both the same):
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)
{

View file

@ -6,7 +6,7 @@
Credits: Andrew Corcoran <akanewbie@gmail.com>
Copyright (c) 2002-2007 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/
@ -25,7 +25,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: June 6, 2008
Last updated: September 21, 2021
$Id$
*/
@ -66,6 +66,10 @@ const char *noise_names[noise_NUM_TOOLS] = {
gettext_noop("Noise"),
};
const int noise_groups[noise_NUM_TOOLS] = {
MAGIC_TYPE_DISTORTS,
};
const char *noise_descs[noise_NUM_TOOLS][2] = {
{gettext_noop("Click and drag the mouse to add noise to parts of your picture."),
gettext_noop("Click to add noise to your entire picture."),},
@ -75,6 +79,7 @@ Uint32 noise_api_version(void);
int noise_init(magic_api * api);
SDL_Surface *noise_get_icon(magic_api * api, int which);
char *noise_get_name(magic_api * api, int which);
int noise_get_group(magic_api * api, int which);
char *noise_get_description(magic_api * api, int which, int mode);
static void do_noise_pixel(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
static void do_noise_full(void *ptr, SDL_Surface * canvas, SDL_Surface * last, int which);
@ -134,6 +139,12 @@ char *noise_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(noise_names[which])));
}
// Return our groups
int noise_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
{
return noise_groups[which];
}
// Return our descriptions, localized:
char *noise_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{

View file

@ -27,7 +27,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: September 4, 2021
Last updated: September 20, 2021
$Id$
*/
@ -54,6 +54,7 @@ int perspective_init(magic_api * api);
int perspective_get_tool_count(magic_api * api);
SDL_Surface *perspective_get_icon(magic_api * api, int which);
char *perspective_get_name(magic_api * api, int which);
int perspective_get_group(magic_api * api, int which);
char *perspective_get_description(magic_api * api, int which, int mode);
@ -199,6 +200,12 @@ char *perspective_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(perspective_names[which])));
}
// Return our group (the same):
int perspective_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PICTURE_WARPS;
}
// Return our descriptions, localized:
char *perspective_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{

View file

@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: January 6, 2021
Last updated: September 21, 2021
$Id$
*/
@ -55,6 +55,7 @@ Uint32 pixels_api_version(void);
int pixels_get_tool_count(magic_api * api);
SDL_Surface *pixels_get_icon(magic_api * api, int which);
char *pixels_get_name(magic_api * api, int which);
int pixels_get_group(magic_api * api, int which);
char *pixels_get_description(magic_api * api, int which, int mode);
void pixels_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
@ -103,11 +104,15 @@ SDL_Surface *pixels_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
// Return our names, localized:
char *pixels_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
/* Both are named "Pixels", at the moment: */
return (strdup(gettext_noop("Pixels")));
}
// Return our group (both the same):
int pixels_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
// Return our descriptions, localized:
char *pixels_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{

View file

@ -6,7 +6,7 @@
Author: Adam 'foo-script' Rakowski ; foo-script@o2.pl
Copyright (c) 2002-2009 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/
@ -24,6 +24,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: September 21, 2021
*/
@ -52,6 +54,7 @@ int puzzle_init(magic_api * api);
int puzzle_get_tool_count(magic_api * api);
SDL_Surface *puzzle_get_icon(magic_api * api, int which);
char *puzzle_get_name(magic_api * api, int which);
int puzzle_get_group(magic_api * api, int which);
char *puzzle_get_description(magic_api * api, int which, int mode);
void puzzle_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
@ -103,6 +106,11 @@ char *puzzle_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUS
return (strdup(gettext_noop("Puzzle")));
}
int puzzle_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
char *puzzle_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
{

View file

@ -1,3 +1,4 @@
/* Last modified: 2021-09-21 */
#include "tp_magic_api.h"
#include "SDL_image.h"
#include "SDL_mixer.h"
@ -48,6 +49,7 @@ int rails_init(magic_api * api);
int rails_get_tool_count(magic_api * api);
SDL_Surface *rails_get_icon(magic_api * api, int which);
char *rails_get_name(magic_api * api, int which);
int rails_get_group(magic_api * api, int which);
char *rails_get_description(magic_api * api, int which, int mode);
int rails_requires_colors(magic_api * api, int which);
void rails_release(magic_api * api, int which,
@ -133,6 +135,11 @@ char *rails_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE
return strdup(gettext_noop("Rails"));
}
int rails_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
char *rails_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return strdup(gettext_noop("Click and drag to draw train track rails on your picture."));

View file

@ -6,7 +6,7 @@
Credits: Andrew Corcoran <akanewbie@gmail.com>
Copyright (c) 2002-2007 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/
@ -25,7 +25,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: October 4, 2008
Last updated: September 21, 2021
$Id$
*/
@ -68,6 +68,10 @@ const char *rain_names[rain_NUM_TOOLS] = {
gettext_noop("Rain"),
};
const int rain_groups[rain_NUM_TOOLS] = {
MAGIC_TYPE_PAINTING,
};
const char *rain_descs[rain_NUM_TOOLS][2] = {
{gettext_noop("Click to place a rain drop onto your picture."),
gettext_noop("Click to cover your picture with rain drops."),},
@ -78,6 +82,7 @@ int rain_init(magic_api * api);
int rain_get_tool_count(magic_api * api);
SDL_Surface *rain_get_icon(magic_api * api, int which);
char *rain_get_name(magic_api * api, int which);
int rain_get_group(magic_api * api, int which);
char *rain_get_description(magic_api * api, int which, int mode);
static void do_rain_drop(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
static void rain_linecb(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
@ -145,6 +150,12 @@ char *rain_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(rain_names[which])));
}
// Return our groups
int rain_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
{
return rain_groups[which];
}
// Return our descriptions, localized:
char *rain_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{

View file

@ -4,7 +4,7 @@
Rainbow Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 22, 2021
$Id$
*/
@ -63,7 +63,9 @@ static const int rainbow_hexes[NUM_RAINBOW_COLORS][3] = {
{255, 0, 64}
};
static int rainbow_color;
#define MIX_MAX 32
static int rainbow_color, rainbow_mix;
static Uint32 rainbow_rgb;
static Mix_Chunk *rainbow_snd;
@ -72,6 +74,7 @@ Uint32 rainbow_api_version(void);
int rainbow_get_tool_count(magic_api * api);
SDL_Surface *rainbow_get_icon(magic_api * api, int which);
char *rainbow_get_name(magic_api * api, int which);
int rainbow_get_group(magic_api * api, int which);
char *rainbow_get_description(magic_api * api, int which, int mode);
static void rainbow_linecb(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
@ -104,6 +107,7 @@ int rainbow_init(magic_api * api)
rainbow_color = 0;
rainbow_mix = 0;
snprintf(fname, sizeof(fname), "%ssounds/magic/rainbow.wav", api->data_directory);
rainbow_snd = Mix_LoadWAV(fname);
@ -114,7 +118,7 @@ int rainbow_init(magic_api * api)
// We have multiple tools:
int rainbow_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
{
return (1);
return (2);
}
// Load our icons:
@ -130,7 +134,17 @@ SDL_Surface *rainbow_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
// Return our names, localized:
char *rainbow_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return (strdup(gettext_noop("Rainbow")));
if (which == 0) {
return (strdup(gettext_noop("Rainbow")));
} else {
return (strdup(gettext_noop("Smooth Rainbow")));
}
}
// Return our group:
int rainbow_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PAINTING;
}
// Return our descriptions, localized:
@ -163,10 +177,33 @@ static void rainbow_linecb(void *ptr, int which ATTRIBUTE_UNUSED,
void rainbow_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect)
{
rainbow_color = (rainbow_color + 1) % NUM_RAINBOW_COLORS;
Uint8 r1, g1, b1, r2, g2, b2;
int rc_tmp;
if (which == 1) {
rainbow_mix += 1;
if (rainbow_mix > MIX_MAX) {
rainbow_mix = 0;
rainbow_color = (rainbow_color + 1) % NUM_RAINBOW_COLORS;
}
} else {
rainbow_mix = 0;
rainbow_color = (rainbow_color + 1) % NUM_RAINBOW_COLORS;
}
r1 = rainbow_hexes[rainbow_color][0];
g1 = rainbow_hexes[rainbow_color][1];
b1 = rainbow_hexes[rainbow_color][2];
rc_tmp = (rainbow_color + 1) % NUM_RAINBOW_COLORS;
r2 = rainbow_hexes[rc_tmp][0];
g2 = rainbow_hexes[rc_tmp][1];
b2 = rainbow_hexes[rc_tmp][2];
rainbow_rgb = SDL_MapRGB(canvas->format,
rainbow_hexes[rainbow_color][0],
rainbow_hexes[rainbow_color][1], rainbow_hexes[rainbow_color][2]);
((r1 * (MIX_MAX - rainbow_mix)) + (r2 * rainbow_mix)) / MIX_MAX,
((g1 * (MIX_MAX - rainbow_mix)) + (g2 * rainbow_mix)) / MIX_MAX,
((b1 * (MIX_MAX - rainbow_mix)) + (b2 * rainbow_mix)) / MIX_MAX);
api->line((void *)api, which, canvas, last, ox, oy, x, y, 1, rainbow_linecb);

View file

@ -6,7 +6,7 @@
by Bill Kendrick <bill@newbreedsoftware.com>
Math assistance by Jeff Newmiller <jdnewmil@dcn.davis.ca.us>
2009.04.02 - 2014.08.14
2009.04.02 - 2021.09.20
FIXME:
* Color/alpha art needs improvement.
@ -35,6 +35,7 @@ int realrainbow_init(magic_api * api);
int realrainbow_get_tool_count(magic_api * api);
SDL_Surface *realrainbow_get_icon(magic_api * api, int which);
char *realrainbow_get_name(magic_api * api, int which);
int realrainbow_get_group(magic_api * api, int which);
char *realrainbow_get_description(magic_api * api, int which, int mode);
int realrainbow_modes(magic_api * api, int which);
int realrainbow_requires_colors(magic_api * api, int which);
@ -100,6 +101,11 @@ char *realrainbow_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop("ROYGBIV Rainbow")));
}
int realrainbow_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_ARTISTIC;
}
char *realrainbow_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED)
{

View file

@ -4,7 +4,7 @@
Ripples Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 21, 2021
$Id$
*/
@ -46,6 +46,7 @@ int ripples_init(magic_api * api);
int ripples_get_tool_count(magic_api * api);
SDL_Surface *ripples_get_icon(magic_api * api, int which);
char *ripples_get_name(magic_api * api, int which);
int ripples_get_group(magic_api * api, int which);
char *ripples_get_description(magic_api * api, int which, int mode);
void ripples_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
@ -102,6 +103,12 @@ char *ripples_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNU
return (strdup(gettext_noop("Ripples")));
}
// Return our groups:
int ripples_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
// Return our descriptions, localized:
char *ripples_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{

View file

@ -6,7 +6,7 @@
Credits: Adam 'foo-script' Rakowski <foo-script@o2.pl>
Copyright (c) 2002-2008 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/
@ -24,6 +24,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: September 21, 2021
*/
// sound only plays on release
@ -54,6 +56,7 @@ int rosette_init(magic_api * api);
int rosette_get_tool_count(magic_api * api);
SDL_Surface *rosette_get_icon(magic_api * api, int which);
char *rosette_get_name(magic_api * api, int which);
int rosette_get_group(magic_api * api, int which);
char *rosette_get_description(magic_api * api, int which, int mode);
int rosette_requires_colors(magic_api * api, int which);
void rosette_release(magic_api * api, int which,
@ -117,6 +120,11 @@ char *rosette_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return strdup(gettext_noop("Picasso"));
}
int rosette_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PATTERN_PAINTING;
}
char *rosette_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{
if (!which)

View file

@ -92,6 +92,7 @@ int sharpen_init(magic_api * api);
int sharpen_get_tool_count(magic_api * api);
SDL_Surface *sharpen_get_icon(magic_api * api, int which);
char *sharpen_get_name(magic_api * api, int which);
int sharpen_get_group(magic_api * api, int which);
char *sharpen_get_description(magic_api * api, int which, int mode);
static int sharpen_grey(Uint8 r1, Uint8 g1, Uint8 b1);
static void do_sharpen_pixel(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
@ -155,6 +156,12 @@ char *sharpen_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(sharpen_names[which])));
}
// Return our group (all the same):
int sharpen_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
// Return our descriptions, localized:
char *sharpen_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{

View file

@ -4,7 +4,7 @@
Shift Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: July 8, 2008
Last updated: September 20, 2021
$Id$
*/
@ -50,6 +50,7 @@ int shift_init(magic_api * api);
int shift_get_tool_count(magic_api * api);
SDL_Surface *shift_get_icon(magic_api * api, int which);
char *shift_get_name(magic_api * api, int which);
int shift_get_group(magic_api * api, int which);
char *shift_get_description(magic_api * api, int which, int mode);
void shift_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
@ -106,6 +107,12 @@ char *shift_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE
return (strdup(gettext_noop("Shift")));
}
// Return our group
int shift_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PICTURE_WARPS;
}
// Return our descriptions, localized:
char *shift_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{

View file

@ -7,7 +7,7 @@
Smudge by Albert Cahalan <albert@users.sf.net>
Wet Paint addition by Bill Kendrick <bill@newbreedsoftware.com>
Copyright (c) 2002-2011
Copyright (c) 2002-2021
http://www.tuxpaint.org/
This program is free software; you can redistribute it and/or modify
@ -25,7 +25,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: Oconter 8, 2009
Last updated: September 21, 2021
$Id$
*/
@ -44,6 +44,7 @@ int smudge_init(magic_api * api);
Uint32 smudge_api_version(void);
SDL_Surface *smudge_get_icon(magic_api * api, int which);
char *smudge_get_name(magic_api * api, int which);
int smudge_get_group(magic_api * api, int which);
char *smudge_get_description(magic_api * api, int which, int mode);
static void do_smudge(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
void smudge_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -104,6 +105,15 @@ char *smudge_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop("Wet Paint")));
}
// Return our groups
int smudge_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
{
if (which == 0)
return MAGIC_TYPE_DISTORTS; /* Smudge */
else
return MAGIC_TYPE_PAINTING; /* Wet Paint */
}
// Return our descriptions, localized:
char *smudge_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{

View file

@ -6,7 +6,7 @@
Credits: Andrew Corcoran <akanewbie@gmail.com>
Copyright (c) 2002-2007 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/
@ -25,7 +25,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: June 6, 2008
Last updated: September 20, 2021
$Id$
*/
@ -82,6 +82,7 @@ int snow_init(magic_api * api);
int snow_get_tool_count(magic_api * api);
SDL_Surface *snow_get_icon(magic_api * api, int which);
char *snow_get_name(magic_api * api, int which);
int snow_get_group(magic_api * api, int which);
char *snow_get_description(magic_api * api, int which);
static void do_snow(void *ptr, SDL_Surface * canvas, SDL_Surface * last, int which, int snowAmount);
void snow_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -157,6 +158,11 @@ char *snow_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(snow_names[which])));
}
int snow_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PICTURE_DECORATIONS; /* Because we affect the whole image, and not just around the mouse */
}
// Return our descriptions, localized:
char *snow_get_description(magic_api * api ATTRIBUTE_UNUSED, int which)
{

View file

@ -1,7 +1,7 @@
/*
* Strings -- draws string art.
*
* Last modified: 2019-08-29
* Last modified: 2021-09-21
*/
#include "tp_magic_api.h"
#include "SDL_image.h"
@ -59,6 +59,7 @@ void string_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
int string_get_tool_count(magic_api * api);
SDL_Surface *string_get_icon(magic_api * api, int which);
char *string_get_name(magic_api * api, int which);
int string_get_group(magic_api * api, int which);
char *string_get_description(magic_api * api, int which, int mode);
int string_requires_colors(magic_api * api, int which);
void string_release(magic_api * api, int which,
@ -77,7 +78,7 @@ Uint32 string_api_version(void)
return (TP_MAGIC_API_VERSION);
}
int string_modes( __attribute__ ((unused)) magic_api * api, int which)
int string_modes(magic_api * api ATTRIBUTE_UNUSED, int which)
{
if (which == STRING_TOOL_FULL_BY_OFFSET)
return (MODE_PAINT);
@ -85,7 +86,7 @@ int string_modes( __attribute__ ((unused)) magic_api * api, int which)
return (MODE_PAINT_WITH_PREVIEW);
}
void string_set_color( __attribute__ ((unused)) magic_api * api, Uint8 r, Uint8 g, Uint8 b)
void string_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b)
{
string_r = r;
string_g = g;
@ -94,7 +95,7 @@ void string_set_color( __attribute__ ((unused)) magic_api * api, Uint8 r, Uint8
int string_get_tool_count( __attribute__ ((unused)) magic_api * api)
int string_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
{
return STRING_NUMTOOLS;
}
@ -120,8 +121,7 @@ SDL_Surface *string_get_icon(magic_api * api, int which)
}
char *string_get_name( __attribute__ ((unused)) magic_api * api, __attribute__ ((unused))
int which)
char *string_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
switch (which)
{
@ -136,8 +136,12 @@ char *string_get_name( __attribute__ ((unused)) magic_api * api, __attribute__ (
}
}
char *string_get_description( __attribute__ ((unused)) magic_api * api, int which, __attribute__ ((unused))
int mode)
int string_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_ARTISTIC;
}
char *string_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{
switch (which)
{
@ -154,8 +158,7 @@ char *string_get_description( __attribute__ ((unused)) magic_api * api, int whic
}
}
int string_requires_colors( __attribute__ ((unused)) magic_api * api, __attribute__ ((unused))
int which)
int string_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return 1;
}
@ -180,7 +183,7 @@ void string_release(magic_api * api, int which,
}
}
int string_init( __attribute__ ((unused)) magic_api * api)
int string_init(magic_api * api ATTRIBUTE_UNUSED)
{
char fname[1024];
@ -196,7 +199,7 @@ int string_init( __attribute__ ((unused)) magic_api * api)
return (1);
}
void string_shutdown( __attribute__ ((unused)) magic_api * api)
void string_shutdown(magic_api * api ATTRIBUTE_UNUSED)
{
int i = 0;
@ -211,19 +214,14 @@ void string_shutdown( __attribute__ ((unused)) magic_api * api)
}
}
void string_switchin( __attribute__ ((unused)) magic_api * api, __attribute__ ((unused))
int which, __attribute__ ((unused))
int mode, SDL_Surface * canvas, __attribute__ ((unused)) SDL_Surface * snapshot)
void string_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED)
{
canvas_backup = SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask,
canvas->format->Amask);
}
void string_switchout( __attribute__ ((unused)) magic_api * api, __attribute__ ((unused))
int which, __attribute__ ((unused))
int mode, __attribute__ ((unused)) SDL_Surface * canvas,
__attribute__ ((unused)) SDL_Surface * snapshot)
void string_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * snapshot ATTRIBUTE_UNUSED)
{
SDL_FreeSurface(canvas_backup);
canvas_backup = NULL;
@ -232,8 +230,7 @@ void string_switchout( __attribute__ ((unused)) magic_api * api, __attribute__ (
// Interactivity functions
void string_callback(void *ptr, __attribute__ ((unused))
int which, SDL_Surface * canvas, __attribute__ ((unused)) SDL_Surface * snapshot, int x, int y)
void string_callback(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y)
{
magic_api *api = (magic_api *) ptr;
@ -241,8 +238,7 @@ void string_callback(void *ptr, __attribute__ ((unused))
}
void string_click(magic_api * api, int which, __attribute__ ((unused))
int mode, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
void string_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
{
SDL_BlitSurface(canvas, NULL, canvas_backup, NULL);
@ -253,8 +249,7 @@ void string_click(magic_api * api, int which, __attribute__ ((unused))
string_drag(api, which, canvas, snapshot, x, y, x, y, update_rect);
}
static void string_draw_full_by_offset(void *ptr, __attribute__ ((unused))
int which, SDL_Surface * canvas, __attribute__ ((unused)) SDL_Surface * snapshot,
static void string_draw_full_by_offset(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
int x, int y, SDL_Rect * update_rect)
{
magic_api *api = (magic_api *) ptr;
@ -377,9 +372,7 @@ void string_draw_triangle_preview(magic_api * api, int which,
}
void string_draw_angle_preview(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot, __attribute__ ((unused))
int ox, __attribute__ ((unused))
int oy, int x, int y, SDL_Rect * update_rect)
SDL_Surface * canvas, SDL_Surface * snapshot, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y, SDL_Rect * update_rect)
{
int middle_x, middle_y;
int dx, dy;
@ -411,11 +404,8 @@ void string_draw_angle_preview(magic_api * api, int which,
}
void string_draw_angle(magic_api * api, __attribute__ ((unused))
int which,
SDL_Surface * canvas, __attribute__ ((unused)) SDL_Surface * snapshot, __attribute__ ((unused))
int ox, __attribute__ ((unused))
int oy, int x, int y, SDL_Rect * update_rect)
void string_draw_angle(magic_api * api, int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y, SDL_Rect * update_rect)
{
float first_arm_step_x, first_arm_step_y, second_arm_step_x, second_arm_step_y;
int i;
@ -445,8 +435,7 @@ void string_draw_angle(magic_api * api, __attribute__ ((unused))
}
}
void string_draw_triangle(magic_api * api, __attribute__ ((unused))
int which,
void string_draw_triangle(magic_api * api, int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas, SDL_Surface * snapshot, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{

View file

@ -10,7 +10,7 @@
Credits: Andrew Corcoran <akanewbie@gmail.com>
Copyright (c) 2002-2009 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/
@ -29,7 +29,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: May 6, 2009
Last updated: September 21, 2021
$Id$
*/
@ -87,6 +87,7 @@ Uint32 tint_api_version(void);
int tint_get_tool_count(magic_api * api);
SDL_Surface *tint_get_icon(magic_api * api, int which);
char *tint_get_name(magic_api * api, int which);
int tint_get_group(magic_api * api, int which);
char *tint_get_description(magic_api * api, int which, int mode);
static int tint_grey(Uint8 r1, Uint8 g1, Uint8 b1);
static void do_tint_pixel(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
@ -144,6 +145,12 @@ char *tint_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(tint_names[which])));
}
// Return our group (both the same):
int tint_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_COLOR_FILTERS;
}
// Return our descriptions, localized:
char *tint_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{

View file

@ -6,7 +6,7 @@
Credits: Andrew Corcoran <akanewbie@gmail.com>
Copyright (c) 2002-2007 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/
@ -25,7 +25,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: June 6, 2008
Last updated: September 21, 2021
$Id$
*/
@ -68,6 +68,10 @@ const char *toothpaste_names[toothpaste_NUM_TOOLS] = {
gettext_noop("Toothpaste"),
};
const int toothpaste_groups[toothpaste_NUM_TOOLS] = {
MAGIC_TYPE_PAINTING,
};
const char *toothpaste_descs[toothpaste_NUM_TOOLS] = {
gettext_noop("Click and drag to squirt toothpaste onto your picture."),
};
@ -78,6 +82,7 @@ int toothpaste_init(magic_api * api);
int toothpaste_get_tool_count(magic_api * api);
SDL_Surface *toothpaste_get_icon(magic_api * api, int which);
char *toothpaste_get_name(magic_api * api, int which);
int toothpaste_get_group(magic_api * api, int which);
char *toothpaste_get_description(magic_api * api, int which, int mode);
static void do_toothpaste(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
void toothpaste_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -156,6 +161,12 @@ char *toothpaste_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
return (strdup(gettext_noop(toothpaste_names[which])));
}
// Return our groups:
int toothpaste_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
{
return toothpaste_groups[which];
}
// Return our descriptions, localized:
char *toothpaste_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
{

View file

@ -4,7 +4,7 @@
Tornado Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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: May 29, 2009
Last updated: September 21, 2021
$Id$
*/
@ -78,6 +78,7 @@ int tornado_init(magic_api * api);
int tornado_get_tool_count(magic_api * api);
SDL_Surface *tornado_get_icon(magic_api * api, int which);
char *tornado_get_name(magic_api * api, int which);
int tornado_get_group(magic_api * api, int which);
char *tornado_get_description(magic_api * api, int which, int mode);
@ -153,6 +154,12 @@ char *tornado_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNU
return (strdup(gettext_noop("Tornado")));
}
// Return our groups:
int tornado_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_ARTISTIC;
}
// Return our descriptions, localized:
char *tornado_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{

View file

@ -5,8 +5,9 @@
Tux Paint - A simple drawing program for children.
Credits: Adam 'foo-script' Rakowski <foo-script@o2.pl>
and Bill Kendrick <bill@newbreedsoftware.com>
Copyright (c) 2002-2008 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/
@ -29,6 +30,7 @@
#include "tp_magic_api.h"
#include "SDL_image.h"
#include "SDL_mixer.h"
#include <math.h>
int RADIUS = 16;
@ -40,6 +42,7 @@ int tv_init(magic_api * api);
int tv_get_tool_count(magic_api * api);
SDL_Surface *tv_get_icon(magic_api * api, int which);
char *tv_get_name(magic_api * api, int which);
int tv_get_group(magic_api * api, int which);
char *tv_get_description(magic_api * api, int which, int mode);
int tv_requires_colors(magic_api * api, int which);
void tv_release(magic_api * api, int which,
@ -96,6 +99,11 @@ char *tv_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
return strdup(gettext_noop("TV"));
}
int tv_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_DISTORTS;
}
char *tv_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
{
if (mode == MODE_PAINT)
@ -124,25 +132,61 @@ void tv_shutdown(magic_api * api ATTRIBUTE_UNUSED)
// Interactivity functions
void tv_do_tv(void *ptr_to_api, int which_tool ATTRIBUTE_UNUSED,
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y)
{
magic_api *api = (magic_api *) ptr_to_api;
Uint8 r, g, b, i;
for (i = 0; i < 2; i++)
{
/* Convert the line below to their red/green/blue elements */
SDL_GetRGB(api->getpixel(snapshot, x, y + i), snapshot->format, &r, &g, &b);
if (x % 3 == 0)
{
/* Red */
g = 0;
b = 0;
}
else if (x % 3 == 1)
{
/* Green */
r = 0;
b = 0;
}
else
{
/* Blue */
r = 0;
g = 0;
}
r = r / (i + 1);
g = g / (i + 1);
b = b / (i + 1);
api->putpixel(canvas, x, y + i, SDL_MapRGB(canvas->format, r, g, b));
}
}
void tv_paint_tv(void *ptr_to_api, int which_tool ATTRIBUTE_UNUSED,
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y)
{
int i, j;
magic_api *api = (magic_api *) ptr_to_api;
y = (y - (y % 2));
for (i = x - RADIUS; i < x + RADIUS; i++)
for (j = y - RADIUS; j < y + RADIUS; j++)
if ((j + 1) % 2 && api->in_circle(i - x, j - y, RADIUS) && !api->touched(i, j))
api->putpixel(canvas, i, j, SDL_MapRGB(canvas->format, 128, 128, 165));
}
void tv_do_tv(void *ptr_to_api, int which_tool ATTRIBUTE_UNUSED,
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y)
{
magic_api *api = (magic_api *) ptr_to_api;
api->putpixel(canvas, x, y, SDL_MapRGB(canvas->format, 128, 128, 165));
//api->putpixel(canvas, x, y, SDL_MapRGB(canvas->format, 0, 0, 255));
{
for (j = y - RADIUS; j < y + RADIUS; j += 2)
{
if (api->in_circle(i - x, j - y, RADIUS) && !api->touched(i, j))
{
tv_do_tv(api, 0, canvas, snapshot, i, j);
}
}
}
}
void tv_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -162,10 +206,13 @@ void tv_click(magic_api * api, int which, int mode,
{
if (mode == MODE_FULLSCREEN)
{
int i;
for (i = 0; i < canvas->h; i += 2)
api->line(api, which, canvas, last, 0, i, canvas->w, i, 1, tv_do_tv);
for (y = 0; y < canvas->h; y += 2)
{
for (x = 0; x < canvas->w; x++)
{
tv_do_tv(api, which, canvas, last, x, y);
}
}
update_rect->w = canvas->w;
update_rect->h = canvas->h;

View file

@ -4,7 +4,7 @@
Waves Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 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/
@ -43,6 +43,7 @@ int waves_init(magic_api * api);
int waves_get_tool_count(magic_api * api);
SDL_Surface *waves_get_icon(magic_api * api, int which);
char *waves_get_name(magic_api * api, int which);
int waves_get_group(magic_api * api, int which);
char *waves_get_description(magic_api * api, int which, int mode);
void waves_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
@ -97,6 +98,12 @@ SDL_Surface *waves_get_icon(magic_api * api, int which)
return (IMG_Load(fname));
}
// Return our group (both the same):
int waves_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_PICTURE_WARPS;
}
// Return our names, localized:
char *waves_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
{

View file

@ -6,11 +6,7 @@
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2008 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
Copyright (c) 2013 by Lukasz Dmitrowski
Copyright (c) 2013-2021 by Lukasz Dmitrowski
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -26,6 +22,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: September 21, 2021
*/
#include <stdio.h>
@ -41,6 +39,7 @@ int xor_init(magic_api * api);
int xor_get_tool_count(magic_api * api);
SDL_Surface *xor_get_icon(magic_api * api, int which);
char *xor_get_name(magic_api * api, int which);
int xor_get_group(magic_api * api, int which);
char *xor_get_description(magic_api * api, int which, int mode);
void xor_drag(magic_api * api, int which, SDL_Surface * canvas,
@ -93,6 +92,11 @@ char *xor_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
return (strdup(gettext_noop("Xor Colors")));
}
int xor_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_COLOR_FILTERS;
}
char *xor_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
{
if (mode == MODE_PAINT)