Finished organizing Magic tools; updated docs

Added group code to `tp_magic_example.c`, and documented
in the "Creating Tux Paint Magic Tool Plugins" docs.
This commit is contained in:
Bill Kendrick 2021-09-21 01:02:22 -07:00
parent 5882a48412
commit 1d5dd8eb9f
16 changed files with 209 additions and 60 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

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"
@ -44,6 +45,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,
@ -129,6 +131,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

@ -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 21, 2021
$Id$
*/
@ -72,6 +72,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);
@ -133,6 +134,12 @@ char *rainbow_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNU
return (strdup(gettext_noop("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:
char *rainbow_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

@ -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

@ -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_ANYFORMAT, 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

@ -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)