From 9b9fc9c8456c90b36136f1b91f6b3b1672a8fa4e Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Wed, 22 Mar 2023 00:15:07 -0700 Subject: [PATCH] New Magic: Double vision WIP - needs icon & sfx --- docs/CHANGES.txt | 9 ++++++++- magic/src/colorsep.c | 20 +++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index a83c03066..e2184d334 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -7,7 +7,7 @@ Various contributors (see below, and AUTHORS.txt) https://tuxpaint.org/ -2023.March.21 (0.9.29) ### RC2 +2023.March.22 (0.9.29) ### RC2 * Improvements to "Stamp" tool: ----------------------------- * Stamps may now be rotated. @@ -62,6 +62,13 @@ https://tuxpaint.org/ Attribution 4.0 International (CC BY 4.0) by https://freesound.org/people/juskiddink/) + * [WIP] "Double Vision" - separate and blend (50/50) the image, + simulating double vision. + Bill Kendrick + (Closes https://sourceforge.net/p/tuxpaint/feature-requests/221/) + + needs icon + + needs sound effects + * "Saturate" & "Desaturate" - Increase or decrease color saturation. Bill Kendrick (Sounds based on "can lid.wav", Creative Commons 0 (CC0 1.0) diff --git a/magic/src/colorsep.c b/magic/src/colorsep.c index e4d200450..e546d6ff5 100644 --- a/magic/src/colorsep.c +++ b/magic/src/colorsep.c @@ -3,7 +3,7 @@ Color separation effect (a la red/cyan aka red/blue 3D glasses). Bill Kendrick - Last updated: February 22, 2023 + Last updated: March 22, 2023 */ #include @@ -18,26 +18,32 @@ enum { COLORSEP_TOOL_3DGLASSES, COLORSEP_TOOL_COLORSEP, + COLORSEP_TOOL_DOUBLEVISION, NUM_TOOLS }; static char * colorsep_snd_filenames[NUM_TOOLS] = { "3dglasses.ogg", - "colorsep.ogg" + "colorsep.ogg", + "colorsep.ogg" // FIXME }; static char * colorsep_icon_filenames[NUM_TOOLS] = { "3dglasses.png", - "colorsep.png" + "colorsep.png", + "colorsep.png" // FIXME }; char * colorsep_names[NUM_TOOLS] = { gettext_noop("3D Glasses"), gettext_noop("Color Sep."), + gettext_noop("Double Vision"), }; + char * colorsep_descrs[NUM_TOOLS] = { gettext_noop("Click and drag left and right to separate your picture's red and cyan, to make anaglyphs you can view with 3D glasses!"), - gettext_noop("Click and drag to separate your picture's colors.") + gettext_noop("Click and drag to separate your picture's colors."), + gettext_noop("Click and drag to simulate double vision."), }; Mix_Chunk *snd_effects[NUM_TOOLS]; @@ -190,10 +196,14 @@ colorsep_drag(magic_api * api ATTRIBUTE_UNUSED, int which, SDL_Surface * canvas, r = r1; g = g2; b = b2; - } else { + } else if (which == COLORSEP_TOOL_COLORSEP) { r = (Uint8) ((float) r1 * colorsep_r_pct) + ((float) r2 * (1.0 - colorsep_r_pct)); g = (Uint8) ((float) g1 * colorsep_g_pct) + ((float) g2 * (1.0 - colorsep_g_pct)); b = (Uint8) ((float) b1 * colorsep_b_pct) + ((float) b2 * (1.0 - colorsep_b_pct)); + } else { /* which == COLORSEP_TOOL_DOUBLEVISION */ + r = (Uint8) ((float) r1 * 0.5) + ((float) r2 * 0.5); + g = (Uint8) ((float) g1 * 0.5) + ((float) g2 * 0.5); + b = (Uint8) ((float) b1 * 0.5) + ((float) b2 * 0.5); } api->putpixel(canvas, xx, yy, SDL_MapRGB(canvas->format, r, g, b));