> > This is the way I'd do it.  Maybe it's not the best way, but it should work.
> > 1) Loop over each location of your image starting at the upper-right
> > 2) If the current section is uncolored, do a flood-fill with a new color
> > 3) write out the ascii number of the color at the current location to an
> > array.
> 
> Probably is a proof of my ignorance in these questions (haven't had the need
> to read and parse a binary file before), but I'm puzzled with the suggested
> approach - Why is the need to fill background pixels with different colors
> instead of reading their actual value? I just can't see the need of doing
> so. At first sight, I would prefer a direct approach. As I said, probably it
> is just me.

It wasn't clear that your pictures were actually colored.  The example I received was 
black and white, with no color distinctions between each 'piece'.  Thus the desire to 
distinguish each piece with a different color.

> A code example of how to read the value of a pixel would be great -
> basically is what I don't know how to code.

If you look at http://www.macperl.com/depts/code/_kpreid/, you'll find a number of 
sample programs and scripts written by Kevin Reid that make use of the MacTooolbox to 
do image manipulation.  Particularly the Dither Tool will get you fairly close to 
where you probably want to be. 

Once you've got a pointer to the GrafPort Pixel Map, you can access the pixels by 
index (as an array).  Then you can get various color information and etc.  

-Jeff Lowrey

Reply via email to