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:
parent
5882a48412
commit
1d5dd8eb9f
16 changed files with 209 additions and 60 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 * api,
|
||||
int 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 Paint 0.9.27; Magic API version
|
||||
'0x00000005'</i><br>
|
||||
<br>
|
||||
|
||||
<li><code><b>SDL_Surface * get_icon(magic_api * api,
|
||||
int which)</b></code><br>
|
||||
This should return an SDL_Surface containing the icon representing
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue