Article View: comp.sys.next.programmer
Article #105Re: Device independent cached images?
From: Ali Ozer
Date: Mon, 02 Nov 1992 21:31
Date: Mon, 02 Nov 1992 21:31
29 lines
1881 bytes
1881 bytes
In article <1992Oct27.212529.12565@ohsu.edu> filibert@ohsu.edu writes:
> ... So, I create another NXImage, lockFocus on it, and use some
>postscript magic to set the clipping path and copy from the original image into
>the new one. This new image is created with the initSize: method, and so I
>assume that it creates a NXCachedImageRep to hold the image. ...
>Finally, I need to get at the bitmap data in the etched image. One way to
>do this is to use the NXReadBitmap() function to read the image into a chunk of
>memory. ... when I do this on our NeXTDimension system, everything works fine.
>But, if I'm running the application on a monochrome slab, NXSizeBitmap() and
>NXReadBitmap() always treat the image as 2 bps, and 4 spp (RGBA)!
Hmm. Do you set the depth limit of this second NXImage to 24 bits? If you don't,
then the NXImage you get is the same depth as the default depth of the system.
You should do:
NXImage *myImage = [[NXImage alloc] initSize:...];
[myImage useCacheWithDepth:NX_TwentyFourBitRGBDepth];
if ([myImage lockFocus]) {
... draw the image ...
... now read it back ...
[myImage unlockFocus];
}
Also please don't use the NXReadBitmap()/NXSizeBitmap() functions. Use the
NXBitmapImageRep method initData:fromRect:, which is a lot more efficient,
especially if you let the NXBitmapImageRep allocate and manage the data.
You can use the writeTIFF: method to save it out.
Ali, Ali_Ozer@NeXT.com
Technical Details
Message-ID:
<5711@rosie.NeXT.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!rosie!aozerReferences:
<1992Oct27.212529.12565@ohsu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!rosie!aozer From: aozer@next.com (Ali Ozer) Newsgroups: comp.sys.next.programmer Subject: Re: Device independent cached images? Keywords: image, color, NXImage, bitmap Message-ID: <5711@rosie.NeXT.COM> Date: 2 Nov 92 21:31:25 GMT References: <1992Oct27.212529.12565@ohsu.edu> Sender: news@NeXT.COM Organization: Next Computer, Inc. Lines: 30