Magic tools (and tp-magic-config) supports local (user) plugins.

Added copyright & credit info to new Magic tool plugin .c files.
Updated Magic plugin doc API.
This commit is contained in:
William Kendrick 2007-08-08 06:56:04 +00:00
parent cf10090cc1
commit 0d6c2cf1b9
30 changed files with 1146 additions and 350 deletions

View file

@ -1,3 +1,32 @@
/*
blocks_chalk_drip.c
Blocks, Chalk and Drip Magic Tools Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -217,7 +246,7 @@ void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{
api->line(which, canvas, last, ox, oy, x, y, 1, blocks_chalk_drip_linecb);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, blocks_chalk_drip_linecb);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }

View file

@ -1,3 +1,34 @@
/*
blur.c
Blur Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
Major improvements by Albert Cahalan <albert@users.sf.net>
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -130,7 +161,7 @@ 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)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_blur);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_blur);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }

View file

@ -1,3 +1,34 @@
/*
bricks.c
Bricks Magic Tools Plugin
Tux Paint - A simple drawing program for children.
Albert Cahalan <albert@users.sf.net>
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -179,7 +210,7 @@ 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)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_bricks);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_bricks);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }

View file

@ -1,3 +1,32 @@
/*
cartoon.c
Cartoon Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -148,7 +177,7 @@ void cartoon_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_cartoon);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_cartoon);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }

View file

@ -1,3 +1,32 @@
/*
emboss.c
Emboss Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -18,7 +47,7 @@ int emboss_init(magic_api * api)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%s/sounds/magic/emboss.wav",
snprintf(fname, sizeof(fname), "%s/sounds/magic/emboss.ogg",
api->data_directory);
emboss_snd = Mix_LoadWAV(fname);
@ -104,7 +133,7 @@ void emboss_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_emboss);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_emboss);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }
@ -115,7 +144,7 @@ void emboss_drag(magic_api * api, int which, SDL_Surface * canvas,
update_rect->h = (y + 16) - update_rect->h;
api->playsound(emboss_snd,
(x * 255) / canvas->w, (y * 255) / canvas->h);
(x * 255) / canvas->w, 255);
}
// Affect the canvas on click:

View file

@ -1,3 +1,32 @@
/*
fade_darken.c
Fade and Darken Magic Tools Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -125,7 +154,7 @@ void fade_darken_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_LockSurface(last);
SDL_LockSurface(canvas);
api->line(which, canvas, last, ox, oy, x, y, 1, do_fade_darken);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_fade_darken);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(last);

View file

@ -1,3 +1,36 @@
/*
fill.c
Fill Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
Flood fill code based on Wikipedia example:
http://www.wikipedia.org/wiki/Flood_fill/C_example
by Damian Yerrick - http://www.wikipedia.org/wiki/Damian_Yerrick
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>

View file

@ -1,3 +1,32 @@
/*
flower.c
Flower Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -13,7 +42,7 @@ enum { LEAFSIDE_RIGHT_DOWN,
LEAFSIDE_RIGHT_UP,
LEAFSIDE_LEFT_UP };
Mix_Chunk * flower_snd;
Mix_Chunk * flower_click_snd, * flower_release_snd;
Uint8 flower_r, flower_g, flower_b;
int flower_min_x, flower_max_x, flower_bottom_x, flower_bottom_y;
int flower_side_first;
@ -49,9 +78,13 @@ int flower_init(magic_api * api)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%s/sounds/magic/flower.wav",
snprintf(fname, sizeof(fname), "%s/sounds/magic/flower_click.ogg",
api->data_directory);
flower_snd = Mix_LoadWAV(fname);
flower_click_snd = Mix_LoadWAV(fname);
snprintf(fname, sizeof(fname), "%s/sounds/magic/flower_release.ogg",
api->data_directory);
flower_release_snd = Mix_LoadWAV(fname);
snprintf(fname, sizeof(fname), "%s/images/magic/flower_base.png",
api->data_directory);
@ -172,6 +205,8 @@ void flower_click(magic_api * api, int which,
flower_side_first = SIDE_LEFT;
flower_drag(api, which, canvas, last, x, y, x, y, update_rect);
api->playsound(flower_click_snd, (x * 255) / canvas->w, 255);
}
// Affect the canvas on release:
@ -211,7 +246,7 @@ void flower_release(magic_api * api, int which,
update_rect->w = canvas->w;
update_rect->h = canvas->h;
api->playsound(flower_snd, (x * 255) / canvas->w, 255); /* FIXME: Distance? */
api->playsound(flower_release_snd, (x * 255) / canvas->w, 255);
}
@ -410,8 +445,11 @@ void flower_drawstalk(magic_api * api, SDL_Surface * canvas,
void flower_shutdown(magic_api * api)
{
if (flower_snd != NULL)
Mix_FreeChunk(flower_snd);
if (flower_click_snd != NULL)
Mix_FreeChunk(flower_click_snd);
if (flower_release_snd != NULL)
Mix_FreeChunk(flower_release_snd);
if (flower_base != NULL)
SDL_FreeSurface(flower_base);

View file

@ -1,3 +1,32 @@
/*
foam.c
Foam Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -30,7 +59,7 @@ int foam_init(magic_api * api)
char fname[1024];
SDL_Surface * foam_data;
snprintf(fname, sizeof(fname), "%s/sounds/magic/foam.wav",
snprintf(fname, sizeof(fname), "%s/sounds/magic/foam.ogg",
api->data_directory);
foam_snd = Mix_LoadWAV(fname);
@ -115,7 +144,7 @@ void foam_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_foam);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_foam);
foam_release(api, which, canvas, last, x, y, update_rect);

View file

@ -1,3 +1,32 @@
/*
glasstile.c
Glass Tile Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -21,7 +50,7 @@ int glasstile_init(magic_api * api)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%s/sounds/magic/glasstile.wav",
snprintf(fname, sizeof(fname), "%s/sounds/magic/glasstile.ogg",
api->data_directory);
glasstile_snd = Mix_LoadWAV(fname);
@ -157,7 +186,7 @@ void glasstile_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_glasstile);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_glasstile);
update_rect->x = 0;
update_rect->y = 0;

View file

@ -1,3 +1,33 @@
/*
grass.c
Grass Magic Tool Plugin
Tux Paint - A simple drawing program for children.
by Albert Cahalan <albert@users.sf.net>
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -74,7 +104,7 @@ 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)
{
api->line(which, canvas, last, ox, oy, x, y, 4, do_grass);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 4, do_grass);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }

View file

@ -1,3 +1,32 @@
/*
kalidescope.c
Kaleidoscope Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -89,7 +118,7 @@ void kalidescope_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_kalidescope);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_kalidescope);
update_rect->x = 0;
update_rect->y = 0;

View file

@ -1,3 +1,32 @@
/*
metalpaint.c
Metal Paint Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -96,7 +125,7 @@ void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_metalpaint);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_metalpaint);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }

View file

@ -1,3 +1,32 @@
/*
mirror_flip.c
Mirror and Flip Magic Tools Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>

View file

@ -1,3 +1,32 @@
/*
negative.c
Negative Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -86,7 +115,7 @@ void negative_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_LockSurface(last);
SDL_LockSurface(canvas);
api->line(which, canvas, last, ox, oy, x, y, 1, do_negative);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_negative);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }

View file

@ -1,3 +1,32 @@
/*
rainbow.c
Rainbow Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -118,7 +147,7 @@ void rainbow_drag(magic_api * api, int which, SDL_Surface * canvas,
rainbow_hexes[rainbow_color][1],
rainbow_hexes[rainbow_color][2]);
api->line(which, canvas, last, ox, oy, x, y, 1, rainbow_linecb);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, rainbow_linecb);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }

View file

@ -1,3 +1,32 @@
/*
ripples.c
Ripples Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -23,7 +52,7 @@ int ripples_init(magic_api * api)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%s/sounds/magic/ripples.wav",
snprintf(fname, sizeof(fname), "%s/sounds/magic/ripples.ogg",
api->data_directory);
ripples_snd = Mix_LoadWAV(fname);
@ -109,7 +138,7 @@ void ripples_click(magic_api * api, int which,
ripples_brite = (ripples_z * 20 * deg_sin(d + 45)) / ((fli / 4) + 1);
api->line(which, canvas, last, ox, oy, nx, ny, 1, ripples_linecb);
api->line((void *) api, which, canvas, last, ox, oy, nx, ny, 1, ripples_linecb);
ox = nx;
oy = ny;
@ -120,6 +149,8 @@ void ripples_click(magic_api * api, int which,
update_rect->y = y - 100;
update_rect->w = 200;
update_rect->h = 200;
api->playsound(ripples_snd, (x * 255) / api->canvas_w, 255);
}
// Affect the canvas on release:

View file

@ -1,3 +1,33 @@
/*
smudge.c
Magic Tool Plugin
Tux Paint - A simple drawing program for children.
by Albert Cahalan <albert@users.sf.net>
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -97,7 +127,7 @@ void smudge_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_smudge);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_smudge);
api->playsound(smudge_snd, (x * 255) / canvas->w, 255);

View file

@ -1,3 +1,32 @@
/*
sparkles.c
Sparkles Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -8,7 +37,7 @@
/* Our globals: */
Mix_Chunk * sparkles_snd;
Mix_Chunk * sparkles1_snd, * sparkles2_snd;
Uint8 sparkles_r, sparkles_g, sparkles_b;
@ -20,9 +49,13 @@ int sparkles_init(magic_api * api)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%s/sounds/magic/sparkles.wav",
snprintf(fname, sizeof(fname), "%s/sounds/magic/sparkles1.wav",
api->data_directory);
sparkles_snd = Mix_LoadWAV(fname);
sparkles1_snd = Mix_LoadWAV(fname);
snprintf(fname, sizeof(fname), "%s/sounds/magic/sparkles2.wav",
api->data_directory);
sparkles2_snd = Mix_LoadWAV(fname);
return(1);
}
@ -97,7 +130,7 @@ void sparkles_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_sparkles);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_sparkles);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }
@ -107,7 +140,13 @@ void sparkles_drag(magic_api * api, int which, SDL_Surface * canvas,
update_rect->w = (x + 8) - update_rect->x;
update_rect->h = (y + 8) - update_rect->h;
api->playsound(sparkles_snd, (x * 255) / canvas->w, 255);
if ((rand() % 10) == 0)
{
if ((rand() % 10) < 5)
api->playsound(sparkles1_snd, (x * 255) / canvas->w, 255);
else
api->playsound(sparkles2_snd, (x * 255) / canvas->w, 255);
}
}
// Affect the canvas on click:
@ -128,8 +167,10 @@ void sparkles_release(magic_api * api, int which,
// No setup happened:
void sparkles_shutdown(magic_api * api)
{
if (sparkles_snd != NULL)
Mix_FreeChunk(sparkles_snd);
if (sparkles1_snd != NULL)
Mix_FreeChunk(sparkles1_snd);
if (sparkles2_snd != NULL)
Mix_FreeChunk(sparkles2_snd);
}
// Record the color from Tux Paint:

View file

@ -1,3 +1,32 @@
/*
tint.c
Tint Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -101,7 +130,7 @@ void tint_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
{
api->line(which, canvas, last, ox, oy, x, y, 1, do_tint);
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_tint);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }

View file

@ -1,3 +1,32 @@
/*
waves.c
Waves Magic Tool Plugin
Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2007 by Bill Kendrick and others; see AUTHORS.txt
bill@newbreedsoftware.com
http://www.tuxpaint.org/
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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: August 7, 2007
$Id$
*/
#include <stdio.h>
#include <string.h>
#include <libintl.h>
@ -105,6 +134,7 @@ void waves_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * last,
int x, int y, SDL_Rect * update_rect)
{
api->playsound(waves_snd, 128, 255);
}
// No setup happened: