3D Glasses - Now offers various anaglyph color combos
The size option is being misused to allow different color combinations: Red/Cyan, Red/Blue, Red/Green, and Magenta/Cyan (there are others we could add, if only someone could figure out the math :-D) Note - If Tux Paint is running in "Novice" complexity mode, no choices will be available; it will use Red/Cyan, as before. h/t O'Hare The Rabbit for the idea
This commit is contained in:
parent
a655146677
commit
d95e7084df
3 changed files with 112 additions and 15 deletions
|
|
@ -6,7 +6,7 @@ Copyright (c) 2002-2024
|
|||
Various contributors (see below, and AUTHORS.txt)
|
||||
https://tuxpaint.org/
|
||||
|
||||
2024.April.27 (0.9.33)
|
||||
2024.April.28 (0.9.33)
|
||||
* New Magic Tools:
|
||||
----------------
|
||||
* WIP Specular Reflection: Draws a slightly blurred, wavy, and
|
||||
|
|
@ -32,6 +32,15 @@ https://tuxpaint.org/
|
|||
+ WIP Needs sound effect
|
||||
+ WIP Needs testing & tweaking
|
||||
|
||||
* Magic Tool Improvements:
|
||||
------------------------
|
||||
* 3D Glasses - Now offers different color separation variations
|
||||
(via the size option): Red/Cyan, Red/Blue, Red/Green, and Magenta/Cyan.
|
||||
(If Tux Paint is running in "Novice" complexity mode, no choices will
|
||||
be available; it will use Red/Cyan, as before.)
|
||||
+ Idea O'Hare The Rabbit
|
||||
+ Coding Bill Kendrick <bill@newbreedsoftware.com>
|
||||
|
||||
* Improvements to Eraser tool:
|
||||
----------------------------
|
||||
* Transparent erasers
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
/* colorsep.c
|
||||
|
||||
Color separation effect (a la red/cyan aka red/blue 3D glasses).
|
||||
Bill Kendrick
|
||||
by Bill Kendrick
|
||||
|
||||
Last updated: January 16, 2024
|
||||
Different 3D Glasses variations suggested by O'Hare The Rabbit
|
||||
|
||||
Last updated: February 28, 2024
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -43,14 +45,32 @@ char *colorsep_names[NUM_TOOLS] = {
|
|||
|
||||
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!"),
|
||||
("Click and drag left and right to separate your picture's red and cyan, to make anaglyphs you can view with 3D glasses! Use the size option to choose different types."),
|
||||
gettext_noop("Click and drag to separate your picture's colors."),
|
||||
gettext_noop("Click and drag to simulate double vision."),
|
||||
};
|
||||
|
||||
char *colorsep_descr_anaglyph_simple =
|
||||
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!");
|
||||
|
||||
Mix_Chunk *snd_effects[NUM_TOOLS];
|
||||
int colorsep_click_x, colorsep_click_y;
|
||||
float colorsep_r_pct, colorsep_g_pct, colorsep_b_pct;
|
||||
int colorsep_complexity;
|
||||
|
||||
/* 3D Glasses mode (except in Novice complexity setting)
|
||||
offers different variations
|
||||
(Suggested by O'Hare The Rabbit) */
|
||||
enum {
|
||||
COLORSEP_3DGLASS_VARIATION_RED_CYAN, // default; and the only option in Novice complexity
|
||||
COLORSEP_3DGLASS_VARIATION_RED_BLUE,
|
||||
// COLORSEP_3DGLASS_VARIATION_ANACHROME, // dark red / dark blue
|
||||
COLORSEP_3DGLASS_VARIATION_RED_GREEN,
|
||||
COLORSEP_3DGLASS_VARIATION_MAGENTA_CYAN,
|
||||
NUM_COLORSEP_3DGLASS_VARIATIONS
|
||||
};
|
||||
int colorsep_3dglass_variation = COLORSEP_3DGLASS_VARIATION_RED_CYAN;
|
||||
|
||||
Uint32 colorsep_api_version(void);
|
||||
int colorsep_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level);
|
||||
|
|
@ -87,7 +107,7 @@ Uint32 colorsep_api_version(void)
|
|||
return (TP_MAGIC_API_VERSION);
|
||||
}
|
||||
|
||||
int colorsep_init(magic_api * api, Uint8 disabled_features ATTRIBUTE_UNUSED, Uint8 complexity_level ATTRIBUTE_UNUSED)
|
||||
int colorsep_init(magic_api * api, Uint8 disabled_features ATTRIBUTE_UNUSED, Uint8 complexity_level)
|
||||
{
|
||||
int i;
|
||||
char fname[1024];
|
||||
|
|
@ -98,6 +118,8 @@ int colorsep_init(magic_api * api, Uint8 disabled_features ATTRIBUTE_UNUSED, Uin
|
|||
snd_effects[i] = Mix_LoadWAV(fname);
|
||||
}
|
||||
|
||||
colorsep_complexity = complexity_level;
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +155,11 @@ int colorsep_get_order(int which)
|
|||
|
||||
char *colorsep_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return strdup(gettext(colorsep_descrs[which]));
|
||||
if (which == COLORSEP_TOOL_3DGLASSES && colorsep_complexity == MAGIC_COMPLEXITY_NOVICE) {
|
||||
return strdup(colorsep_descr_anaglyph_simple);
|
||||
} else {
|
||||
return strdup(gettext(colorsep_descrs[which]));
|
||||
}
|
||||
}
|
||||
|
||||
int colorsep_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
|
|
@ -226,10 +252,62 @@ void colorsep_apply(magic_api * api, int which, SDL_Surface * canvas,
|
|||
|
||||
if (which == COLORSEP_TOOL_3DGLASSES)
|
||||
{
|
||||
/* Split red aparet from green & blue (cyan) */
|
||||
r = r1;
|
||||
g = g2;
|
||||
b = b2;
|
||||
r = g = b = 128;
|
||||
|
||||
if (colorsep_3dglass_variation == COLORSEP_3DGLASS_VARIATION_RED_CYAN) {
|
||||
/* Split red apart from green & blue (cyan) */
|
||||
/* RR GG BB */
|
||||
/* 1 2 2 */
|
||||
|
||||
// red
|
||||
r = r1;
|
||||
|
||||
// cyan
|
||||
g = g2;
|
||||
b = b2;
|
||||
} else if (colorsep_3dglass_variation == COLORSEP_3DGLASS_VARIATION_RED_BLUE) {
|
||||
/* Split red apart blue */
|
||||
/* RR GG BB */
|
||||
/* 1 12 2 */
|
||||
|
||||
// red
|
||||
r = r1;
|
||||
|
||||
// blue
|
||||
b = b2;
|
||||
|
||||
// green shared
|
||||
g = (g1 + g2) / 2;
|
||||
// } else if (colorsep_3dglass_variation == COLORSEP_3DGLASS_VARIATION_ANACHROME) { /* FIXME */
|
||||
// /* Split dark red apart from dark blue */
|
||||
// /* RR GG BB */
|
||||
// /* 1 2 12 */
|
||||
//
|
||||
// r = r1 / 2;
|
||||
// g = (g1 + g2 + r1 + b2) / 4;
|
||||
// b = b1 / 2;
|
||||
} else if (colorsep_3dglass_variation == COLORSEP_3DGLASS_VARIATION_RED_GREEN) {
|
||||
/* Split red apart green */
|
||||
/* RR GG BB */
|
||||
/* 1 2 12 */
|
||||
|
||||
// red
|
||||
r = r1;
|
||||
|
||||
// green
|
||||
g = g2;
|
||||
|
||||
// blue shared
|
||||
b = (b1 + b2) / 2;
|
||||
} else if (colorsep_3dglass_variation == COLORSEP_3DGLASS_VARIATION_MAGENTA_CYAN) {
|
||||
/* Split magenta apart from cyan */
|
||||
/* RR GG BB */
|
||||
/* 1 2 12 */
|
||||
|
||||
r = r1;
|
||||
g = g2;
|
||||
b = max(b1, b2);
|
||||
}
|
||||
}
|
||||
else if (which == COLORSEP_TOOL_COLORSEP)
|
||||
{
|
||||
|
|
@ -314,19 +392,28 @@ void colorsep_switchout(magic_api * api ATTRIBUTE_UNUSED,
|
|||
{
|
||||
}
|
||||
|
||||
Uint8 colorsep_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
Uint8 colorsep_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
if (which == COLORSEP_TOOL_3DGLASSES && colorsep_complexity > MAGIC_COMPLEXITY_NOVICE) {
|
||||
/* 3D Glasses mode (in all complexity levels except novice)
|
||||
uses (abuses) the size option to change styles */
|
||||
return NUM_COLORSEP_3DGLASS_VARIATIONS;
|
||||
} else {
|
||||
/* All other tools (and 3D Glasses in novice complexity)
|
||||
do not use the size option */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Uint8 colorsep_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
return COLORSEP_3DGLASS_VARIATION_RED_CYAN;
|
||||
}
|
||||
|
||||
|
||||
void colorsep_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
Uint8 size ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
Uint8 size, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
colorsep_3dglass_variation = (size - 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,11 +47,12 @@
|
|||
</screenshot>
|
||||
</screenshots>
|
||||
<releases>
|
||||
<release version="0.9.33" date="2024-04-08">
|
||||
<release version="0.9.33" date="2024-04-28">
|
||||
<description>
|
||||
<p>Transparent Erasers.</p>
|
||||
<p>Brushes support descriptions.</p>
|
||||
<p>New Magic tools: Dither, Specular, Filled Polygon.</p>
|
||||
<p>Updated Magic tools: 3D Glasses (now offers different anaglyph color combinations).</p>
|
||||
<p>Magic tools may be ungrouped ("ungroupmagictools").</p>
|
||||
<p>Localization updates.</p>
|
||||
</description>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue