Brushes can include spacing information.

Added an animated, directional, colored, spaced 'squirrel' brush, as an
example of all new brush features.
----------------------------------------------------------------------
This commit is contained in:
William Kendrick 2006-09-04 11:06:23 +00:00
parent 1f5665437e
commit b5a3d6a6d8
4 changed files with 232 additions and 195 deletions

View file

@ -9,7 +9,8 @@ http://www.newbreedsoftware.com/tuxpaint/
$Id$ $Id$
2006.September.3 (0.9.16) 2006.September.4 (0.9.16)
* Interface improvements: * Interface improvements:
----------------------- -----------------------
* New slideshow tool! ("Slides", available in "Open" dialog.) * New slideshow tool! ("Slides", available in "Open" dialog.)
@ -70,19 +71,24 @@ $Id$
* Brushes may be animated. (Implements RFE #1522694) * Brushes may be animated. (Implements RFE #1522694)
(Create an image (W*N) x H in size (where N is number of frames), (Create an image (W*N) x H in size (where N is number of frames),
then create a ".dat" file for the brush containing "frames=N". then create a ".dat" file for the brush, containing the line "frames=N".
* Brushes can include directional variations. (Implements RFE #1522694) * Brushes can include directional variations. (Implements RFE #1522694)
(Create an image (W*3) x (H*3) in size, then create a ".dat" file (Create an image (W*3) x (H*3) in size, then create a ".dat" file
for the brush containing the line: "directional". Each of the 9 for the brush, containing the line: "directional". Each of the 9
sectors corresponds to 8 different directions, and center.) sectors corresponds to 8 different directions, and center.)
* Brushes can include spacing information.
(Create a ".dat" file for the brush, containing the line "spacing=N".
* New Brushes: * New Brushes:
------------ ------------
* Vines (animated) * Vines (animated)
* Angle Lines (directional) * Angle Lines (directional)
* Squirrel (animated, directional)
* New Starter Images: * New Starter Images:
------------------- -------------------

View file

@ -143,6 +143,16 @@ Brushes
(e.g., "brush.png"'s data file is the text file "brush.dat" in the (e.g., "brush.png"'s data file is the text file "brush.dat" in the
same directory.) same directory.)
Brush Spacing
As of Tux Paint version 0.9.16, you can now specify the spacing for
brushes (that is, how often they are drawn). By default, the spacing
will be the brush's height, divided by 4.
Add a line containing the line "spacing=N" to the brush's data file,
where N is the spacing you want for the brush. (The lower the
number, the more often the brush is drawn.)
Animated Brushes Animated Brushes
As of Tux Paint version 0.9.16, you may now create animated brushes. As of Tux Paint version 0.9.16, you may now create animated brushes.
@ -181,296 +191,293 @@ Brushes
pixels of the image represent the 9 direction shapes for the first pixels of the image represent the 9 direction shapes for the first
frame, for example.) frame, for example.)
Place the brush image PNGs (and any data text files) in the "brushes" Place the brush image PNGs (and any data text files) in the "brushes"
directory. directory.
Note: If your new brushes all come out as solid squares or rectangles, Note: If your new brushes all come out as solid squares or rectangles,
it's because you forgot to use alpha transparency! See the it's because you forgot to use alpha transparency! See the documentation
documentation file "PNG.txt" for more information and tips. file "PNG.txt" for more information and tips.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Stamps Stamps
All stamp-related files go in the "stamps" directory. It's useful to All stamp-related files go in the "stamps" directory. It's useful to
create subdirectories and sub-subdirectories there to organize the create subdirectories and sub-subdirectories there to organize the
stamps. (For example, you can have a "holidays" folder with stamps. (For example, you can have a "holidays" folder with "halloween"
"halloween" and "christmas" sub-folders.) and "christmas" sub-folders.)
Images Images
Rubber Stamps in Tux Paint can be made up of a number of separate Rubber Stamps in Tux Paint can be made up of a number of separate
files. The one file that is required is, of course, the picture files. The one file that is required is, of course, the picture
itself. itself.
The Stamps used by Tux Paint are PNG pictures. They can be The Stamps used by Tux Paint are PNG pictures. They can be full-color
full-color or greyscale. The alpha (transparency) of the PNG is used or greyscale. The alpha (transparency) of the PNG is used to determine
to determine the actual shape of the picture (otherwise you'll stamp the actual shape of the picture (otherwise you'll stamp a large
a large rectangle on your drawings). rectangle on your drawings).
The PNGs can be any size, but in practice, a 100 pixels wide by The PNGs can be any size, but in practice, a 100 pixels wide by
100 pixels tall (100 x 100) is quite large for Tux Paint. 100 pixels tall (100 x 100) is quite large for Tux Paint.
Note: If your new stamps all have solid rectangular-shaped outlines Note: If your new stamps all have solid rectangular-shaped outlines of
of a solid color (e.g., white or black), it's because you forgot to a solid color (e.g., white or black), it's because you forgot to use
use alpha transparency! See the documentation file "PNG.txt" for alpha transparency! See the documentation file "PNG.txt" for more
more information and tips. information and tips.
Advanced Users: The Advanced Stamps HOWTO describes, in detail, how Advanced Users: The Advanced Stamps HOWTO describes, in detail, how to
to make images which will scale perfectly when used as stamps in make images which will scale perfectly when used as stamps in
Tux Paint. Tux Paint.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Description Text Description Text
Text (".TXT") files with the same name as the PNG. (e.g., Text (".TXT") files with the same name as the PNG. (e.g.,
"picture.png"'s description is stored in "picture.txt" in the same "picture.png"'s description is stored in "picture.txt" in the same
directory.) directory.)
The first line of the text file will be used as the US English The first line of the text file will be used as the US English
description of the stamp's image. It must be encoded in UTF-8. description of the stamp's image. It must be encoded in UTF-8.
Language Support Language Support
Additional lines can be added to the text file to provide Additional lines can be added to the text file to provide
translations of the description, to be displayed when Tux Paint is translations of the description, to be displayed when Tux Paint is
running in a different locale (like French or Spanish). running in a different locale (like French or Spanish).
The beginning of the line should correspond to the language code The beginning of the line should correspond to the language code of
of the language in question (e.g., "fr" for French, and "zh_tw" the language in question (e.g., "fr" for French, and "zh_tw" for
for Traditional Chinese), followed by ".utf8=" and the translated Traditional Chinese), followed by ".utf8=" and the translated
description (encoded in UTF-8). description (encoded in UTF-8).
There are scripts in the "po" directory for converting the text There are scripts in the "po" directory for converting the text
files to PO format (and back) for easy translation to different files to PO format (and back) for easy translation to different
languages. Therefore you should never add or change translations languages. Therefore you should never add or change translations in
in the .txt files directly. the .txt files directly.
If no translation is available for the language Tux Paint is If no translation is available for the language Tux Paint is
currently running in, the US English text is used. currently running in, the US English text is used.
Windows Users Windows Users
Use NotePad or WordPad to edit/create these files. Be sure to save Use NotePad or WordPad to edit/create these files. Be sure to save
them as Plain Text, and make sure they have ".txt" at the end of them as Plain Text, and make sure they have ".txt" at the end of the
the filename... filename...
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Sound Effects Sound Effects
WAVE (".WAV") files with the same name as the PNG. (e.g., WAVE (".WAV") files with the same name as the PNG. (e.g.,
"picture.png"'s sound effect is the sound "picture.wav" in the same "picture.png"'s sound effect is the sound "picture.wav" in the same
directory.) directory.)
Language Support Language Support
For sounds for different locales (e.g., if the sound is someone For sounds for different locales (e.g., if the sound is someone
saying a word, and you want translated versions of the word said), saying a word, and you want translated versions of the word said),
also create WAV files with the locale's label in the filename, in also create WAV files with the locale's label in the filename, in
the form: "STAMP_LOCALE.wav" the form: "STAMP_LOCALE.wav"
"picture.png"'s sound effect, when Tux Paint is run in Spanish "picture.png"'s sound effect, when Tux Paint is run in Spanish mode,
mode, would be "picture_es.wav". In French mode, "picture_fr.wav". would be "picture_es.wav". In French mode, "picture_fr.wav". And so
And so on... on...
If no localized sound effect can be loaded, Tux Paint will attempt If no localized sound effect can be loaded, Tux Paint will attempt
to load the 'default' sound file. (e.g., "picture.wav") to load the 'default' sound file. (e.g., "picture.wav")
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Stamp Options Stamp Options
Aside from a graphical shape, a textual description, and a sound Aside from a graphical shape, a textual description, and a sound
effect, stamps can also be given other attributes. To do this, you effect, stamps can also be given other attributes. To do this, you
need to create a 'data file' for the stamp. need to create a 'data file' for the stamp.
A stamp data file is simply a text file containing the options. A stamp data file is simply a text file containing the options.
The file has the same name as the PNG image, but a ".dat" extension. The file has the same name as the PNG image, but a ".dat" extension.
(e.g., "picture.png"'s data file is the text file "picture.dat" in (e.g., "picture.png"'s data file is the text file "picture.dat" in the
the same directory.) same directory.)
Colored Stamps Colored Stamps
Stamps can be made to be either "colorable" or "tintable." Stamps can be made to be either "colorable" or "tintable."
Colorable Colorable
"Colorable" stamps they work much like brushes - you pick the "Colorable" stamps they work much like brushes - you pick the
stamp to get the shape, and then pick the color you want it to stamp to get the shape, and then pick the color you want it to be.
be. (Symbol stamps, like the mathematical and musical ones, are (Symbol stamps, like the mathematical and musical ones, are an
an example.) example.)
Nothing about the original image is used except the transparency Nothing about the original image is used except the transparency
(from "alpha" channel). The color of the stamp comes out solid. (from "alpha" channel). The color of the stamp comes out solid.
Add a line containing the word "colorable" to the stamp's data Add a line containing the word "colorable" to the stamp's data
file. file.
Tinted Tinted
"Tinted" stamps are similar to "colorable" ones, except the "Tinted" stamps are similar to "colorable" ones, except the
details of the original image are kept. (To put it technically, details of the original image are kept. (To put it technically,
the original image is used, but its hue is changed, based on the the original image is used, but its hue is changed, based on the
currently-selected color.) currently-selected color.)
Add a line containing the word "tintable" to the stamp's data Add a line containing the word "tintable" to the stamp's data
file. file.
Tinting Options: Tinting Options:
Depending on the contents of your stamp, you might want to Depending on the contents of your stamp, you might want to have
have Tux Paint use one of a numer of methods when tinting it. Tux Paint use one of a numer of methods when tinting it. Add one
Add one of the following lines to the stamp's data file: of the following lines to the stamp's data file:
"tinter=normal" (default) "tinter=normal" (default)
This is the normal tinting mode. This is the normal tinting mode.
"tinter=anyhue" "tinter=anyhue"
This is ???. This is ???.
"tinter=narrow" "tinter=narrow"
This is ???. This is ???.
"tinter=vector" "tinter=vector"
This is ???. This is ???.
Unalterable Stamps Unalterable Stamps
By default, a stamp can be flipped upside down, shown as a mirror By default, a stamp can be flipped upside down, shown as a mirror
image, or both. This is done using the control buttons below the image, or both. This is done using the control buttons below the
stamp selector, at the lower right side of the screen in stamp selector, at the lower right side of the screen in Tux Paint.
Tux Paint.
Sometimes, it doesn't make sense for a stamp to be flippable or Sometimes, it doesn't make sense for a stamp to be flippable or
mirrored; for example, stamps of letters or numbers. Sometimes mirrored; for example, stamps of letters or numbers. Sometimes
stamps are symmetrical, so letting the user flip or mirror them stamps are symmetrical, so letting the user flip or mirror them
isn't useful. isn't useful.
To make a stamp un-flippable, add the option "noflip" to the To make a stamp un-flippable, add the option "noflip" to the stamp's
stamp's data file. data file.
To keep a stamp from being mirrored, add a line containing the To keep a stamp from being mirrored, add a line containing the word
word "nomirror" to the stamp's data file. "nomirror" to the stamp's data file.
Initial Stamp Size Initial Stamp Size
By default, Tux Paint assumes that your stamp is sized By default, Tux Paint assumes that your stamp is sized appropriately
appropriately for unscaled display on a 608x472 canvas. This is for unscaled display on a 608x472 canvas. This is the original
the original Tux Paint canvas size, provided by a 640x480 screen. Tux Paint canvas size, provided by a 640x480 screen. Tux Paint will
Tux Paint will then adjust the stamp according to the current then adjust the stamp according to the current canvas size and, if
canvas size and, if enabled, the user's stamp size controls. enabled, the user's stamp size controls.
If your stamp would be too big or too small, you can specify a If your stamp would be too big or too small, you can specify a scale
scale factor. If your stamp would be 2.5 times as wide (or tall) factor. If your stamp would be 2.5 times as wide (or tall) as it
as it should be, add the option "scale 40%" or "scale 5/2" or should be, add the option "scale 40%" or "scale 5/2" or "scale 2.5"
"scale 2.5" or "scale 2:5" to your image. You may include an "=" or "scale 2:5" to your image. You may include an "=" if you wish, as
if you wish, as in "scale=40%". in "scale=40%".
Windows Users Windows Users
You can use NotePad or WordPad to create these file. Be sure to You can use NotePad or WordPad to create these file. Be sure to save
save it as Plain Text, and make sure the filename has ".dat" at it as Plain Text, and make sure the filename has ".dat" at the end,
the end, and not ".txt"... and not ".txt"...
Pre-Mirrored Images Pre-Mirrored Images
In some cases, you may wish to provide a pre-drawn version of a In some cases, you may wish to provide a pre-drawn version of a
stamp's mirror-image. For example, imagine a picture of a fire truck stamp's mirror-image. For example, imagine a picture of a fire truck
with the words "Fire Department" written across the side. You with the words "Fire Department" written across the side. You probably
probably do not want that text to appear backwards when the image is do not want that text to appear backwards when the image is flipped!
flipped!
To create a mirrored version of a stamp that you want Tux Paint to To create a mirrored version of a stamp that you want Tux Paint to
use, rather than mirroring one on its own, simply create a second use, rather than mirroring one on its own, simply create a second
".png" graphics file with the same name, except with the string ".png" graphics file with the same name, except with the string
"_mirror" before the filename extension. "_mirror" before the filename extension.
For example, for the stamp "truck.png" you would create another file For example, for the stamp "truck.png" you would create another file
named "truck_mirror.png", which will be used when the stamp is named "truck_mirror.png", which will be used when the stamp is
mirrored (rather than using a backwards version of 'truck.png'). mirrored (rather than using a backwards version of 'truck.png').
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Fonts Fonts
The fonts used by Tux Paint are TrueType Fonts (TTF). The fonts used by Tux Paint are TrueType Fonts (TTF).
Simply place them in the "fonts" directory. Tux Paint will load the Simply place them in the "fonts" directory. Tux Paint will load the font
font and provide four different sizes in the 'Letters' selector when and provide four different sizes in the 'Letters' selector when using
using the 'Text' tool. the 'Text' tool.
-------------------------------------------------------------------------- --------------------------------------------------------------------------
'Starters' 'Starters'
'Starter' images appear in the 'Open' dialog, along with pictures 'Starter' images appear in the 'Open' dialog, along with pictures you've
you've created. They have a green button background, instead of blue. created. They have a green button background, instead of blue.
Unlike your saved pictures, however, when you select and open a Unlike your saved pictures, however, when you select and open a
'starter,' you're actually creating a new drawing. Instead of being 'starter,' you're actually creating a new drawing. Instead of being
blank, though, the new drawing contains the contents of the 'starter.' blank, though, the new drawing contains the contents of the 'starter.'
Additionally, as you edit your new picture, the contents of the Additionally, as you edit your new picture, the contents of the original
original 'starter' affect it. 'starter' affect it.
Coloring-Book Style Coloring-Book Style
The most basic kind of 'starter' is similar to a picture in a The most basic kind of 'starter' is similar to a picture in a coloring
coloring book. It's an outline of a shape which you can then color book. It's an outline of a shape which you can then color in and add
in and add details to. In Tux Paint, as you draw, type text, or details to. In Tux Paint, as you draw, type text, or stamp stamps, the
stamp stamps, the outline remains 'above' what you draw. You can outline remains 'above' what you draw. You can erase the parts of the
erase the parts of the drawing you made, but you can't erase the drawing you made, but you can't erase the outline.
outline.
To create this kind of 'starter' image, simply draw an outlined To create this kind of 'starter' image, simply draw an outlined
picture in a paint program, make the rest of the graphic transparent picture in a paint program, make the rest of the graphic transparent
(that will come out as white in Tux Paint), and save it as a PNG (that will come out as white in Tux Paint), and save it as a PNG
format file. format file.
Scene-Style Scene-Style
Along with the 'coloring-book' style overlay, you can also provide a Along with the 'coloring-book' style overlay, you can also provide a
separate background image as part of a 'starter' picture. The separate background image as part of a 'starter' picture. The overlay
overlay acts the same: it can't be drawn over, erased, or affected acts the same: it can't be drawn over, erased, or affected by 'Magic'
by 'Magic' tools. However, the background can be! tools. However, the background can be!
When the 'Eraser' tool is used on a picture based on this kind of When the 'Eraser' tool is used on a picture based on this kind of
'starter' image, rather than turning the canvas white, it returns 'starter' image, rather than turning the canvas white, it returns that
that part of the canvas to the original background picture. part of the canvas to the original background picture.
By creating both an overlay and a background, you can create a By creating both an overlay and a background, you can create a
'starter' which simulates depth. Imagine a background that shows the 'starter' which simulates depth. Imagine a background that shows the
ocean, and an overlay that's a picture of a reef. You can then draw ocean, and an overlay that's a picture of a reef. You can then draw
(or stamp) fish in the picture. They'll appear in the ocean, but (or stamp) fish in the picture. They'll appear in the ocean, but never
never 'in front of' the reef. 'in front of' the reef.
To create this kind of 'starter' picture, simply create an overlay To create this kind of 'starter' picture, simply create an overlay
(with alpha transparency) as described above, and save it as a PNG. (with alpha transparency) as described above, and save it as a PNG.
Then create another image (without transparency), and save it with Then create another image (without transparency), and save it with the
the same filename, but with "-back" appended to the name. (e.g., same filename, but with "-back" appended to the name. (e.g.,
"reef-back.png" would be the background ocean picture that "reef-back.png" would be the background ocean picture that corresponds
corresponds to the "reef.png" overlay, or foreground.) to the "reef.png" overlay, or foreground.)
The 'starter' images should be the same size as Tux Paint's canvas. In The 'starter' images should be the same size as Tux Paint's canvas. In
the default 640x480 mode, that is 448x376 pixels. If you're using the default 640x480 mode, that is 448x376 pixels. If you're using
800x600 mode, it should be 608x496. (It should be 192 pixels less 800x600 mode, it should be 608x496. (It should be 192 pixels less wide,
wide, and 104 pixels less tall than the resolution.) and 104 pixels less tall than the resolution.)
Place them in the "starters" directory. When the 'Open' dialog is Place them in the "starters" directory. When the 'Open' dialog is
accessed in Tux Paint, the 'starter' images will appear at the accessed in Tux Paint, the 'starter' images will appear at the beginning
beginning of the list with a green background. of the list with a green background.
Note: 'Starters' can't be saved over from within Tux Paint, since Note: 'Starters' can't be saved over from within Tux Paint, since
loading a 'starter' is really like creating a new image. (Instead of loading a 'starter' is really like creating a new image. (Instead of
being blank, though there's already something there to work with.) The being blank, though there's already something there to work with.) The
'Save' command simply creates a new picture, like it would if the 'Save' command simply creates a new picture, like it would if the 'New'
'New' command had been used. command had been used.
Note: 'Starters' are 'attached' to saved pictures, via a small text Note: 'Starters' are 'attached' to saved pictures, via a small text file
file that has the same name as the saved file, but with ".dat" as the that has the same name as the saved file, but with ".dat" as the
extension. This allows the overlay and background, if any, to continue extension. This allows the overlay and background, if any, to continue
to affect the drawing even after Tux Paint has been quit, or another to affect the drawing even after Tux Paint has been quit, or another
picture loaded or started. (In other words, if you base a drawing on a picture loaded or started. (In other words, if you base a drawing on a
'starter' image, it will always be affected by it.) 'starter' image, it will always be affected by it.)

View file

@ -215,7 +215,19 @@ effect.</p>
<p>The file has the same name as the PNG image, but a "<code>.dat</code>" <p>The file has the same name as the PNG image, but a "<code>.dat</code>"
extension. (e.g., "<code>brush.png</code>"'s data file is the text extension. (e.g., "<code>brush.png</code>"'s data file is the text
file "<code>brush.dat</code>" in the same directory.)</p> file "<code>brush.dat</code>" in the same directory.)</p>
<h4>Brush Spacing</h4>
<blockquote>
<p>As of Tux&nbsp;Paint version 0.9.16, you can now specify the spacing
for brushes (that is, how often they are drawn). By default, the
spacing will be the brush's height, divided by 4.</p>
<p>Add a line containing the line "<code><b>spacing=<i>N</i></b></code>"
to the brush's data file, where <i>N</i> is the spacing you want
for the brush. (The lower the number, the more often the brush is
drawn.)</p>
</blockquote>
<h4>Animated Brushes</h4> <h4>Animated Brushes</h4>
<blockquote> <blockquote>
<p>As of Tux&nbsp;Paint version 0.9.16, you may now create animated <p>As of Tux&nbsp;Paint version 0.9.16, you may now create animated
@ -259,6 +271,7 @@ effect.</p>
and there are 5 frames, it would be 450x90. (The leftmost 150x90 pixels and there are 5 frames, it would be 450x90. (The leftmost 150x90 pixels
of the image represent the 9 direction shapes for the first frame, of the image represent the 9 direction shapes for the first frame,
for example.)</p> for example.)</p>
</blockquote>
</blockquote> </blockquote>
<p>Place the brush image PNGs (and any data text files) in the <p>Place the brush image PNGs (and any data text files) in the

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
June 14, 2002 - September 3, 2006 June 14, 2002 - September 4, 2006
$Id$ $Id$
*/ */
@ -949,8 +949,9 @@ static int stamp_tintable(int stamp)
static int num_brushes, num_brushes_max; static int num_brushes, num_brushes_max;
static SDL_Surface **img_brushes; static SDL_Surface **img_brushes;
static int * brushes_frames; static int * brushes_frames = NULL;
static short * brushes_directional; static int * brushes_spacing = NULL;
static short * brushes_directional = NULL;
static SDL_Surface *img_shapes[NUM_SHAPES], *img_shape_names[NUM_SHAPES]; static SDL_Surface *img_shapes[NUM_SHAPES], *img_shape_names[NUM_SHAPES];
static SDL_Surface *img_magics[NUM_MAGICS], *img_magic_names[NUM_MAGICS]; static SDL_Surface *img_magics[NUM_MAGICS], *img_magic_names[NUM_MAGICS];
@ -985,7 +986,7 @@ enum {
static SDL_Surface *img_cur_brush; static SDL_Surface *img_cur_brush;
int img_cur_brush_frame_w, img_cur_brush_w, img_cur_brush_h, int img_cur_brush_frame_w, img_cur_brush_w, img_cur_brush_h,
img_cur_brush_frames, img_cur_brush_directional; img_cur_brush_frames, img_cur_brush_directional, img_cur_brush_spacing;
static int brush_counter, rainbow_color, brush_frame; static int brush_counter, rainbow_color, brush_frame;
#define NUM_ERASERS 12 /* How many sizes of erasers #define NUM_ERASERS 12 /* How many sizes of erasers
@ -3535,7 +3536,7 @@ static void blit_brush(int x, int y, int direction)
brush_counter++; brush_counter++;
if (brush_counter >= (img_cur_brush_h / 4)) if (brush_counter >= img_cur_brush_spacing)
{ {
brush_counter = 0; brush_counter = 0;
@ -5255,6 +5256,8 @@ static void loadbrush_callback(SDL_Surface * screen,
realloc(brushes_frames, num_brushes_max * sizeof(int)); realloc(brushes_frames, num_brushes_max * sizeof(int));
brushes_directional = brushes_directional =
realloc(brushes_directional, num_brushes_max * sizeof(short)); realloc(brushes_directional, num_brushes_max * sizeof(short));
brushes_spacing =
realloc(brushes_spacing, num_brushes_max * sizeof(int));
} }
img_brushes[num_brushes] = loadimage(fname); img_brushes[num_brushes] = loadimage(fname);
@ -5263,6 +5266,7 @@ static void loadbrush_callback(SDL_Surface * screen,
brushes_frames[num_brushes] = 1; brushes_frames[num_brushes] = 1;
brushes_directional[num_brushes] = 0; brushes_directional[num_brushes] = 0;
brushes_spacing[num_brushes] = img_brushes[num_brushes]->h / 4;
strcpy(strcasestr(fname, ".png"), ".dat"); strcpy(strcasestr(fname, ".png"), ".dat");
fi = fopen(fname, "r"); fi = fopen(fname, "r");
@ -5278,6 +5282,11 @@ static void loadbrush_callback(SDL_Surface * screen,
brushes_frames[num_brushes] = brushes_frames[num_brushes] =
atoi(strstr(buf, "frames=") + 7); atoi(strstr(buf, "frames=") + 7);
} }
else if (strstr(buf, "spacing=") != NULL)
{
brushes_spacing[num_brushes] =
atoi(strstr(buf, "spacing=") + 8);
}
else if (strstr(buf, "directional") != NULL) else if (strstr(buf, "directional") != NULL)
{ {
brushes_directional[num_brushes] = 1; brushes_directional[num_brushes] = 1;
@ -8648,6 +8657,7 @@ static void render_brush(void)
img_cur_brush_h = img_cur_brush->h / (brushes_directional[cur_brush] ? 3 : 1); img_cur_brush_h = img_cur_brush->h / (brushes_directional[cur_brush] ? 3 : 1);
img_cur_brush_frames = brushes_frames[cur_brush]; img_cur_brush_frames = brushes_frames[cur_brush];
img_cur_brush_directional = brushes_directional[cur_brush]; img_cur_brush_directional = brushes_directional[cur_brush];
img_cur_brush_spacing = brushes_spacing[cur_brush];
brush_counter = 0; brush_counter = 0;
} }
@ -10585,6 +10595,7 @@ static void cleanup(void)
free_surface_array(img_brushes, num_brushes); free_surface_array(img_brushes, num_brushes);
free(brushes_frames); free(brushes_frames);
free(brushes_directional); free(brushes_directional);
free(brushes_spacing);
free_surface_array(img_tools, NUM_TOOLS); free_surface_array(img_tools, NUM_TOOLS);
free_surface_array(img_tool_names, NUM_TOOLS); free_surface_array(img_tool_names, NUM_TOOLS);
free_surface_array(img_title_names, NUM_TITLES); free_surface_array(img_title_names, NUM_TITLES);