Added "Wet Paint" tool.

This commit is contained in:
William Kendrick 2009-10-08 17:17:17 +00:00
parent dd96740109
commit 77e346103b
9 changed files with 81 additions and 17 deletions

View file

@ -8,7 +8,7 @@ http://www.tuxpaint.org/
$Id$
2009.October.7 (0.9.22)
2009.October.8 (0.9.22)
* New Tools:
----------
* Label - A tool to add text to a drawing, which can be modified or
@ -32,6 +32,9 @@ $Id$
* ROYGBIV Rainbow - Draw a rainbow arc using solid colors of
Red, Orange, Yellow, Green, Blue, Indigo and Violet.
* Wet Paint - Draws a light coat of paint, and smudges at the same time.
(Based on Smudge tool. Requested by gallery artist Angela.)
* Other Improvements:
-------------------
* Starter images can be in SVG (Scalable Vector Graphics) format.

View file

@ -61,5 +61,6 @@
<li><a href="toothpaste.html">Toothpaste</a></li>
<li><a href="waves.html">Waves</a></li>
<li><a href="wavelets.html">Wavelets</a></li>
<li><a href="wetpaint.html">Wet Paint</a></li>
<li><a href="zoom.html">Zoom</a></li>
</body></html>

View file

@ -6,5 +6,5 @@
<h1 align="center">Tux Paint "Magic" Tool: Smudge</h1>
<h2 align="center">By Albert Cahalan &lt;<a href="mailto:albert@users.sf.net">albert@users.sf.net</a>&gt;</h2>
<p>This pushes the colors around under the mouse, like finger painting with wet paint.</p>
<p>See also: <a href="blur.html">Blur</a></p>
<p>See also: <a href="blur.html">Blur</a> <a href="wetpaint.html">Wet Paint</a> </p>
</body></html>

View file

@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<body><html><head><title>Tux Paint "Magic" Tool: Wet Paint</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: Wet Paint</h1>
<h2 align="center">By Albert Cahalan &lt;<a href="mailto:albert@users.sf.net">albert@users.sf.net</a>&gt;<br>
Bill Kendrick &lt;<a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a>&gt;<br>
</h2>
<p>This draws a light, smudgy coat of paint on the picture.</p>
<p>See also: <a href="smudge.html">Smudge</a></p>
</body></html>

View file

@ -57,4 +57,5 @@
* Toothpaste
* Waves
* Wavelets
* Wet Paint
* Zoom

View file

@ -5,4 +5,4 @@
This pushes the colors around under the mouse, like finger painting with
wet paint.
See also: Blur
See also: Blur Wet Paint

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> */
/* 2009.08.31 */
/* 2009.10.08 */
/* Authors of the Magic tools: */
@ -272,7 +272,7 @@ $tools = array(
array('name'=>'Smudge',
'desc'=>'This pushes the colors around under the mouse, like finger painting with wet paint.',
'author'=>$AUTHOR_ALBERT,
'see'=>'Blur'),
'see'=>array('Blur', 'Wet Paint')),
array('name'=>'Snow Ball',
'desc'=>'Fill the picture with snowballs.',
@ -324,6 +324,11 @@ $tools = array(
'author'=>array($AUTHOR_KENDRICK, $AUTHOR_ADAMR),
'see'=>'Waves'),
array('name'=>'Wet Paint',
'desc'=>'This draws a light, smudgy coat of paint on the picture.',
'author'=>array($AUTHOR_ALBERT, $AUTHOR_KENDRICK),
'see'=>'Smudge'),
array('name'=>'Zoom',
'desc'=>'Click and drag up to zoom in, or down to zoom out.',
'author'=>$AUTHOR_PERE),

View file

@ -0,0 +1,8 @@
Tux Paint "Magic" Tool: Wet Paint
By Albert Cahalan <albert@users.sf.net>
Bill Kendrick <bill@newbreedsoftware.com>
This draws a light, smudgy coat of paint on the picture.
See also: Smudge

View file

@ -4,9 +4,10 @@
Magic Tool Plugin
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
bill@newbreedsoftware.com
Smudge by Albert Cahalan <albert@users.sf.net>
Wet Paint addition by Bill Kendrick <bill@newbreedsoftware.com>
Copyright (c) 2002-2009
http://www.tuxpaint.org/
This program is free software; you can redistribute it and/or modify
@ -24,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: Oconter 8, 2009
$Id$
*/
@ -37,7 +38,7 @@
/* Our globals: */
static Mix_Chunk * smudge_snd;
static Uint8 smudge_r, smudge_g, smudge_b;
// No setup required:
@ -57,7 +58,7 @@ Uint32 smudge_api_version(void) { return(TP_MAGIC_API_VERSION); }
// We have multiple tools:
int smudge_get_tool_count(magic_api * api)
{
return(1);
return(2);
}
// Load our icons:
@ -65,8 +66,12 @@ SDL_Surface * smudge_get_icon(magic_api * api, int which)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%s/images/magic/smudge.png",
api->data_directory);
if (which == 0)
snprintf(fname, sizeof(fname), "%s/images/magic/smudge.png",
api->data_directory);
else /* if (which == 1) */
snprintf(fname, sizeof(fname), "%s/images/magic/smudge.png", /* FIXME */
api->data_directory);
return(IMG_Load(fname));
}
@ -74,14 +79,19 @@ SDL_Surface * smudge_get_icon(magic_api * api, int which)
// Return our names, localized:
char * smudge_get_name(magic_api * api, int which)
{
return(strdup(gettext_noop("Smudge")));
if (which == 0)
return(strdup(gettext_noop("Smudge")));
else /* if (which == 1) */
return(strdup(gettext_noop("Wet Paint")));
}
// Return our descriptions, localized:
char * smudge_get_description(magic_api * api, int which, int mode)
{
return(strdup(gettext_noop(
"Click and move the mouse around to smudge the picture.")));
if (which == 0)
return(strdup(gettext_noop("Click and move the mouse around to smudge the picture.")));
else /* if (which == 1) */
return(strdup(gettext_noop("Click and move the mouse around to draw with wet, smudgy paint.")));
}
// Do the effect:
@ -94,6 +104,24 @@ static void do_smudge(void * ptr, int which, SDL_Surface * canvas, SDL_Surface *
unsigned i = 32 * 32;
double rate = api->button_down() ? 0.5 : 0.0;
Uint8 r, g, b;
int xx, yy, strength;
if (which == 1)
{
/* Wet paint */
for (yy = -8; yy < 8; yy++)
for (xx = -8; xx < 8; xx++)
if (api->in_circle(xx, yy, 8))
{
SDL_GetRGB(api->getpixel(last, x + xx, y + yy),
last->format, &r, &g, &b);
strength = (abs(xx * yy) / 8) + 6;
api->putpixel(canvas, x + xx, y +yy, SDL_MapRGB(canvas->format,
(smudge_r + r * strength) / (strength + 1),
(smudge_g + g * strength) / (strength + 1),
(smudge_b + b * strength) / (strength + 1)));
}
}
while (i--)
{
@ -164,12 +192,18 @@ void smudge_shutdown(magic_api * api)
// Record the color from Tux Paint:
void smudge_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
{
smudge_r = r;
smudge_g = g;
smudge_b = b;
}
// Use colors:
int smudge_requires_colors(magic_api * api, int which)
{
return 0;
if (which == 0)
return 0;
else /* if (which == 1) */
return 1;
}
void smudge_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)