From mboxrd@z Thu Jan 1 00:00:00 1970 Mime-Version: 1.0 (Apple Message framework v753) In-Reply-To: <20080126140548.766191E8C1C@holo.morphisms.net> References: <20080126140548.766191E8C1C@holo.morphisms.net> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Pietro Gagliardi Subject: Re: [9fans] How to read/write pixels from Memimage Date: Sat, 26 Jan 2008 09:09:23 -0500 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Topicbox-Message-UUID: 39ed3d2e-ead3-11e9-9d60-3106f5b1d025 However, I want to be able to read 32-bit color values. How does Memimage store colors and will the code I use work? 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? On Jan 26, 2008, at 9:05 AM, Russ Cox wrote: >> Hello. I'm porting Bell Labs' Pico image language over to Plan 9 to >> use the Plan 9 native image format (image(6)), and I chose to use >> Memimage. I'd like to know how to get the 32-bit RGB pixel >> information out of a Memimage and into a properly allocated array of >> u32ints, and to do the reverse. Is that possible? Thanks. > > A good way to answer questions like these is to > > cd /sys/src/cmd > grep -n Memimage *.c */*.c */*/*.c > > Looking through the output, all of these: > > /sys/src/cmd/crop.c > /sys/src/cmd/resample.c > /sys/src/cmd/jpg/writepng.c > > are examples of programs that use memimages > in a byte-at-a-time fashion. > > Russ >