Avoid alpha appearing as black in multi-frame rotated brushes

See reopened https://sourceforge.net/p/tuxpaint/bugs/259/
This commit is contained in:
Bill Kendrick 2024-10-11 00:50:44 -07:00
parent aa8db6c27d
commit b40665b2fe
2 changed files with 9 additions and 1 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2024
Various contributors (see below, and AUTHORS.txt) Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/ https://tuxpaint.org/
2024.October.10 (0.9.34) 2024.October.11 (0.9.34)
* New Magic Tools: * New Magic Tools:
---------------- ----------------
* "Comic Dots", draws repeating dots (using a multiply blend) * "Comic Dots", draws repeating dots (using a multiply blend)
@ -176,6 +176,10 @@ https://tuxpaint.org/
* Rotated brushes were positioned incorrectly. Mended. * Rotated brushes were positioned incorrectly. Mended.
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>
* Rotated multi-frame brushes would bleed black in any
transparent areas (e.g., soft edges would be black halos). Mended.
Bill Kendrick <bill@newbreedsoftware.com>
2024.July.17 (0.9.33) 2024.July.17 (0.9.33)
* New Magic Tools: * New Magic Tools:
---------------- ----------------

View file

@ -7395,6 +7395,10 @@ static void blit_brush(int x, int y, int direction, double rotation, int *w, int
if (brush_frame_surf != NULL) if (brush_frame_surf != NULL)
{ {
/* Ensure any semi-transparent areas or edges match the same color as we're painting
(and not cause a black halo; see https://sourceforge.net/p/tuxpaint/bugs/259/ -bjk 2024.10.11) */
SDL_FillRect(brush_frame_surf, NULL, SDL_MapRGBA(brush_frame_surf->format, color_hexes[cur_color][0], color_hexes[cur_color][1], color_hexes[cur_color][2], 0));
/* 2021/09/28 SDL(2)_gfxBlitRGBA() is not available in the SDL2_gfx library, using plain SDL_BlitSurface() instead. Pere /* 2021/09/28 SDL(2)_gfxBlitRGBA() is not available in the SDL2_gfx library, using plain SDL_BlitSurface() instead. Pere
SDL_gfxBlitRGBA(img_cur_brush, &src, brush_frame_surf, NULL); */ SDL_gfxBlitRGBA(img_cur_brush, &src, brush_frame_surf, NULL); */
SDL_BlitSurface(img_cur_brush, &src, brush_frame_surf, NULL); SDL_BlitSurface(img_cur_brush, &src, brush_frame_surf, NULL);