Animated brushes can rotate now
Takes advantage of SDL_gfxBlitRGBA(), also from SDL_gfx.
This commit is contained in:
parent
cba6f45772
commit
3487236f93
2 changed files with 30 additions and 7 deletions
|
|
@ -8,7 +8,7 @@ http://www.tuxpaint.org/
|
|||
|
||||
$Id$
|
||||
|
||||
2021.September.6 (0.9.27)
|
||||
2021.September.8 (0.9.27)
|
||||
* New Magic Tools:
|
||||
----------------
|
||||
* "Opposite" -- Change parts of the picture to their complementary
|
||||
|
|
@ -33,17 +33,16 @@ $Id$
|
|||
|
||||
* Other Improvements:
|
||||
-------------------
|
||||
* WIP Rotational brushes now supported. Unlike "directional"
|
||||
* 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.
|
||||
as this feature use it's "rotozoomSurface()" and "SDL_gfxBlitRGBA()".
|
||||
(Closes https://sourceforge.net/p/tuxpaint/feature-requests/122/)
|
||||
|
||||
* Replaced the "arrow_compass_points" brush with a single
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
June 14, 2002 - September 6, 2021
|
||||
June 14, 2002 - September 8, 2021
|
||||
*/
|
||||
|
||||
#include "platform.h"
|
||||
|
|
@ -6045,8 +6045,32 @@ static void blit_brush(int x, int y, int direction, int rotation, int * w, int *
|
|||
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);
|
||||
|
||||
rotated_brush = NULL;
|
||||
|
||||
if (img_cur_brush_frames != 1)
|
||||
{
|
||||
SDL_Surface * brush_frame_surf;
|
||||
|
||||
brush_frame_surf =
|
||||
SDL_CreateRGBSurface(img_cur_brush->flags,
|
||||
src.w,
|
||||
src.h,
|
||||
img_cur_brush->format->BitsPerPixel,
|
||||
img_cur_brush->format->Rmask, img_cur_brush->format->Gmask, img_cur_brush->format->Bmask,
|
||||
img_cur_brush->format->Amask);
|
||||
if (brush_frame_surf != NULL)
|
||||
{
|
||||
SDL_gfxBlitRGBA(img_cur_brush, &src, brush_frame_surf, NULL);
|
||||
rotated_brush = rotozoomSurface(brush_frame_surf, rotation, 1.0, SMOOTHING_ON);
|
||||
SDL_FreeSurface(brush_frame_surf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rotated_brush = rotozoomSurface(img_cur_brush, rotation, 1.0, SMOOTHING_ON);
|
||||
}
|
||||
|
||||
if (rotated_brush != NULL)
|
||||
{
|
||||
src.x = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue