Re: [Tuxpaint-dev] [PATCH] new tinter

2004-11-25 Thread Albert Cahalan
On Thu, 2004-11-25 at 15:46, Albert Cahalan wrote:
> On Thu, 2004-11-25 at 14:50, Karl Ove Hufthammer wrote:
 
> > I got an error message while trying to apply it for tuxpaint.c.
> > Could you try resending it, now as a an attachment (line-breaking
> > in e-mail programs easily mangles patches) and diffed against
> > latest CVS version?
> 
> Don't cut-and-paste. Save the email, then run the whole
> thing through patch. If you still get an error, check to
> be sure that some lame "helpful" mail gateway hasn't
> decided to "prevent damage" by using printed-quotable
> MIME encoding. Never use such evil mail gateways.
> 
> Remember:
> 
> cd root-of-tuxpaint-source
> patch -s -E -p1 < path-to-this-email
> 
> Use the --dry-run option if you want to check first.

The patch came back to me OK. It applies without complaint.


___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev


Re: [Tuxpaint-dev] Tux Paint 0.9.14 in LockerGnome

2004-11-25 Thread Albert Cahalan
On Thu, 2004-11-25 at 16:08, Bill Kendrick wrote:
> On Thu, Nov 25, 2004 at 03:52:27PM -0500, Albert Cahalan wrote:
> > On Thu, 2004-11-25 at 15:58, Bill Kendrick wrote:
> > > Cool, check it out! ;)
> > 
> > They claim Tux Paint requires Win98/2k/XP. They only
> > provide a link to a Microsoft Windows installer.
> > They don't even mention the Mac port, much less the
> > Linux port or anything weird.
> 
> Well, admittedly, it /was/ in their "Windows" section.
> It also came via a Windows freeware/shareware site that I submitted to.
> 
> 
> This is nothing compared to the utter frustration that TUCOWS has been.
> An ancient version of Tux Paint for Linux is listed in their Linux section.
> No version is in their Mac section.  No version is in their Windows section.
> I submitted 0.9.14 to their BeOS section and it was up within a few days.

I can't tell if it does, but the Windows installer could
mention that Tux Paint is available for less-infested OSes.
Computer labs without porno pop-up windows are possible.


___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev


Re: [Tuxpaint-dev] Tux Paint 0.9.14 in LockerGnome

2004-11-25 Thread Bill Kendrick
On Thu, Nov 25, 2004 at 03:52:27PM -0500, Albert Cahalan wrote:
> On Thu, 2004-11-25 at 15:58, Bill Kendrick wrote:
> > Cool, check it out! ;)
> 
> They claim Tux Paint requires Win98/2k/XP. They only
> provide a link to a Microsoft Windows installer.
> They don't even mention the Mac port, much less the
> Linux port or anything weird.

Well, admittedly, it /was/ in their "Windows" section.
It also came via a Windows freeware/shareware site that I submitted to.


This is nothing compared to the utter frustration that TUCOWS has been.
An ancient version of Tux Paint for Linux is listed in their Linux section.
No version is in their Mac section.  No version is in their Windows section.
I submitted 0.9.14 to their BeOS section and it was up within a few days.

>:^(

-bill!
___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev


Re: [Tuxpaint-dev] Tux Paint 0.9.14 in LockerGnome

2004-11-25 Thread Albert Cahalan
On Thu, 2004-11-25 at 15:58, Bill Kendrick wrote:
> Cool, check it out! ;)

They claim Tux Paint requires Win98/2k/XP. They only
provide a link to a Microsoft Windows installer.
They don't even mention the Mac port, much less the
Linux port or anything weird.

This is not helping. :-(


___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev


Re: [Tuxpaint-dev] [PATCH] misc fixes

2004-11-25 Thread Bill Kendrick
On Thu, Nov 25, 2004 at 09:06:17PM +0100, Karl Ove Hufthammer wrote:
> (Of course people who still insist on limiting their colour vision
> to 16 bit will get the same awful banding as before. Yes, that
> means you, Bill ... ;)

Hey, my 'top of the line' PC is from 5-6 years ago. :^P

-bill!
___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev


Re: [Tuxpaint-dev] [PATCH] new tinter

2004-11-25 Thread Albert Cahalan
On Thu, 2004-11-25 at 14:50, Karl Ove Hufthammer wrote:
> Albert Cahalan <[EMAIL PROTECTED]> wrote in
> news:[EMAIL PROTECTED]:
> 
> > On Thu, 2004-11-25 at 00:49, Albert Cahalan wrote:
> >> To show off the new tinter, the enclosed patch restores
> >> the original purple. Yellow is much, much, nicer with this
> >> new tinter.
> >
> > So... anybody try it? Any objections? Good? Bad?
> 
> I got an error message while trying to apply it for tuxpaint.c.
> Could you try resending it, now as a an attachment (line-breaking
> in e-mail programs easily mangles patches) and diffed against
> latest CVS version?

Don't cut-and-paste. Save the email, then run the whole
thing through patch. If you still get an error, check to
be sure that some lame "helpful" mail gateway hasn't
decided to "prevent damage" by using printed-quotable
MIME encoding. Never use such evil mail gateways.

Remember:

cd root-of-tuxpaint-source
patch -s -E -p1 < path-to-this-email

Use the --dry-run option if you want to check first.

> But I have one comment. As far as I can see, you have completely
> removed the notintgray feature. We do really *not* want to try to
> be clever and (by default) only render parts of a stamp which has
> the same hue. This has lead to problems in the past.
> 
> (But if a stamp require not tinting 'grey' parts, the 'notintgray'
> option should still be available.)

If there are problems, I'll deal with them.

I don't special-case grey. Tinting grey is a no-op.
I can change the hue, but that means nothing. Here's
what happens to it:

double u = sat * sin(mc->hue);
double v = sat * cos(mc->hue);
double L = mc->L;

As you may guess, "sat" is the saturation, which will be 0.0
for grey. So the hue doesn't matter. Both u and v become 0.0.

I'll try again with a patch in the body. This needs to work.
Attachments are hard to quote in email responses. Speaking
of which, this mailing list makes my "reply" and "group reply"
buttons to the same thing, limiting my communication choices.

-- the patch -

diff -Naurd t2/src/colors.h tx/src/colors.h
--- t2/src/colors.h 2004-11-22 20:28:45.0 -0500
+++ tx/src/colors.h 2004-11-25 00:18:52.0 -0500
@@ -52,7 +52,7 @@
   { 33, 148,  33}, /* Green */
   {138, 168, 205}, /* Sky blue */
   {  0,   0, 255}, /* Blue */
-  { 96,   0, 128}, /* Purple */
+  {128,   0, 128}, /* Purple */
   {255,   0, 255}, /* Magenta */
   {128,  96,   0}, /* Brown */
   {226, 189, 166}, /* Tan */
diff -Naurd t2/src/tuxpaint.c tx/src/tuxpaint.c
--- t2/src/tuxpaint.c   2004-11-24 18:35:15.0 -0500
+++ tx/src/tuxpaint.c   2004-11-25 00:31:35.0 -0500
@@ -3009,58 +3009,266 @@
 }
 
 
+//
+// stamp tinter
+
 typedef struct multichan {
   double r,g,b; // linear
   double L,u,v; // L,a,b would be better -- 2-way formula unknown
   double hue,sat;
-  unsigned char or,og,ob,oa; // old 8-bit sRGB values
-  unsigned char nr,ng,nb,na; // new 8-bit sRGB values
+  unsigned char or,og,ob; // old 8-bit sRGB values
+  unsigned char nr,ng,nb; // new 8-bit sRGB values
+  unsigned char alpha;// 8-bit alpha value
 } multichan;
 
+#define X0 ((double)0.9505)
+#define Y0 ((double)1.)
+#define Z0 ((double)1.0890)
+#define u0_prime ( (4.0 * X0) / (X0 + 15.0*Y0 + 3.0*Z0) )
+#define v0_prime ( (9.0 * Y0) / (X0 + 15.0*Y0 + 3.0*Z0) )
+
+static void fill_multichan(multichan *mc)
+{
+  double tmp,X,Y,Z;
+  double u_prime, v_prime; /* temp, part of official formula */
+  double Y_norm, fract; /* severely temp */
+
+  // from 8-bit sRGB to linear RGB
+  tmp = mc->or / 255.0;
+  mc->r = (tmp<=0.03928) ? tmp/12.92 : pow((tmp+0.055)/1.055,2.4);
+  tmp = mc->og / 255.0;
+  mc->g = (tmp<=0.03928) ? tmp/12.92 : pow((tmp+0.055)/1.055,2.4);
+  tmp = mc->ob / 255.0;
+  mc->b = (tmp<=0.03928) ? tmp/12.92 : pow((tmp+0.055)/1.055,2.4);
+
+  // coordinate change, RGB --> XYZ
+  X = 0.4124*mc->r + 0.3576*mc->g + 0.1805*mc->b;
+  Y = 0.2126*mc->r + 0.7152*mc->g + 0.0722*mc->b;
+  Z = 0.0193*mc->r + 0.1192*mc->g + 0.9505*mc->b;
+  
+  // XYZ --> Luv
+  Y_norm = Y/Y0;
+  fract = 1.0 / (X + 15.0*Y + 3.0*Z);
+  u_prime = 4.0*X*fract;
+  v_prime = 9.0*Y*fract;
+  mc->L = (Y_norm>0.008856) ? 116.0*pow(Y_norm,1.0/3.0)-16.0 : 903.3*Y_norm;
+  mc->u = 13.0*mc->L*(u_prime - u0_prime);
+  mc->v = 13.0*mc->L*(v_prime - v0_prime);
+
+  mc->sat = sqrt(mc->u*mc->u + mc->v*mc->v);
+  mc->hue = atan2(mc->u,mc->v);
+}
+
 static void tint_surface(SDL_Surface * tmp_surf, SDL_Surface * surf_ptr)
 {
+  unsigned i;
+  int xx, yy;
 
-  float col_hue, col_sat, col_val,
-stamp_hue, stamp_sat, stamp_val;
+  unsigned width = surf_ptr->w;
+  unsigned height = surf_ptr->h;
 
-  Uint8 r, g, b, a;
-int xx, yy;
+  multichan *work = malloc(sizeof *work * width * height);
  
-  rgbtohsv(color_hexes[cur_color][0],
-  color_hexes[cur_color][1],
-  color_hexes[cur_color][2],
-  &col_hue, &col_sat, &col_val);
-

[Tuxpaint-dev] Tux Paint 0.9.14 in LockerGnome

2004-11-25 Thread Bill Kendrick

Cool, check it out! ;)

http://channels.lockergnome.com/windows/archives/20041124_tux_paint_v0914.phtml

(Looks like they found it through SnapFiles, though, which is a site I
found and specifically submitted Tux Paint to.)

-bill!
[EMAIL PROTECTED]   Have I been helpful?
http://newbreedsoftware.com/http://svcs.affero.net/rm.php?r=billkendrick
___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev


Re: [Tuxpaint-dev] high-resolution stamps work now

2004-11-25 Thread Albert Cahalan
On Thu, 2004-11-25 at 14:59, Karl Ove Hufthammer wrote:

> The outlines shown when placing a stamp doesn't work as well as
> before (both for unscaled and scaled stamps).

I've noticed.

Rather than fixing it, I think the outline code should
be redone. As noted by a #define option, the current
code is slow. It also screws up on rectangles with
certain (odd? even?) sizes, leaving off one edge. So the
new problem is just one more reason to redo this code.

> And one of the higher scale factors doesn't give very smooth
> edges. You can see it on both the new tyre stamp and the updated
> grapes stamp. The tyre looks round and smooth with one scale
> factor, not with the next, but *with* the one after that one.
> 
> I of course know that doubling and quadrupling the size will get
> better result than arbitrary scaling, but my image program does
> seem to be able to handle the intermediate steps well, while Tux
> Paint does not. Something wrong with SDL's rescaling algorithm?

SDL isn't used for this. The thumbnail generator was modified to
do general stamp resizing. The algorithm is really, really, simple.
It simply grabs a square of pixels from the source, averages them,
and then fills in a square of pixels for the destination.

If linking against libfftw2 is OK, really nice arbitrary scaling
would be easy. (take FFT, truncate or zero-pad, inverse FFT)
Otherwise, maybe something like lanczos3. My notes on this:

---
accurate and slow: FFT/Chirp-z
http://www.worldserver.com/turk/computergraphics/ResamplingFilters.pdf
google for: fft image interpolation
http://www.mplayerhq.hu/DOCS/tech/swscaler_methods.txt
http://www.path.unimelb.edu.au/~dersch/interpolator/interpolator.html
lanczos3
---


___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev


Re: [Tuxpaint-dev] [PATCH] misc fixes

2004-11-25 Thread Karl Ove Hufthammer
Bill Kendrick <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:

> But yeah.  Let's switch to 24 or 32bit depth.

Done. Now the colour buckets look much better, and even some of
the stamps have improved rendering. For instance, take a look at
the leaves on the cartoon grapes stamp (scaled up). The gradient
is smooth and nice-looking!

(Of course people who still insist on limiting their colour vision
to 16 bit will get the same awful banding as before. Yes, that
means you, Bill ... ;)

-- 
Karl Ove Hufthammer
___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev


Re: [Tuxpaint-dev] high-resolution stamps work now

2004-11-25 Thread Karl Ove Hufthammer
Albert Cahalan <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:

>> I'm not sure I like this. If we have several stamps (e.g. the
>> fruit stamps) they should scale by the *same* amount, not by
>> an integer ratio. If I have understood things correctly, your
>> code means that an apple may look larger than a banana when
>> scaled.
>
> That's not changed. With simplified names, the code
> now works like this:
>
> scale = global_scale_factor * stamp_scale_factor;

OK.

I've now tried the code on a couple of stamps, and it seems to
work great! Thanks!

I have however found two minor issues:

The outlines shown when placing a stamp doesn't work as well as
before (both for unscaled and scaled stamps).

And one of the higher scale factors doesn't give very smooth
edges. You can see it on both the new tyre stamp and the updated
grapes stamp. The tyre looks round and smooth with one scale
factor, not with the next, but *with* the one after that one.

I of course know that doubling and quadrupling the size will get
better result than arbitrary scaling, but my image program does
seem to be able to handle the intermediate steps well, while Tux
Paint does not. Something wrong with SDL's rescaling algorithm?

-- 
Karl Ove Hufthammer
___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev


Re: [Tuxpaint-dev] [PATCH] new tinter

2004-11-25 Thread Karl Ove Hufthammer
Albert Cahalan <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:

> On Thu, 2004-11-25 at 00:49, Albert Cahalan wrote:
>> To show off the new tinter, the enclosed patch restores
>> the original purple. Yellow is much, much, nicer with this
>> new tinter.
>
> So... anybody try it? Any objections? Good? Bad?

I got an error message while trying to apply it for tuxpaint.c.
Could you try resending it, now as a an attachment (line-breaking
in e-mail programs easily mangles patches) and diffed against
latest CVS version?

But I have one comment. As far as I can see, you have completely
removed the notintgray feature. We do really *not* want to try to
be clever and (by default) only render parts of a stamp which has
the same hue. This has lead to problems in the past.

(But if a stamp require not tinting 'grey' parts, the 'notintgray'
option should still be available.)

-- 
Karl Ove Hufthammer
___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev


Re: [Tuxpaint-dev] [PATCH] new tinter

2004-11-25 Thread Albert Cahalan
On Thu, 2004-11-25 at 00:49, Albert Cahalan wrote:
> To show off the new tinter, the enclosed patch restores
> the original purple. Yellow is much, much, nicer with
> this new tinter.

So... anybody try it? Any objections? Good? Bad?



___
Tuxpaint-dev mailing list
[EMAIL PROTECTED]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev