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:05:53 -0500 In-Reply-To: <7BDD11E8-7753-4E44-9BD2-2FA5944D43E8@mac.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: <20080126140548.766191E8C1C@holo.morphisms.net> Topicbox-Message-UUID: 39e575da-ead3-11e9-9d60-3106f5b1d025 > 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