9fans archive / 2008 / 01 / 476 /    prev next

From: "Russ Cox" <rsc@swt...>
Subject: Re: [9fans] How to read/write pixels from Memimage
Date: Sat, 26 Jan 2008 09:05:53 -0500

> 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