9fans archive / 2008 / 01 / 484 /    prev next

From: Pietro Gagliardi <pietro10@mac.com>
Subject: Re: [9fans] How to read/write pixels from Memimage
Date: Sat, 26 Jan 2008 18:22:07 -0500

The code led me to confusion, so I just decided to use wordaddr. It  
works properly now,  and my Pico is now up at /n/sources/contrib/ 
pietro/pico9.tgz (note the 9). Details are in README.Plan9, test  
files are in /lib/face/.

On Jan 26, 2008, at 9:55 AM, Russ Cox wrote:

>> However, I want to be able to read 32-bit color values. How does
>> Memimage store colors and
>
> You should be able to answer this by reading the programs
> I pointed out as well as color(6), image(6), and memdraw(2).
> If all else fails, you could try writing a simple program and
> see how far you get.
>
>> will the code I use work?
>
> Probably not at first (whose code does?), but eventually.
>
>> I can change it  to 24-bit if necessary, but that would make it  
>> slower to read files.
>> If I do what these programs say, how will my u32int be arranged?
>
> The answers to these questions are *in* those programs
> (not to mention the manual pages!).  Given that your reply
> came in four minutes after my post, it sounds like you didn't
> actually read the programs I pointed out.  The first one on
> the list, /sys/src/cmd/crop.c, picks up a Plan 9 image file
> and then walks over every 32-bit pixel looking for a given color.
> And it's only 211 lines.  Between that and the documentation
> I'd think that would be enough to answer questions about
> how colors are stored.  At the least it should prompt
> questions that are more specific than "how do I do this?"
>
> Read /sys/src/cmd/crop.c, color(6), image(6), and memdraw(2).
>
> Russ
>