From 29306b3c55e01cc76b2ca0a4aa1f182e0559118c Mon Sep 17 00:00:00 2001 From: Karl Ove Hufthammer Date: Wed, 23 Jun 2004 18:07:37 +0000 Subject: [PATCH] Added code for not tinting low-saturation ('gray') areas on stamps with the 'notintgray' property. --- docs/CHANGES.txt | 5 ++++- src/tuxpaint.c | 25 +++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 16b3db577..ad3586a26 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -7,7 +7,10 @@ bill@newbreedsoftware.com http://www.newbreedsoftware.com/tuxpaint/ -2004.Jun.20 (0.9.14) [cvs] +2004.Jun.23 (0.9.14) [cvs] + * Fixed tinting of low-saturation stamps. + Karl Ove Hufthammer + * Improved Windows icon, based on SVG icon. Karl Ove Hufthammer diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 72b73c4f2..56674fc2d 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -410,6 +410,7 @@ typedef struct info_type { int tintable; int mirrorable; int flipable; + int tintgray; } info_type; @@ -643,6 +644,7 @@ void wait_for_sfx(void); int current_language(void); int stamp_colorable(int stamp); int stamp_tintable(int stamp); +int stamp_tintgray(int stamp); void rgbtohsv(Uint8 r8, Uint8 g8, Uint8 b8, float *h, float *s, float *v); void hsvtorgb(float h, float s, float v, Uint8 *r8, Uint8 *g8, Uint8 *b8); void show_progress_bar(void); @@ -3024,8 +3026,8 @@ void stamp_draw(int x, int y) &r, &g, &b, &a); rgbtohsv(r, g, b, &stamp_hue, &stamp_sat, &stamp_val); - - if (stamp_sat > 0.25) + + if ( stamp_tintgray(cur_stamp) || stamp_sat > 0.25 ) hsvtorgb(col_hue, col_sat, stamp_val, &r, &g, &b); // else // hsvtorgb(col_hue, col_sat, stamp_val, &r, &g, &b); @@ -5331,6 +5333,7 @@ void setup(int argc, char * argv[]) inf_stamps[i]->tintable = 0; inf_stamps[i]->colorable = 0; inf_stamps[i]->mirrorable = 1; + inf_stamps[i]->tintgray = 1; inf_stamps[i]->flipable = 1; } @@ -8154,6 +8157,7 @@ info_type * loadinfo(char * fname) inf.colorable = 0; inf.tintable = 0; inf.mirrorable = 1; + inf.tintgray = 1; inf.flipable = 1; @@ -8197,6 +8201,8 @@ info_type * loadinfo(char * fname) inf.tintable = 1; else if (strcmp(buf, "nomirror") == 0) inf.mirrorable = 0; + else if (strcmp(buf, "notintgray") == 0) + inf.tintgray = 0; else if (strcmp(buf, "noflip") == 0) inf.flipable = 0; } @@ -11353,6 +11359,21 @@ int stamp_tintable(int stamp) } +/* Returns whether low-saturation ('gray') parts of stamp can be tinted: */ + +int stamp_tintgray(int stamp) +{ + if (inf_stamps[stamp] != NULL) + { + return inf_stamps[stamp]->tintgray; + } + else + { + return 0; + } +} + + void rgbtohsv(Uint8 r8, Uint8 g8, Uint8 b8, float *h, float *s, float *v) { float rgb_min, rgb_max, delta, r, g, b;