9fans archive / 2008 / 01 / 477 / prev next From: Pietro Gagliardi <pietro10@mac.com> Subject: Re: [9fans] How to read/write pixels from Memimage Date: Sat, 26 Jan 2008 09:09:23 -0500 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 >