[geeks] fti to svg conversion

Joshua D Boyd jdboyd at cs.millersville.edu
Tue Oct 29 22:05:09 CST 2002


On Tue, Oct 29, 2002 at 10:45:03PM -0500, Caleb Shay wrote:

> Which would bring me back to where I was originally, manually finding
> and typing in all possible 232 colors, which I understandably want to
> avoid.  However, I just thought of another possible reason why the
> colors are coming out wrong.  Maybe I'm getting them wrong?  I'm no C
> programmer, so I may be misunderstanding the fltk code you posted.  I'm
> doing this in perl.  I grab my color number (generally a negative
> number, though I have found a few positives, and those are coming out
> correct), and I have an array called $colormap that is the fltk
> colormap.  Then I do the following to get the correct item from the
> array:
> 
> if ($color < 0)  {
> 	$color = -$color;
> 	$c1 = $color >> 4;
> 	$c2 = $color & 15;
> 	$color = ($c1 + $c2)/2;
> }
> $color = $colormap[$color];
> 
> Is that the wrong way to do it?

It looks like it is right to me.  

Are you using perl?  If so, does >> 4 mean right bit shift 4 bits in
perl like it does in C?

But why are you trying to keep the whole thing colormapped?  Does .svg
require it?  I'm looking at the definition, and they say that all colors
are in SRGB color space, but the link to what SRGB means is broken.  I
found other references to it, but alas, it relies on know more color
theory that I can wade through at the moment (I'm tired and everything
is starting to blur for me), but it seems that it is true color.

If it were me, after seperating $c1 and $c2 from $color, I'd convert
them both to RGB, then blend those together, as well as converting
$color=>0 to RGB as well, and make the resulting .svg truecolor rather
than indexed color, if possible.

You still need to know the color map though for the RGB conversions.

As to why it is fouled up, well perhaps the color map in FLTK isn't the
same.  

Or perhaps your program is wrong.  But if your results are mostly right,
and all the numbers are negative, then you probably are close, and just
need some way to tell exactly what results you should have so that you
can absolutely say when it breaks and when it works.  You don't need to
find all the colors by hand.  Just find the instances when the icon
appears differently between the two machines, and capture the irix
version of those icons for sampling of the wrong pixels.

I wish I could be more helpfull, but I find it hard to say much more at
this point without being more hands on, but my school has turned rabidly
anti Irix, and I don't quite think that this warants a special trip down
to George's (closet person I can think of that I know with an Irix
machine) with my current workload.

Actually, I can think of one other thing to try.  Write a sample FLTK
program to load and display .fti files using it's built in .fti load,
and see if those display correctly.

-- 
Joshua D. Boyd



More information about the geeks mailing list