From mboxrd@z Thu Jan 1 00:00:00 1970 Mime-Version: 1.0 (Apple Message framework v753) In-Reply-To: <20080126145515.6C2CA1E8C1C@holo.morphisms.net> References: <20080126145515.6C2CA1E8C1C@holo.morphisms.net> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <1262D9E4-6E23-45BC-B006-B3135EB3D33B@mac.com> Content-Transfer-Encoding: 7bit From: Pietro Gagliardi Subject: Re: [9fans] How to read/write pixels from Memimage Date: Sat, 26 Jan 2008 18:22:07 -0500 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Topicbox-Message-UUID: 3a165786-ead3-11e9-9d60-3106f5b1d025 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 >