WIP Rotational brushes now supported

Unlike "directional" brushes, in which a 3x3 grid representing the
8 cardinal directions (45 degree steps) is used, only a single brush
image is required, and Tux Paint will rotate it between 0 and 360 degrees,
depending on the direction the mouse is going.

The brush's ".dat" file should contain a line consisting of the word
"rotate".

Note: This adds a dependency on "SDL_gfx" library (Homepage:
https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/
SourceForge project page: https://sourceforge.net/projects/sdlgfx/)
as this feature use it's "rotozoom" functionality.

WIP -- Doesn't handle animated brushes correctly yet!

Closes https://sourceforge.net/p/tuxpaint/feature-requests/122/
This commit is contained in:
Bill Kendrick 2021-09-06 23:44:35 -07:00
parent 8a97e83a7b
commit a3080eef18
27 changed files with 316 additions and 110 deletions

View file

@ -4,7 +4,7 @@
# Various contributors (see AUTHORS.txt)
# http://www.tuxpaint.org/
# June 14, 2002 - August 14, 2021
# June 14, 2002 - September 6, 2021
# The version number, for release:
@ -285,6 +285,7 @@ CURSOR_SHAPES:=LARGE
SDL_LIBS:=$(shell $(PKG_CONFIG) $(SDL_PCNAME) --libs)
SDL_LIBS+=$(call linktest,SDL_image,-lSDL_image,$(SDL_LIBS))
SDL_LIBS+=$(call linktest,SDL_ttf,-lSDL_ttf,$(SDL_LIBS))
SDL_LIBS+=$(call linktest,SDL_gfx,-lSDL_gfx,$(SDL_LIBS))
SDL_LIBS+=$(call linktest,zlib,-lz,)
SDL_LIBS+=$(call linktest,libpng,$(PNG),)
@ -965,6 +966,7 @@ install-dlls:
cp $(MINGW_DIR)/bin/libpng12.dll $(BIN_PREFIX); \
cp $(MINGW_DIR)/bin/SDL.dll $(BIN_PREFIX); \
cp $(MINGW_DIR)/bin/SDL_image.dll $(BIN_PREFIX); \
cp $(MINGW_DIR)/bin/SDL_gfx.dll $(BIN_PREFIX); \
cp $(MINGW_DIR)/bin/SDL_mixer.dll $(BIN_PREFIX); \
cp $(MINGW_DIR)/bin/SDL_ttf.dll $(BIN_PREFIX); \
cp $(MINGW_DIR)/bin/libfreetype-6.dll $(BIN_PREFIX); \
@ -1352,6 +1354,7 @@ obj:
MAGIC_SDL_CPPFLAGS:=$(shell $(PKG_CONFIG) $(SDL_PCNAME) --cflags)
# FIXME: Expose SDL_rotozoom to Magic API? -bjk 2021.09.06
windows_MAGIC_SDL_LIBS:=-L/usr/local/lib $(LIBMINGW) $(shell $(PKG_CONFIG) $(SDL_PCNAME) --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
macos_MAGIC_SDL_LIBS:=-L/usr/local/lib $(shell $(PKG_CONFIG) $(SDL_PCNAME) --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)
ios_MAGIC_SDL_LIBS:=$(shell $(PKG_CONFIG) $(SDL_PCNAME) --libs) -lSDL_image -lSDL_ttf $(SDL_MIXER_LIB)

2
data/brushes/arrow.dat Normal file
View file

@ -0,0 +1,2 @@
rotate
spacing=60

BIN
data/brushes/arrow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View file

@ -1,2 +0,0 @@
directional
spacing=80

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -33,6 +33,23 @@ $Id$
* Other Improvements:
-------------------
* WIP Rotational brushes now supported. Unlike "directional"
brushes, in which a 3x3 grid representing the 8 cardinal
directions (45 degree steps) is used, only a single brush image
is required, and Tux Paint will rotate it between 0 and 360 degrees,
depending on the direction the mouse is going. The brush's ".dat"
file should contain a line consisting of the word "rotate".
* FIXME: WIP -- Doesn't handle animated brushes correctly!
* Note: This adds a dependency on "SDL_gfx" library
(Homepage: https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/
SourceForge project page: https://sourceforge.net/projects/sdlgfx/)
as this feature use it's "rotozoom" functionality.
(Closes https://sourceforge.net/p/tuxpaint/feature-requests/122/)
* Replaced the "arrow_compass_points" brush with a single
arrow which can rotate at any angle, using the new
"rotational" brush feature.
* Small icons appear on brush selection buttons denoting
when the brush is animated and/or directional.
(Closes https://sourceforge.net/p/tuxpaint/bugs/183/)

View file

@ -5,7 +5,7 @@
Copyright © 2002-2021 by various contributors; see AUTHORS.
http://www.tuxpaint.org/
May 31, 2021
September 6, 2021
----------------------------------------------------------------------
@ -212,17 +212,26 @@ Brushes
Add a line containing the word "directional" to the brush's data
file.
Animated Directional Brushes
Rotating Brushes
You may mix both animated and directional features into one brush.
Use both options ("frames=N" and "directional"), in separate lines
in the brush's ".dat" file.
As of Tux Paint version 0.9.27, you may now create rotating brushes.
As the brush is used, it is rotated 360 degrees, depending on the
direction the brush is going.
Lay the brush out so that each 3x3 set of directional shapes are
laid out across a wide PNG image. For example, if the brush is 30x30
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, for example.)
Add a line containing the word "rotate" to the brush's data file.
Animated Directional or Rotating Brushes
You may mix both animated and either directional or rotating
features into one brush. Use both options desired ("frames=N" and
"directional" or "rotate"), in separate lines in the brush's ".dat"
file.
For directional brushes, lay the brush out so that each 3x3 set of
directional shapes are laid out across a wide PNG image. For
example, if the brush is 30x30 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, for example.)
Place the brush image PNGs (and any data text files) in the "brushes"
directory.

View file

@ -37,9 +37,10 @@ Requirements
Lesser General Public License (LGPL).
Along with libSDL, Tux Paint depends on a number of other SDL 'helper'
libraries: SDL_Image (for graphics files), SDL_TTF and (optionally)
SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for
sound effects).
libraries: SDL_Image (for graphics files), SDL_gfx (for some graphical
functions, like rotation), SDL_TTF and (optionally) SDL_Pango (for
True Type Font support) and, optionally, SDL_Mixer (for sound
effects).
Linux/Unix Users:
@ -49,6 +50,9 @@ Requirements
* libSDL: http://www.libsdl.org/
* SDL_Image: http://www.libsdl.org/projects/SDL_image/
* SDL_gfx:
https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/
(https://sourceforge.net/projects/sdlgfx/)
* SDL_TTF: http://www.libsdl.org/projects/SDL_ttf/
* SDL_Pango: http://sourceforge.net/projects/sdlpango/ (optional)
* SDL_Mixer: http://www.libsdl.org/projects/SDL_mixer/ (optional)

View file

@ -26,7 +26,7 @@
</p>
<p>
May 31, 2021 </p>
September 6, 2021 </p>
</center>
<hr size="2"
@ -367,14 +367,25 @@
</blockquote>
<h4>
Animated Directional Brushes </h4>
Rotating Brushes </h4>
<blockquote>
<p>
You may mix both animated and directional features into one brush. Use both options ("<code><b>frames=<i>N</i></b></code>" and "<code><b>directional</b></code>"), in separate lines in the brush's "<code>.dat</code>" file. </p>
As of Tux Paint version 0.9.27, you may now create rotating brushes. As the brush is used, it is rotated 360 degrees, depending on the direction the brush is going. </p>
<p>
Lay the brush out so that each 3x3 set of directional shapes are laid out across a wide PNG image. For example, if the brush is 30x30 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, for example.) </p>
Add a line containing the word "<code><b>rotate</b></code>" to the brush's data file. </p>
</blockquote>
<h4>
Animated Directional or Rotating Brushes </h4>
<blockquote>
<p>
You may mix both animated and either directional or rotating features into one brush. Use both options desired ("<code><b>frames=<i>N</i></b></code>" and "<code><b>directional</b></code>" or "<code><b>rotate</b></code>"), in separate lines in the brush's "<code>.dat</code>" file. </p>
<p>
For directional brushes, lay the brush out so that each 3x3 set of directional shapes are laid out across a wide PNG image. For example, if the brush is 30x30 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, for example.) </p>
</blockquote>
</blockquote>

View file

@ -107,7 +107,7 @@
Tux Paint requires the Simple DirectMedia Layer Library (libSDL), an Open Source multimedia programming library available under the GNU Lesser General Public License (LGPL). </p>
<p>
Along with libSDL, Tux Paint depends on a number of other SDL 'helper' libraries: SDL_Image (for graphics files), SDL_TTF and (optionally) SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for sound effects). </p>
Along with libSDL, Tux Paint depends on a number of other SDL 'helper' libraries: SDL_Image (for graphics files), SDL_gfx (for some graphical functions, like rotation), SDL_TTF and (optionally) SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for sound effects). </p>
<h4>Linux/Unix Users:</h4>
<blockquote>
@ -116,6 +116,7 @@
<ul>
<li>libSDL: <a href="http://www.libsdl.org/">http://www.libsdl.org/</a></li>
<li>SDL_Image: <a href="http://www.libsdl.org/projects/SDL_image/">http://www.libsdl.org/projects/SDL_image/</a></li>
<li>SDL_gfx: <a href="https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/">https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/</a> (<a href="https://sourceforge.net/projects/sdlgfx/">https://sourceforge.net/projects/sdlgfx/</a>)</li>
<li>SDL_TTF: <a href="http://www.libsdl.org/projects/SDL_ttf/">http://www.libsdl.org/projects/SDL_ttf/</a></li>
<li>SDL_Pango: <a href="http://sourceforge.net/projects/sdlpango/">http://sourceforge.net/projects/sdlpango/</a> (optional)</li>
<li>SDL_Mixer: <a href="http://www.libsdl.org/projects/SDL_mixer/">http://www.libsdl.org/projects/SDL_mixer/</a> (optional)</li>

View file

@ -5,7 +5,7 @@
Copyright © 2002-2021 by various contributors; see AUTHORS.
http://www.tuxpaint.org/
mayo 31, 2021
septiembre 6, 2021
----------------------------------------------------------------------
@ -212,17 +212,26 @@ Brushes
Add a line containing the word "directional" to the brush's data
file.
Animated Directional Brushes
Rotating Brushes
You may mix both animated and directional features into one brush.
Use both options ("frames=N" and "directional"), in separate lines
in the brush's ".dat" file.
As of Tux Paint version 0.9.27, you may now create rotating brushes.
As the brush is used, it is rotated 360 degrees, depending on the
direction the brush is going.
Lay the brush out so that each 3x3 set of directional shapes are
laid out across a wide PNG image. For example, if the brush is 30x30
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, for example.)
Add a line containing the word "rotate" to the brush's data file.
Animated Directional or Rotating Brushes
You may mix both animated and either directional or rotating
features into one brush. Use both options desired ("frames=N" and
"directional" or "rotate"), in separate lines in the brush's ".dat"
file.
For directional brushes, lay the brush out so that each 3x3 set of
directional shapes are laid out across a wide PNG image. For
example, if the brush is 30x30 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, for example.)
Place the brush image PNGs (and any data text files) in the "brushes"
directory.

View file

@ -37,9 +37,10 @@ Requirements
Lesser General Public License (LGPL).
Along with libSDL, Tux Paint depends on a number of other SDL 'helper'
libraries: SDL_Image (for graphics files), SDL_TTF and (optionally)
SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for
sound effects).
libraries: SDL_Image (for graphics files), SDL_gfx (for some graphical
functions, like rotation), SDL_TTF and (optionally) SDL_Pango (for
True Type Font support) and, optionally, SDL_Mixer (for sound
effects).
Linux/Unix Users:
@ -49,6 +50,9 @@ Requirements
* libSDL: http://www.libsdl.org/
* SDL_Image: http://www.libsdl.org/projects/SDL_image/
* SDL_gfx:
https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/
(https://sourceforge.net/projects/sdlgfx/)
* SDL_TTF: http://www.libsdl.org/projects/SDL_ttf/
* SDL_Pango: http://sourceforge.net/projects/sdlpango/ (optional)
* SDL_Mixer: http://www.libsdl.org/projects/SDL_mixer/ (optional)

View file

@ -26,7 +26,7 @@
</p>
<p>
mayo 31, 2021 </p>
septiembre 6, 2021 </p>
</center>
<hr size="2"
@ -367,14 +367,25 @@
</blockquote>
<h4>
Animated Directional Brushes </h4>
Rotating Brushes </h4>
<blockquote>
<p>
You may mix both animated and directional features into one brush. Use both options ("<code><b>frames=<i>N</i></b></code>" and "<code><b>directional</b></code>"), in separate lines in the brush's "<code>.dat</code>" file. </p>
As of Tux Paint version 0.9.27, you may now create rotating brushes. As the brush is used, it is rotated 360 degrees, depending on the direction the brush is going. </p>
<p>
Lay the brush out so that each 3x3 set of directional shapes are laid out across a wide PNG image. For example, if the brush is 30x30 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, for example.) </p>
Add a line containing the word "<code><b>rotate</b></code>" to the brush's data file. </p>
</blockquote>
<h4>
Animated Directional or Rotating Brushes </h4>
<blockquote>
<p>
You may mix both animated and either directional or rotating features into one brush. Use both options desired ("<code><b>frames=<i>N</i></b></code>" and "<code><b>directional</b></code>" or "<code><b>rotate</b></code>"), in separate lines in the brush's "<code>.dat</code>" file. </p>
<p>
For directional brushes, lay the brush out so that each 3x3 set of directional shapes are laid out across a wide PNG image. For example, if the brush is 30x30 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, for example.) </p>
</blockquote>
</blockquote>

View file

@ -107,7 +107,7 @@
Tux Paint requires the Simple DirectMedia Layer Library (libSDL), an Open Source multimedia programming library available under the GNU Lesser General Public License (LGPL). </p>
<p>
Along with libSDL, Tux Paint depends on a number of other SDL 'helper' libraries: SDL_Image (for graphics files), SDL_TTF and (optionally) SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for sound effects). </p>
Along with libSDL, Tux Paint depends on a number of other SDL 'helper' libraries: SDL_Image (for graphics files), SDL_gfx (for some graphical functions, like rotation), SDL_TTF and (optionally) SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for sound effects). </p>
<h4>Linux/Unix Users:</h4>
<blockquote>
@ -116,6 +116,7 @@
<ul>
<li>libSDL: <a href="http://www.libsdl.org/">http://www.libsdl.org/</a></li>
<li>SDL_Image: <a href="http://www.libsdl.org/projects/SDL_image/">http://www.libsdl.org/projects/SDL_image/</a></li>
<li>SDL_gfx: <a href="https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/">https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/</a> (<a href="https://sourceforge.net/projects/sdlgfx/">https://sourceforge.net/projects/sdlgfx/</a>)</li>
<li>SDL_TTF: <a href="http://www.libsdl.org/projects/SDL_ttf/">http://www.libsdl.org/projects/SDL_ttf/</a></li>
<li>SDL_Pango: <a href="http://sourceforge.net/projects/sdlpango/">http://sourceforge.net/projects/sdlpango/</a> (optional)</li>
<li>SDL_Mixer: <a href="http://www.libsdl.org/projects/SDL_mixer/">http://www.libsdl.org/projects/SDL_mixer/</a> (optional)</li>

View file

@ -5,7 +5,7 @@
Copyright &copie; 2002-2021 par divers contributeurs; voir AUTHORS.
http://www.tuxpaint.org/
mai 31, 2021
septembre 6, 2021
----------------------------------------------------------------------
@ -230,17 +230,27 @@ Pinceaux
Ajoute une ligne contenant le mot "directional" au fichier de
données brosse.
Pinceaux animés orientables
Rotating Brushes
Vous pouvez mélanger animation et orientation dans un même pinceau.
Utilisez les deux options ("frames=N" et "directional") en deux
lignes séparées dans le fichier ".dat" qui concerne le pinceau.
As of Tux Paint version 0.9.27, you may now create rotating brushes.
As the brush is used, it is rotated 360 degrees, depending on the
direction the brush is going.
Disposez le pinceau de manière à ce que chaque ensemble 3x3 de
formes orientables soit disposé sur une grande image PNG. Par
exemple, si le pinceau mesure 30x30 et qu'il y a 5 cadres, ce sera
450x90. (Les 150x90 pixels les plus à gauche de l'image représentent
les 9 formes de direction pour la première image, par exemple).
Ajoute une ligne contenant le mot "rotate" au fichier de données
brosse.
Animated Directional or Rotating Brushes
You may mix both animated and either directional or rotating
features into one brush. Use both options desired ("frames=N" and
"directional" or "rotate"), in separate lines in the brush's ".dat"
file.
For directional brushes, lay the brush out so that each 3x3 set of
directional shapes are laid out across a wide PNG image. For
example, if the brush is 30x30 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, for example.)
Placez les PNG de l'image du pinceau (et tous les fichiers texte de
données) dans le répertoire "brushes".

View file

@ -36,10 +36,11 @@ Exigences
(libSDL), une bibliothèque de programmation multimédia Open Source
disponible sous la Licence publique générale limitée GNU (LGPL).
Avec libSDL, Tux Paint dépend d'un certain nombre d'autres
bibliothèques SDL : SDL_Image (pour les fichiers graphiques), SDL_TTF
et (en option) SDL_Pango (pour la prise en charge des polices True
Type) et, éventuellement, SDL_Mixer (pour les effets sonores).
Along with libSDL, Tux Paint depends on a number of other SDL 'helper'
libraries: SDL_Image (for graphics files), SDL_gfx (for some graphical
functions, like rotation), SDL_TTF and (optionally) SDL_Pango (for
True Type Font support) and, optionally, SDL_Mixer (for sound
effects).
Utilisateurs de Linux/Unix :
@ -49,6 +50,9 @@ Exigences
* libSDL: http://www.libsdl.org/
* SDL_Image: http://www.libsdl.org/projects/SDL_image/
* SDL_gfx:
https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/
(https://sourceforge.net/projects/sdlgfx/)
* SDL_TTF: http://www.libsdl.org/projects/SDL_ttf/
* SDL_Pango: http://sourceforge.net/projects/sdlpango/ (optionnel)
* SDL_Mixer: http://www.libsdl.org/projects/SDL_mixer/ (optionnel)

View file

@ -26,7 +26,7 @@
</p>
<p>
mai 31, 2021 </p>
septembre 6, 2021 </p>
</center>
<hr size="2"
@ -367,14 +367,25 @@
</blockquote>
<h4>
Pinceaux animés orientables </h4>
Rotating Brushes </h4>
<blockquote>
<p>
Vous pouvez mélanger animation et orientation dans un même pinceau. Utilisez les deux options ("<code><b>frames=<i>N</i></b></code>" et "<code><b>directional</b></code>") en deux lignes séparées dans le fichier "<code>.dat</code>" qui concerne le pinceau. </p>
As of Tux Paint version 0.9.27, you may now create rotating brushes. As the brush is used, it is rotated 360 degrees, depending on the direction the brush is going. </p>
<p>
Disposez le pinceau de manière à ce que chaque ensemble 3x3 de formes orientables soit disposé sur une grande image PNG. Par exemple, si le pinceau mesure 30x30 et qu'il y a 5 cadres, ce sera 450x90. (Les 150x90 pixels les plus à gauche de l'image représentent les 9 formes de direction pour la première image, par exemple). </p>
Ajoute une ligne contenant le mot "<code><b>rotate</b></code>" au fichier de données brosse. </p>
</blockquote>
<h4>
Animated Directional or Rotating Brushes </h4>
<blockquote>
<p>
You may mix both animated and either directional or rotating features into one brush. Use both options desired ("<code><b>frames=<i>N</i></b></code>" and "<code><b>directional</b></code>" or "<code><b>rotate</b></code>"), in separate lines in the brush's "<code>.dat</code>" file. </p>
<p>
For directional brushes, lay the brush out so that each 3x3 set of directional shapes are laid out across a wide PNG image. For example, if the brush is 30x30 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, for example.) </p>
</blockquote>
</blockquote>

View file

@ -107,7 +107,7 @@
Tux Paint nécessite la bibliothèque de couches DirectMedia simple (libSDL), une bibliothèque de programmation multimédia Open Source disponible sous la Licence publique générale limitée GNU (LGPL). </p>
<p>
Avec libSDL, Tux Paint dépend d'un certain nombre d'autres bibliothèques SDL : SDL_Image (pour les fichiers graphiques), SDL_TTF et (en option) SDL_Pango (pour la prise en charge des polices True Type) et, éventuellement, SDL_Mixer (pour les effets sonores). </p>
Along with libSDL, Tux Paint depends on a number of other SDL 'helper' libraries: SDL_Image (for graphics files), SDL_gfx (for some graphical functions, like rotation), SDL_TTF and (optionally) SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for sound effects). </p>
<h4>Utilisateurs de Linux/Unix :</h4>
<blockquote>
@ -116,6 +116,7 @@
<ul>
<li>libSDL: <a href="http://www.libsdl.org/">http://www.libsdl.org/</a></li>
<li>SDL_Image: <a href="http://www.libsdl.org/projects/SDL_image/">http://www.libsdl.org/projects/SDL_image/</a></li>
<li>SDL_gfx: <a href="https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/">https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/</a> (<a href="https://sourceforge.net/projects/sdlgfx/">https://sourceforge.net/projects/sdlgfx/</a>)</li>
<li>SDL_TTF: <a href="http://www.libsdl.org/projects/SDL_ttf/">http://www.libsdl.org/projects/SDL_ttf/</a></li>
<li>SDL_Pango: <a href="http://sourceforge.net/projects/sdlpango/">http://sourceforge.net/projects/sdlpango/</a> (optionnel)</li>
<li>SDL_Mixer: <a href="http://www.libsdl.org/projects/SDL_mixer/">http://www.libsdl.org/projects/SDL_mixer/</a> (optionnel)</li>

View file

@ -5,7 +5,7 @@
Copyright © 2002-2021 por varios colaboradores; vexa AUTHORS (AUTORES).
http://www.tuxpaint.org/
31 de Maio de 2021
6 de Setembro de 2021
----------------------------------------------------------------------
@ -221,17 +221,27 @@ Pinceis
Engada unha liña que conteña a palabra «directional» ao ficheiro de
datos debrush's.
Pinceis direccionais animados
Rotating Brushes
Pode mesturar funcións animadas e direccionais nun pincel. Use ambas
as opcións («frames=N» e «directional»), en liñas separadas no
ficheiro «.dat» do pincel.
As of Tux Paint version 0.9.27, you may now create rotating brushes.
As the brush is used, it is rotated 360 degrees, depending on the
direction the brush is going.
Coloque o pincel de xeito que cada conxunto de formas 3x3 de
dirección estea distribuído nunha ampla imaxe PNG. Por exemplo, se o
pincel ten 30x30 e hai 5 fotogramas, sería de 450x90. (Os píxeles
máis a esquerda de 150x90 da imaxe representan as 9 formas de
dirección do primeiro cadro, por exemplo).
Engada unha liña que conteña a palabra «rotate» ao ficheiro de datos
debrush's.
Animated Directional or Rotating Brushes
You may mix both animated and either directional or rotating
features into one brush. Use both options desired ("frames=N" and
"directional" or "rotate"), in separate lines in the brush's ".dat"
file.
For directional brushes, lay the brush out so that each 3x3 set of
directional shapes are laid out across a wide PNG image. For
example, if the brush is 30x30 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, for example.)
Coloque os ficheiros PNG de pincel (e calquera ficheiro de texto de
datos) no directorio «brushes».

View file

@ -36,10 +36,11 @@ Requirements
biblioteca de programación multimedia de código aberto dispoñíbel
baixo a licenza pública GNU Lesser General Public License (LGPL).
Xunto con libSDL, Tux Paint depende doutras bibliotecas «de axuda» de
SDL: SDL_Image (para ficheiros gráficos), SDL_TTF e (opcionalmente)
SDL_Pango (para compatibilidade de tipo True Type) e, opcionalmente,
SDL_Mixer (para efectos de son).
Along with libSDL, Tux Paint depends on a number of other SDL 'helper'
libraries: SDL_Image (for graphics files), SDL_gfx (for some graphical
functions, like rotation), SDL_TTF and (optionally) SDL_Pango (for
True Type Font support) and, optionally, SDL_Mixer (for sound
effects).
Usuarios de Linux/Unix:
@ -49,6 +50,9 @@ Requirements
* libSDL: http://www.libsdl.org/
* SDL_Image: http://www.libsdl.org/projects/SDL_image/
* SDL_gfx:
https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/
(https://sourceforge.net/projects/sdlgfx/)
* SDL_TTF: http://www.libsdl.org/projects/SDL_ttf/
* SDL_Pango: http://sourceforge.net/projects/sdlpango/ (opcional)
* SDL_Mixer: http://www.libsdl.org/projects/SDL_mixer/ (opcional)

View file

@ -26,7 +26,7 @@
</p>
<p>
31 de Maio de 2021 </p>
6 de Setembro de 2021 </p>
</center>
<hr size="2"
@ -367,14 +367,25 @@
</blockquote>
<h4>
Pinceis direccionais animados </h4>
Rotating Brushes </h4>
<blockquote>
<p>
Pode mesturar funcións animadas e direccionais nun pincel. Use ambas as opcións («<code><b>frames=<i>N</i></b></code>» e «<code><b>directional</b></code>»), en liñas separadas no ficheiro «<code>.dat</code>» do pincel. </p>
As of Tux Paint version 0.9.27, you may now create rotating brushes. As the brush is used, it is rotated 360 degrees, depending on the direction the brush is going. </p>
<p>
Coloque o pincel de xeito que cada conxunto de formas 3x3 de dirección estea distribuído nunha ampla imaxe PNG. Por exemplo, se o pincel ten 30x30 e hai 5 fotogramas, sería de 450x90. (Os píxeles máis a esquerda de 150x90 da imaxe representan as 9 formas de dirección do primeiro cadro, por exemplo). </p>
Engada unha liña que conteña a palabra «<code><b>rotate</b></code>» ao ficheiro de datos debrush's. </p>
</blockquote>
<h4>
Animated Directional or Rotating Brushes </h4>
<blockquote>
<p>
You may mix both animated and either directional or rotating features into one brush. Use both options desired ("<code><b>frames=<i>N</i></b></code>" and "<code><b>directional</b></code>" or "<code><b>rotate</b></code>"), in separate lines in the brush's "<code>.dat</code>" file. </p>
<p>
For directional brushes, lay the brush out so that each 3x3 set of directional shapes are laid out across a wide PNG image. For example, if the brush is 30x30 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, for example.) </p>
</blockquote>
</blockquote>

View file

@ -107,7 +107,7 @@
Tux Paint require a «Simple DirectMedia Layer Library (libSDL)», unha biblioteca de programación multimedia de código aberto dispoñíbel baixo a licenza pública GNU Lesser General Public License (LGPL). </p>
<p>
Xunto con libSDL, Tux Paint depende doutras bibliotecas «de axuda» de SDL: SDL_Image (para ficheiros gráficos), SDL_TTF e (opcionalmente) SDL_Pango (para compatibilidade de tipo True Type) e, opcionalmente, SDL_Mixer (para efectos de son). </p>
Along with libSDL, Tux Paint depends on a number of other SDL 'helper' libraries: SDL_Image (for graphics files), SDL_gfx (for some graphical functions, like rotation), SDL_TTF and (optionally) SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for sound effects). </p>
<h4>Usuarios de Linux/Unix:</h4>
<blockquote>
@ -116,6 +116,7 @@
<ul>
<li>libSDL: <a href="http://www.libsdl.org/">http://www.libsdl.org/</a></li>
<li>SDL_Image: <a href="http://www.libsdl.org/projects/SDL_image/">http://www.libsdl.org/projects/SDL_image/</a></li>
<li>SDL_gfx: <a href="https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/">https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/</a> (<a href="https://sourceforge.net/projects/sdlgfx/">https://sourceforge.net/projects/sdlgfx/</a>)</li>
<li>SDL_TTF: <a href="http://www.libsdl.org/projects/SDL_ttf/">http://www.libsdl.org/projects/SDL_ttf/</a></li>
<li>SDL_Pango: <a href="http://sourceforge.net/projects/sdlpango/">http://sourceforge.net/projects/sdlpango/</a> (opcional)</li>
<li>SDL_Mixer: <a href="http://www.libsdl.org/projects/SDL_mixer/">http://www.libsdl.org/projects/SDL_mixer/</a> (opcional)</li>

View file

@ -5,7 +5,7 @@
Copyright © 2002-2021 by various contributors; "AUTHORS" 参照.
http://www.tuxpaint.org/
2021年5月31
2021年9月 6
----------------------------------------------------------------------
@ -212,17 +212,26 @@ Brushes
Add a line containing the word "directional" to the brush's data
file.
Animated Directional Brushes
Rotating Brushes
You may mix both animated and directional features into one brush.
Use both options ("frames=N" and "directional"), in separate lines
in the brush's ".dat" file.
As of Tux Paint version 0.9.27, you may now create rotating brushes.
As the brush is used, it is rotated 360 degrees, depending on the
direction the brush is going.
Lay the brush out so that each 3x3 set of directional shapes are
laid out across a wide PNG image. For example, if the brush is 30x30
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, for example.)
Add a line containing the word "rotate" to the brush's data file.
Animated Directional or Rotating Brushes
You may mix both animated and either directional or rotating
features into one brush. Use both options desired ("frames=N" and
"directional" or "rotate"), in separate lines in the brush's ".dat"
file.
For directional brushes, lay the brush out so that each 3x3 set of
directional shapes are laid out across a wide PNG image. For
example, if the brush is 30x30 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, for example.)
Place the brush image PNGs (and any data text files) in the "brushes"
directory.

View file

@ -37,9 +37,10 @@ Requirements
Lesser General Public License (LGPL).
Along with libSDL, Tux Paint depends on a number of other SDL 'helper'
libraries: SDL_Image (for graphics files), SDL_TTF and (optionally)
SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for
sound effects).
libraries: SDL_Image (for graphics files), SDL_gfx (for some graphical
functions, like rotation), SDL_TTF and (optionally) SDL_Pango (for
True Type Font support) and, optionally, SDL_Mixer (for sound
effects).
Linux/Unix Users:
@ -49,6 +50,9 @@ Requirements
* libSDL: http://www.libsdl.org/
* SDL_Image: http://www.libsdl.org/projects/SDL_image/
* SDL_gfx:
https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/
(https://sourceforge.net/projects/sdlgfx/)
* SDL_TTF: http://www.libsdl.org/projects/SDL_ttf/
* SDL_Pango: http://sourceforge.net/projects/sdlpango/ (optional)
* SDL_Mixer: http://www.libsdl.org/projects/SDL_mixer/ (optional)

View file

@ -26,7 +26,7 @@
</p>
<p>
2021年5月31</p>
2021年9月 6</p>
</center>
<hr size="2"
@ -367,14 +367,25 @@
</blockquote>
<h4>
Animated Directional Brushes </h4>
Rotating Brushes </h4>
<blockquote>
<p>
You may mix both animated and directional features into one brush. Use both options ("<code><b>frames=<i>N</i></b></code>" and "<code><b>directional</b></code>"), in separate lines in the brush's "<code>.dat</code>" file. </p>
As of Tux Paint version 0.9.27, you may now create rotating brushes. As the brush is used, it is rotated 360 degrees, depending on the direction the brush is going. </p>
<p>
Lay the brush out so that each 3x3 set of directional shapes are laid out across a wide PNG image. For example, if the brush is 30x30 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, for example.) </p>
Add a line containing the word "<code><b>rotate</b></code>" to the brush's data file. </p>
</blockquote>
<h4>
Animated Directional or Rotating Brushes </h4>
<blockquote>
<p>
You may mix both animated and either directional or rotating features into one brush. Use both options desired ("<code><b>frames=<i>N</i></b></code>" and "<code><b>directional</b></code>" or "<code><b>rotate</b></code>"), in separate lines in the brush's "<code>.dat</code>" file. </p>
<p>
For directional brushes, lay the brush out so that each 3x3 set of directional shapes are laid out across a wide PNG image. For example, if the brush is 30x30 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, for example.) </p>
</blockquote>
</blockquote>

View file

@ -107,7 +107,7 @@
Tux Paint requires the Simple DirectMedia Layer Library (libSDL), an Open Source multimedia programming library available under the GNU Lesser General Public License (LGPL). </p>
<p>
Along with libSDL, Tux Paint depends on a number of other SDL 'helper' libraries: SDL_Image (for graphics files), SDL_TTF and (optionally) SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for sound effects). </p>
Along with libSDL, Tux Paint depends on a number of other SDL 'helper' libraries: SDL_Image (for graphics files), SDL_gfx (for some graphical functions, like rotation), SDL_TTF and (optionally) SDL_Pango (for True Type Font support) and, optionally, SDL_Mixer (for sound effects). </p>
<h4>Linux/Unix Users:</h4>
<blockquote>
@ -116,6 +116,7 @@
<ul>
<li>libSDL: <a href="http://www.libsdl.org/">http://www.libsdl.org/</a></li>
<li>SDL_Image: <a href="http://www.libsdl.org/projects/SDL_image/">http://www.libsdl.org/projects/SDL_image/</a></li>
<li>SDL_gfx: <a href="https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/">https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/</a> (<a href="https://sourceforge.net/projects/sdlgfx/">https://sourceforge.net/projects/sdlgfx/</a>)</li>
<li>SDL_TTF: <a href="http://www.libsdl.org/projects/SDL_ttf/">http://www.libsdl.org/projects/SDL_ttf/</a></li>
<li>SDL_Pango: <a href="http://sourceforge.net/projects/sdlpango/">http://sourceforge.net/projects/sdlpango/</a> (optional)</li>
<li>SDL_Mixer: <a href="http://www.libsdl.org/projects/SDL_mixer/">http://www.libsdl.org/projects/SDL_mixer/</a> (optional)</li>

View file

@ -402,6 +402,15 @@ static void mtw(wchar_t * wtok, char *tok)
#error "---------------------------------------------------"
#endif
#include "SDL_rotozoom.h"
#if !defined(_SDL_rotozoom_h)
#error "---------------------------------------------------"
#error "If you installed SDL_gfx from a package, be sure"
#error "to get the development package, as well!"
#error "(e.g., 'libsdl-gfx1.2-devel.rpm')"
#error "---------------------------------------------------"
#endif
#ifndef NO_SDLPANGO
@ -1810,6 +1819,7 @@ static SDL_Surface **img_brushes, **img_brushes_thumbs;
static int *brushes_frames = NULL;
static int *brushes_spacing = NULL;
static short *brushes_directional = NULL;
static short *brushes_rotate = NULL;
static SDL_Surface *img_shapes[NUM_SHAPES], *img_shape_names[NUM_SHAPES];
static SDL_Surface *img_fills[NUM_FILLS], *img_fill_names[NUM_FILLS];
@ -1845,7 +1855,8 @@ enum
static SDL_Surface *img_cur_brush;
static 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_spacing;
img_cur_brush_frames, img_cur_brush_directional, img_cur_brush_rotate,
img_cur_brush_spacing;
static int brush_counter, brush_frame;
#define NUM_ERASERS 16 /* How many sizes of erasers
@ -1925,7 +1936,7 @@ SDL_Joystick *joystick;
static void mainloop(void);
static void brush_draw(int x1, int y1, int x2, int y2, int update);
static void blit_brush(int x, int y, int direction);
static void blit_brush(int x, int y, int direction, int rotation, int * w, int * h);
static void stamp_draw(int x, int y);
static void rec_undo_buffer(void);
@ -5845,14 +5856,23 @@ static void brush_draw(int x1, int y1, int x2, int y2, int update)
direction = BRUSH_DIRECTION_NONE;
if (brushes_directional[cur_brush])
r = 0;
if (brushes_directional[cur_brush] || brushes_rotate[cur_brush])
{
r = brush_rotation(x1, y1, x2, y2) + 22;
if (r < 0)
r = r + 360;
r = brush_rotation(x1, y1, x2, y2);
if (x1 != x2 || y1 != y2)
direction = (r / 45);
if (brushes_directional[cur_brush])
{
r = r + 22;
if (r < 0)
r = r + 360;
if (x1 != x2 || y1 != y2)
direction = (r / 45);
}
else
{
r = 270 - r;
}
}
@ -5878,12 +5898,12 @@ static void brush_draw(int x1, int y1, int x2, int y2, int update)
if (y1 > y2)
{
for (y = y1; y >= y2; y--)
blit_brush(x1, y, direction);
blit_brush(x1, y, direction, r, &w, &h);
}
else
{
for (y = y1; y <= y2; y++)
blit_brush(x1, y, direction);
blit_brush(x1, y, direction, r, &w, &h);
}
x1 = x1 + dx;
@ -5899,7 +5919,7 @@ static void brush_draw(int x1, int y1, int x2, int y2, int update)
}
for (y = y1; y <= y2; y++)
blit_brush(x1, y, direction);
blit_brush(x1, y, direction, r, &w, &h);
}
if (orig_x1 > orig_x2)
@ -5944,9 +5964,10 @@ void reset_brush_counter(void)
*
* @param x X coordinate
* @param y Y coordinate
* @param direction BRUSH_DIRECTION_... being drawn
* @param direction BRUSH_DIRECTION_... being drawn (for compass direction brushes)
* @param rotation angle being drawn (for brushes which may rotate at any angle (0-360 degrees))
*/
static void blit_brush(int x, int y, int direction)
static void blit_brush(int x, int y, int direction, int rotation, int * w, int * h)
{
SDL_Rect src, dest;
@ -6019,8 +6040,38 @@ static void blit_brush(int x, int y, int direction)
src.w = img_cur_brush_w;
src.h = img_cur_brush_h;
SDL_BlitSurface(img_cur_brush, &src, canvas, &dest);
if (img_cur_brush_rotate)
{
SDL_Surface * rotated_brush;
/* TODO: Cache these; discard them when the user changes the brush or alters its color */
/* FIXME: Account for src being within an animated brush! */
rotated_brush = rotozoomSurface(img_cur_brush, rotation, 1.0, SMOOTHING_ON);
if (rotated_brush != NULL)
{
src.x = 0;
src.y = 0;
src.w = rotated_brush->w;
src.h = rotated_brush->h;
dest.x = dest.x - (img_cur_brush_w >> 1) + (rotated_brush->w >> 1);
dest.y = dest.y - (img_cur_brush_h >> 1) + (rotated_brush->h >> 1);
dest.w = rotated_brush->w;
dest.h = rotated_brush->h;
SDL_BlitSurface(rotated_brush, &src, canvas, &dest);
SDL_FreeSurface(rotated_brush);
}
}
else
{
SDL_BlitSurface(img_cur_brush, &src, canvas, &dest);
}
}
*w = src.w;
*h = src.h;
}
@ -6899,6 +6950,7 @@ static void loadbrush_callback(SDL_Surface * screen,
img_brushes_thumbs = realloc(img_brushes_thumbs, num_brushes_max * sizeof *img_brushes_thumbs);
brushes_frames = realloc(brushes_frames, num_brushes_max * sizeof(int));
brushes_directional = realloc(brushes_directional, num_brushes_max * sizeof(short));
brushes_rotate = realloc(brushes_rotate, num_brushes_max * sizeof(short));
brushes_spacing = realloc(brushes_spacing, num_brushes_max * sizeof(int));
}
img_brushes[num_brushes] = loadimage(fname);
@ -6907,6 +6959,7 @@ static void loadbrush_callback(SDL_Surface * screen,
brushes_frames[num_brushes] = 1;
brushes_directional[num_brushes] = 0;
brushes_rotate[num_brushes] = 0;
brushes_spacing[num_brushes] = img_brushes[num_brushes]->h / 4;
strcpy(strcasestr(fname, ".png"), ".dat"); /* FIXME: Use strncpy (ugh, complicated) */
@ -6932,6 +6985,10 @@ static void loadbrush_callback(SDL_Surface * screen,
{
brushes_directional[num_brushes] = 1;
}
else if (strstr(buf, "rotate") != NULL)
{
brushes_rotate[num_brushes] = 1;
}
else if (strstr(buf, "random") != NULL)
{
want_rand = 1;
@ -8842,7 +8899,7 @@ static void draw_brushes(void)
SDL_BlitSurface(img_brushes_thumbs[brush], &src, screen, &dest);
if (brushes_directional[brush])
if (brushes_directional[brush] || brushes_rotate[brush])
{
dest.x = ui_btn_x + button_w - img_brush_dir->w;
dest.y = ui_btn_y + button_h - img_brush_dir->h;
@ -10458,6 +10515,7 @@ static void render_brush(void)
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_directional = brushes_directional[cur_brush];
img_cur_brush_rotate = brushes_rotate[cur_brush];
img_cur_brush_spacing = brushes_spacing[cur_brush];
brush_counter = 0;
@ -13073,6 +13131,7 @@ static void cleanup(void)
free_surface_array(img_brushes_thumbs, num_brushes);
free(brushes_frames);
free(brushes_directional);
free(brushes_rotate);
free(brushes_spacing);
free_surface_array(img_tools, NUM_TOOLS);
free_surface_array(img_tool_names, NUM_TOOLS);