Animated brushes can be randomized. Use "random" in its ".dat" file.
Made newly-animated spray brush random.
This commit is contained in:
parent
53b3e5a99c
commit
a52c4c3fe0
5 changed files with 34 additions and 8 deletions
|
|
@ -1 +1,2 @@
|
||||||
frames=3
|
frames=3
|
||||||
|
random
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,8 @@ $Id$
|
||||||
(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 the line "frames=N".
|
then create a ".dat" file for the brush, containing the line "frames=N".
|
||||||
|
|
||||||
|
* Animated brushes can be randomized. Use "random" in its ".dat" file.
|
||||||
|
|
||||||
* 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
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
bill@newbreedsoftware.com
|
bill@newbreedsoftware.com
|
||||||
http://www.newbreedsoftware.com/tuxpaint/
|
http://www.newbreedsoftware.com/tuxpaint/
|
||||||
|
|
||||||
June 14, 2002 - September 3, 2006
|
June 14, 2002 - September 28, 2006
|
||||||
|
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -164,6 +164,10 @@ Brushes
|
||||||
Add a line containing the line "frames=N" to the brush's data file,
|
Add a line containing the line "frames=N" to the brush's data file,
|
||||||
where N is the number of frames in the brush.
|
where N is the number of frames in the brush.
|
||||||
|
|
||||||
|
Note: If you'd rather the frames be flipped through randomly, rather
|
||||||
|
than sequentially, also add a line containing "random" to the
|
||||||
|
brush's data file.
|
||||||
|
|
||||||
Directional Brushes
|
Directional Brushes
|
||||||
|
|
||||||
As of Tux Paint version 0.9.16, you may now create directional
|
As of Tux Paint version 0.9.16, you may now create directional
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ New Breed Software</p>
|
||||||
<p><a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a><br>
|
<p><a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a><br>
|
||||||
<a href="http://www.newbreedsoftware.com/tuxpaint/">http://www.newbreedsoftware.com/tuxpaint/</a></p>
|
<a href="http://www.newbreedsoftware.com/tuxpaint/">http://www.newbreedsoftware.com/tuxpaint/</a></p>
|
||||||
|
|
||||||
<p>June 14, 2002 - September 3, 2006</p>
|
<p>June 14, 2002 - September 28, 2006</p>
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
<hr size=2 noshade>
|
<hr size=2 noshade>
|
||||||
|
|
@ -241,6 +241,10 @@ effect.</p>
|
||||||
<p>Add a line containing the line "<code><b>frames=<i>N</i></b></code>"
|
<p>Add a line containing the line "<code><b>frames=<i>N</i></b></code>"
|
||||||
to the brush's data file, where <i>N</i> is the number of frames
|
to the brush's data file, where <i>N</i> is the number of frames
|
||||||
in the brush.</p>
|
in the brush.</p>
|
||||||
|
|
||||||
|
<p><b>Note:</b> If you'd rather the frames be flipped through
|
||||||
|
randomly, rather than sequentially, also add a line containing
|
||||||
|
"<code><b>random</b></code>" to the brush's data file.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<h4>Directional Brushes</h4>
|
<h4>Directional Brushes</h4>
|
||||||
|
|
|
||||||
|
|
@ -3436,7 +3436,7 @@ static void brush_draw(int x1, int y1, int x2, int y2, int update)
|
||||||
orig_y2 = y2;
|
orig_y2 = y2;
|
||||||
|
|
||||||
|
|
||||||
frame_w = img_brushes[cur_brush]->w / brushes_frames[cur_brush];
|
frame_w = img_brushes[cur_brush]->w / abs(brushes_frames[cur_brush]);
|
||||||
w = frame_w / (brushes_directional[cur_brush] ? 3: 1);
|
w = frame_w / (brushes_directional[cur_brush] ? 3: 1);
|
||||||
h = img_brushes[cur_brush]->h / (brushes_directional[cur_brush] ? 3 : 1);
|
h = img_brushes[cur_brush]->h / (brushes_directional[cur_brush] ? 3 : 1);
|
||||||
|
|
||||||
|
|
@ -3552,9 +3552,14 @@ static void blit_brush(int x, int y, int direction)
|
||||||
{
|
{
|
||||||
brush_counter = 0;
|
brush_counter = 0;
|
||||||
|
|
||||||
brush_frame++;
|
if (img_cur_brush_frames >= 0)
|
||||||
if (brush_frame >= img_cur_brush_frames)
|
{
|
||||||
brush_frame = 0;
|
brush_frame++;
|
||||||
|
if (brush_frame >= img_cur_brush_frames)
|
||||||
|
brush_frame = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
brush_frame = rand() % abs(img_cur_brush_frames);
|
||||||
|
|
||||||
dest.x = x;
|
dest.x = x;
|
||||||
dest.y = y;
|
dest.y = y;
|
||||||
|
|
@ -5249,6 +5254,7 @@ static void loadbrush_callback(SDL_Surface * screen,
|
||||||
{
|
{
|
||||||
FILE * fi;
|
FILE * fi;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
int want_rand;
|
||||||
|
|
||||||
dirlen = dirlen;
|
dirlen = dirlen;
|
||||||
|
|
||||||
|
|
@ -5288,6 +5294,8 @@ static void loadbrush_callback(SDL_Surface * screen,
|
||||||
strcpy(strcasestr(fname, ".png"), ".dat");
|
strcpy(strcasestr(fname, ".png"), ".dat");
|
||||||
fi = fopen(fname, "r");
|
fi = fopen(fname, "r");
|
||||||
|
|
||||||
|
want_rand = 0;
|
||||||
|
|
||||||
if (fi != NULL)
|
if (fi != NULL)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
@ -5308,9 +5316,16 @@ static void loadbrush_callback(SDL_Surface * screen,
|
||||||
{
|
{
|
||||||
brushes_directional[num_brushes] = 1;
|
brushes_directional[num_brushes] = 1;
|
||||||
}
|
}
|
||||||
|
else if (strstr(buf, "random") != NULL)
|
||||||
|
{
|
||||||
|
want_rand = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (!feof(fi));
|
while (!feof(fi));
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
|
|
||||||
|
if (want_rand)
|
||||||
|
brushes_frames[num_brushes] *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
num_brushes++;
|
num_brushes++;
|
||||||
|
|
@ -7760,7 +7775,7 @@ static void draw_brushes(void)
|
||||||
src.x = 0;
|
src.x = 0;
|
||||||
src.y = brushes_directional[brush] ? (img_brushes[brush]->h / 3) : 0;
|
src.y = brushes_directional[brush] ? (img_brushes[brush]->h / 3) : 0;
|
||||||
|
|
||||||
src.w = (img_brushes[brush]->w / brushes_frames[brush]) /
|
src.w = (img_brushes[brush]->w / abs(brushes_frames[brush])) /
|
||||||
(brushes_directional[brush] ? 3 : 1);
|
(brushes_directional[brush] ? 3 : 1);
|
||||||
src.h = (img_brushes[brush]->h / (brushes_directional[brush] ? 3 : 1));
|
src.h = (img_brushes[brush]->h / (brushes_directional[brush] ? 3 : 1));
|
||||||
|
|
||||||
|
|
@ -8834,7 +8849,7 @@ static void render_brush(void)
|
||||||
SDL_UnlockSurface(img_cur_brush);
|
SDL_UnlockSurface(img_cur_brush);
|
||||||
SDL_UnlockSurface(img_brushes[cur_brush]);
|
SDL_UnlockSurface(img_brushes[cur_brush]);
|
||||||
|
|
||||||
img_cur_brush_frame_w = img_cur_brush->w / brushes_frames[cur_brush];
|
img_cur_brush_frame_w = img_cur_brush->w / abs(brushes_frames[cur_brush]);
|
||||||
img_cur_brush_w = img_cur_brush_frame_w /
|
img_cur_brush_w = img_cur_brush_frame_w /
|
||||||
(brushes_directional[cur_brush] ? 3 : 1);
|
(brushes_directional[cur_brush] ? 3 : 1);
|
||||||
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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue