From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: [9fans] How to read/write pixels from Memimage From: "Russ Cox" Date: Sat, 26 Jan 2008 09:55:20 -0500 In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20080126145515.6C2CA1E8C1C@holo.morphisms.net> Topicbox-Message-UUID: 39fd36fc-ead3-11e9-9d60-3106f5b1d025 > 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