diff --git a/docs/EXTENDING.txt b/docs/EXTENDING.txt index 29e691048..e83ced88d 100644 --- a/docs/EXTENDING.txt +++ b/docs/EXTENDING.txt @@ -8,7 +8,7 @@ bill@newbreedsoftware.com http://www.newbreedsoftware.com/tuxpaint/ - June 14, 2002 - March 8, 2006 + June 14, 2002 - March 12, 2006 -------------------------------------------------------------------------- @@ -250,9 +250,10 @@ Stamps example.) Nothing about the original image is used except the transparency - ("alpha" channel). The color of the stamp comes out solid. + (from "alpha" channel). The color of the stamp comes out solid. - Add the word "colorable" to the stamp's data file. + Add a line containing the word "colorable" to the stamp's data + file. Tinted @@ -261,13 +262,26 @@ Stamps the original image is used, but its hue is changed, based on the currently-selected color.) - Add the word "tintable" to the stamp's data file. + Add a line containing the word "tintable" to the stamp's data + file. - Sometimes you don't want the white or gray parts of an image - tinted (see for example the dry erase marker stamp in the default - stamp package). You can add the word "notintgray" to the stamp's - data file to accomplish this. Only areas with saturation over 25 % - are then tinted. + Tinting Options: + + Depending on the contents of your stamp, you might want to have + Tux Paint use one of a numer of methods when tinting it. Add one + of the following lines to the stamp's data file: + + "tinter=normal" (default) + This is the normal tinting mode. + + "tinter=anyhue" + This is ???. + + "tinter=narrow" + This is ???. + + "tinter=vector" + This is ???. Unalterable Stamps @@ -283,8 +297,8 @@ Stamps To make a stamp un-flippable, add the option "noflip" to the stamp's data file. - To keep a stamp from being mirrored, add the option "nomirror" to - the stamp's data file. + To keep a stamp from being mirrored, add a line containing the word + "nomirror" to the stamp's data file. Initial Stamp Size diff --git a/docs/html/EXTENDING.html b/docs/html/EXTENDING.html index f6022f6a9..a805fede7 100644 --- a/docs/html/EXTENDING.html +++ b/docs/html/EXTENDING.html @@ -23,7 +23,7 @@ New Breed Software

bill@newbreedsoftware.com
http://www.newbreedsoftware.com/tuxpaint/

-

June 14, 2002 - March 8, 2006

+

June 14, 2002 - March 12, 2006


@@ -339,13 +339,13 @@ effect.

example.)

Nothing about the original image is used except the transparency - ("alpha" channel). The color of the stamp comes out solid.

+ (from "alpha" channel). The color of the stamp comes out solid.

-

Add the word "colorable" to the stamp's data - file.

+

Add a line containing the word "colorable" + to the stamp's data file.

Tinted
@@ -358,15 +358,30 @@ effect.

-

Add the word "tintable" to the stamp's data - file.

+

Add a line containing the word "tintable" + to the stamp's data file.

-

Sometimes you don't want the white or gray parts of an image - tinted (see for example the dry erase marker stamp in the default - stamp package). You can add the word "notintgray" - to the stamp's data file to accomplish this. Only areas with saturation - over 25 % are then tinted.

+
Tinting Options:
+
+

Depending on the contents of your stamp, you might want to + have Tux Paint use one of a numer of methods when tinting it. + Add one of the following lines to the stamp's data file:

+
+
"tinter=normal" (default)
+
This is the normal tinting mode.
+ +
"tinter=anyhue"
+
This is ???.
+ +
"tinter=narrow"
+
This is ???.
+ +
"tinter=vector"
+
This is ???.
+
+ +
@@ -385,7 +400,7 @@ effect.

To make a stamp un-flippable, add the option "noflip" to the stamp's data file.

-

To keep a stamp from being mirrored, add the option +

To keep a stamp from being mirrored, add a line containing the word "nomirror" to the stamp's data file.

diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 8c784699b..fc431a35e 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -3413,14 +3413,20 @@ static double tint_part_1(multichan *work, SDL_Surface *in) &mc->or, &mc->og, &mc->ob, &mc->alpha); fill_multichan(mc,&u,&v); - // average out u and v, giving more weight to opaque high-saturation pixels + + // average out u and v, giving more weight to opaque + // high-saturation pixels // (this is to take an initial guess at the primary hue) + u_total += mc->alpha * u * mc->sat; v_total += mc->alpha * v * mc->sat; + } } SDL_UnlockSurface(in); + fprintf(stderr, "u_total=%f\nv_total=%f\natan2()=%f\n", + u_total, v_total, atan2(u_total, v_total)); return atan2(u_total,v_total); } @@ -3654,8 +3660,13 @@ static void tint_surface(SDL_Surface * tmp_surf, SDL_Surface * surf_ptr) { initial_hue = tint_part_1(work, surf_ptr); + printf("initial_hue = %f\n", initial_hue); + key_color_ptr = find_most_saturated(initial_hue, work, width * height, &hue_range); + + printf("key_color_ptr = %d\n", key_color_ptr); + if (key_color_ptr) { @@ -3667,14 +3678,18 @@ static void tint_surface(SDL_Surface * tmp_surf, SDL_Surface * surf_ptr) free(work); return; } + else + { + fprintf(stderr, "find_most_saturated() failed\n"); + } free(work); } /* Failed! Fall back: */ - //fprintf(stderr, "Falling back to tinter=vector, " - // "this should be in the *.dat file\n"); + fprintf(stderr, "Falling back to tinter=vector, " + "this should be in the *.dat file\n"); vector_tint_surface(tmp_surf, surf_ptr); } @@ -9268,7 +9283,9 @@ static double loadinfo(const char * const fname, stamp_type *inf) while(*cp && !isdigit(*cp)) cp++; tmp2 = strtod(cp,NULL); - if (tmp>0.0001 && tmp<10000.0 && tmp2>0.0001 && tmp2<10000.0 && tmp2/tmp>0.0001 && tmp2/tmp<10000.0) + if (tmp > 0.0001 && tmp < 10000.0 && + tmp2 > 0.0001 && tmp2 < 10000.0 && + tmp2 / tmp > 0.0001 && tmp2 / tmp < 10000.0) ratio = tmp2/tmp; } else @@ -9278,7 +9295,8 @@ static double loadinfo(const char * const fname, stamp_type *inf) ratio = 1.0 / tmp; } } - else if (!memcmp(buf, "tinter", 6) && (isspace(buf[6]) || buf[6]=='=')) + else if (!memcmp(buf, "tinter", 6) && + (isspace(buf[6]) || buf[6]=='=')) { char *cp = buf+7; while (isspace(*cp) || *cp=='=') @@ -9303,6 +9321,8 @@ static double loadinfo(const char * const fname, stamp_type *inf) { debug(cp); } + + printf("tinter=%d\n", inf->tinter); } else if (strcmp(buf, "nomirror") == 0) inf->mirrorable = 0;