[comp.sys.sun] How to save raster to file from canvas?

knudsen@ihlpl.att.com (Knudsen) (03/09/89)

I'd like some advice with what seems like a simple idea.  Given a canvas
with its pixwin, how can I just get at the raw bits of the image so as to
save it to a disk file and later reload it into the same pixwin?  Note
that the rectangle size and shape will not change.

I could root thru the *.h files and de-reference a chain of structure
pointers and probably find the backing store bit image.  However, there's
a hope expressed in the manual that we will treat Canvasses and Pixwins as
"opaque," meaning that any hacks may break with the next version of
Sunview.

So, is there a gentlemanly way to do this?  Yes, I can copy the pixwin to
a pixrect, but this wastes memory and just recursively calls this posting
on pixrects instead of canvasses.

Mike Knudsen  Bell Labs(AT&T)   att!ihlpl!knudsen

chuck@trantor.harris-atd.com (Chuck Musciano) (03/14/89)

Copy the pixwin to a pixrect, and then pr_dump() to write it to a file.
See Chapter 5 of the pixrect manual.

Chuck Musciano
Advanced Technology Department
Harris Corporation
(407) 727-6131
ARPA: chuck@trantor.harris-atd.com