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)
https://tuxpaint.org/
June 17, 2002 - January 30, 2023
June 17, 2002 - February 7, 2023
* Design and Coding:
@ -131,6 +131,12 @@ June 17, 2002 - January 30, 2023
(https://freesound.org/people/Kawgrim/sounds/584865/)
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
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>

View file

@ -7,7 +7,7 @@ Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/
2023.February.6 (0.9.29)
2023.February.7 (0.9.29)
* Improvements to "Stamp" tool:
-----------------------------
* Stamps may now be rotated.
@ -44,9 +44,8 @@ https://tuxpaint.org/
* "Bloom" - Apply a glowing light bloom effect to the image.
Bill Kendrick <bill@newbreedsoftware.com>
[WIP] - Bloom icon needed
[WIP] - Bloom sound effect needed
(Sound effected licensed as Creative Commons 0 (CC0 1.0)
by https://freesound.org/people/kentnelson64/)
* [WIP] "Rivulet"; apply rivulets of water to the canvas
- 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,
SDL_Surface * snapshot, int x, int y,
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,
SDL_Surface * canvas);
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",
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));
@ -172,8 +175,7 @@ bloom_click(magic_api * api, int which, int mode,
}
memset(bloom_mask, 128, (canvas->w * canvas->h));
bloom_release(api, which, canvas, snapshot, x, y,
update_rect);
bloom_apply_effect(api, canvas, snapshot);
update_rect->x = 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,
SDL_Surface * canvas ATTRIBUTE_UNUSED,
SDL_Surface * snapshot ATTRIBUTE_UNUSED,
SDL_Surface * canvas,
SDL_Surface * snapshot,
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
SDL_Rect * update_rect ATTRIBUTE_UNUSED) {
int sample, offset, offset_flip, xx, yy;
Uint8 r, g, b;
float rf, gf, bf, mask_weight, lum;
float sums[3];
Uint32 color;
SDL_Rect * update_rect) {
if (bloom_mask == NULL)
return;
if (snd_effects != NULL)
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);
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;
}