Began trying to describe "tinter" modes.
Noted tinter seems broken! (Always falls back to vector). Added debug printfs.
This commit is contained in:
parent
dbd91a4029
commit
f9b5f0b4bf
3 changed files with 77 additions and 28 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ New Breed Software</p>
|
|||
<p><a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a><br>
|
||||
<a href="http://www.newbreedsoftware.com/tuxpaint/">http://www.newbreedsoftware.com/tuxpaint/</a></p>
|
||||
|
||||
<p>June 14, 2002 - March 8, 2006</p>
|
||||
<p>June 14, 2002 - March 12, 2006</p>
|
||||
</center>
|
||||
|
||||
<hr size=2 noshade>
|
||||
|
|
@ -339,13 +339,13 @@ effect.</p>
|
|||
example.)</p>
|
||||
|
||||
<p>Nothing about the original image is used except the transparency
|
||||
("alpha" channel). The color of the stamp comes out solid.</p>
|
||||
(from "alpha" channel). The color of the stamp comes out solid.</p>
|
||||
|
||||
<center><img src="images/ex_colorable.png" width=74 height=92
|
||||
alt=""></center>
|
||||
|
||||
<p>Add the word "<code><b>colorable</b></code>" to the stamp's data
|
||||
file.</p>
|
||||
<p>Add a line containing the word "<code><b>colorable</b></code>"
|
||||
to the stamp's data file.</p>
|
||||
</blockquote>
|
||||
|
||||
<h5>Tinted</h5>
|
||||
|
|
@ -358,15 +358,30 @@ effect.</p>
|
|||
<center><img src="images/ex_tintable.png" width=151 height=78
|
||||
alt=""></center>
|
||||
|
||||
<p>Add the word "<code><b>tintable</b></code>" to the stamp's data
|
||||
file.</p>
|
||||
<p>Add a line containing the word "<code><b>tintable</b></code>"
|
||||
to the stamp's data file.</p>
|
||||
|
||||
<p>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 "<code><b>notintgray</b></code>"
|
||||
to the stamp's data file to accomplish this. Only areas with saturation
|
||||
over 25 % are then tinted.</p>
|
||||
<h6>Tinting Options:</h6>
|
||||
<blockquote>
|
||||
<p>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:</p>
|
||||
|
||||
<dl>
|
||||
<dt>"<code><b>tinter=normal</b></code>" (default)</dt>
|
||||
<dd>This is the normal tinting mode.</dd>
|
||||
|
||||
<dt>"<code><b>tinter=anyhue</b></code>"</dt>
|
||||
<dd>This is ???.</dd>
|
||||
|
||||
<dt>"<code><b>tinter=narrow</b></code>"</dt>
|
||||
<dd>This is ???.</dd>
|
||||
|
||||
<dt>"<code><b>tinter=vector</b></code>"</dt>
|
||||
<dd>This is ???.</dd>
|
||||
</dl>
|
||||
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
|
||||
|
|
@ -385,7 +400,7 @@ effect.</p>
|
|||
<p>To make a stamp un-flippable, add the option
|
||||
"<code><b>noflip</b></code>" to the stamp's data file.</p>
|
||||
|
||||
<p>To keep a stamp from being mirrored, add the option
|
||||
<p>To keep a stamp from being mirrored, add a line containing the word
|
||||
"<code><b>nomirror</b></code>" to the stamp's data file.</p>
|
||||
</blockquote>
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue