Magic Bloom: Add sound effect

Source https://freesound.org/people/kentnelson64/sounds/647221/
("This work is licensed under the Creative Commons 0 License.")
This commit is contained in:
Bill Kendrick 2023-02-07 01:42:52 -08:00
parent 29d7d28614
commit 996b09e508
4 changed files with 35 additions and 22 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2023
Various contributors (see below, and CHANGES.txt) Various contributors (see below, and CHANGES.txt)
https://tuxpaint.org/ https://tuxpaint.org/
June 17, 2002 - January 30, 2023 June 17, 2002 - February 7, 2023
* Design and Coding: * Design and Coding:
@ -131,6 +131,12 @@ June 17, 2002 - January 30, 2023
(https://freesound.org/people/Kawgrim/sounds/584865/) (https://freesound.org/people/Kawgrim/sounds/584865/)
Creative Commons 0 by Kawgrim <https://freesound.org/people/Kawgrim/> Creative Commons 0 by Kawgrim <https://freesound.org/people/Kawgrim/>
Bloom magic tool
by Bill Kendrick <bill@newbreedsoftware.com>
Googly Eyes sound effect: "Torch Crackle.wav"
(https://freesound.org/people/kentnelson64/sounds/647221/)
Creative Commons 0 license by "kentnelson64"
Mouse accessibility code and keyboard access Mouse accessibility code and keyboard access
Ankit Choudary <ankit.goaldecided@gmail.com>, as part of GSOC 2010, Ankit Choudary <ankit.goaldecided@gmail.com>, as part of GSOC 2010,
with integration and fixes by Pere Pujal i Carabantes <pere@fornol.no-ip.org> with integration and fixes by Pere Pujal i Carabantes <pere@fornol.no-ip.org>

View file

@ -7,7 +7,7 @@ Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/ https://tuxpaint.org/
2023.February.6 (0.9.29) 2023.February.7 (0.9.29)
* Improvements to "Stamp" tool: * Improvements to "Stamp" tool:
----------------------------- -----------------------------
* Stamps may now be rotated. * Stamps may now be rotated.
@ -44,9 +44,8 @@ https://tuxpaint.org/
* "Bloom" - Apply a glowing light bloom effect to the image. * "Bloom" - Apply a glowing light bloom effect to the image.
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>
(Sound effected licensed as Creative Commons 0 (CC0 1.0)
[WIP] - Bloom icon needed by https://freesound.org/people/kentnelson64/)
[WIP] - Bloom sound effect needed
* [WIP] "Rivulet"; apply rivulets of water to the canvas * [WIP] "Rivulet"; apply rivulets of water to the canvas
- needs better icon - needs better icon

BIN
magic/sounds/bloom.ogg Normal file

Binary file not shown.

View file

@ -64,6 +64,9 @@ void bloom_line_callback_drag(void *ptr, int which, SDL_Surface * canvas,
void bloom_release(magic_api * api, int which, SDL_Surface * canvas, void bloom_release(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int x, int y, SDL_Surface * snapshot, int x, int y,
SDL_Rect * update_rect); SDL_Rect * update_rect);
void bloom_apply_effect(magic_api * api,
SDL_Surface * canvas,
SDL_Surface * snapshot);
void bloom_switchin(magic_api * api, int which, int mode, void bloom_switchin(magic_api * api, int which, int mode,
SDL_Surface * canvas); SDL_Surface * canvas);
void bloom_switchout(magic_api * api, int which, int mode, void bloom_switchout(magic_api * api, int which, int mode,
@ -83,7 +86,7 @@ int bloom_init(magic_api * api)
snprintf(fname, sizeof(fname), "%ssounds/magic/bloom.ogg", snprintf(fname, sizeof(fname), "%ssounds/magic/bloom.ogg",
api->data_directory); api->data_directory);
snd_effects = NULL; /* FIXME Mix_LoadWAV(fname); */ snd_effects = Mix_LoadWAV(fname);
bloom_scale = sqrt(2 * (BLOOM_PAINT_RADIUS * BLOOM_PAINT_RADIUS)); bloom_scale = sqrt(2 * (BLOOM_PAINT_RADIUS * BLOOM_PAINT_RADIUS));
@ -172,8 +175,7 @@ bloom_click(magic_api * api, int which, int mode,
} }
memset(bloom_mask, 128, (canvas->w * canvas->h)); memset(bloom_mask, 128, (canvas->w * canvas->h));
bloom_release(api, which, canvas, snapshot, x, y, bloom_apply_effect(api, canvas, snapshot);
update_rect);
update_rect->x = 0; update_rect->x = 0;
update_rect->y = 0; update_rect->y = 0;
@ -202,22 +204,33 @@ bloom_drag(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Sur
void bloom_release(magic_api * api, int which ATTRIBUTE_UNUSED, void bloom_release(magic_api * api, int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * canvas,
SDL_Surface * snapshot ATTRIBUTE_UNUSED, SDL_Surface * snapshot,
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
SDL_Rect * update_rect ATTRIBUTE_UNUSED) { SDL_Rect * update_rect) {
int sample, offset, offset_flip, xx, yy;
Uint8 r, g, b;
float rf, gf, bf, mask_weight, lum;
float sums[3];
Uint32 color;
if (bloom_mask == NULL) if (bloom_mask == NULL)
return; return;
if (snd_effects != NULL) if (snd_effects != NULL)
api->stopsound(); api->stopsound();
bloom_apply_effect(api, canvas, snapshot);
update_rect->x = 0;
update_rect->y = 0;
update_rect->w = canvas->w;
update_rect->h = canvas->h;
}
void bloom_apply_effect(magic_api * api,
SDL_Surface * canvas,
SDL_Surface * snapshot) {
int sample, offset, offset_flip, x, y, xx, yy;
Uint8 r, g, b;
float rf, gf, bf, mask_weight, lum;
float sums[3];
Uint32 color;
SDL_BlitSurface(snapshot, NULL, canvas, NULL); SDL_BlitSurface(snapshot, NULL, canvas, NULL);
for (y = 0; y < canvas->h; y++) { for (y = 0; y < canvas->h; y++) {
@ -296,11 +309,6 @@ void bloom_release(magic_api * api, int which ATTRIBUTE_UNUSED,
} }
} }
} }
update_rect->x = 0;
update_rect->y = 0;
update_rect->w = canvas->w;
update_rect->h = canvas->h;
} }