Copyright ©1995 by NeXT Computer, Inc. All Rights Reserved.
NXCachedImageRep |
Inherits From: | NXImageRep : Object | |
Declared In: | appkit/NXCachedImageRep.h |
Class Description |
An NXCachedImageRep is a rendered image in a window, typically a window that stays off-screen. The only data that's available for reproducing the image is the image itself. Thus an NXCachedImageRep differs from the other kinds of NXImageReps defined in the Application Kit, all of which can reproduce an image from the information originally used to draw it.
Instances of this class are generally used indirectly, through an NXImage object. An NXCachedImageRep must be able to provide the NXImage with some information about the image--so that the NXImage can match it to a display device, for example, or know whether to scale it. Therefore, it's a good idea to use these inherited methods to inform the NXCachedImageRep object about the image in the cache: |
setNumColors: setAlpha: setPixelsHigh: setPixelsWide: setBitsPerSample: |
These methods are all defined in the NXImageRep class. |
Instance Variables |
None declared in this class. |
Method Types |
Initializing a new NXCachedImageRep |
initFromWindow:rect: |
copyFromZone: |
Freeing an NXCachedImageRep |
free |
Getting the representation | getWindow:andRect: | |
Drawing the image | draw | |
Archiving | read: |
write: |
Instance Methods |
copyFromZone: |
copyFromZone:(NXZone *)zone |
Returns a new instance of NXCachedImageRep that's an exact copy of the receiver. Memory for the new instance is allocated from zone. Cached image reps are copied fully, including their own copy of the image data.
See also: copyFromZone: (NXImage) |
draw |
(BOOL)draw |
Reads image data from the cache and reproduces the image from that data. The reproduction is rendered in the current window at location (0.0, 0.0) in the current coordinate system.
It's much more efficient to reproduce an image by compositing it, which can be done through the NXImage class. An NXBitmapImageRep can also be used to reproduce an existing image. This method returns YES if successful in reproducing the image, and NO if not. See also: drawIn: (NXImageRep), drawAt: (NXImageRep), |
free |
free |
Deallocates the NXCachedImageRep. |
getWindow:andRect: |
getWindow:(Window **)theWindow andRect:(NXRect *)theRect |
Copies the id of the Window object where the image is located into the variable referred to by theWindow, and copies the rectangle that bounds the image into the structure referred to by theRect. If theRect is NULL, only the Window id is provided. Returns self. |
init |
Generates an error message. This method cannot be used to initialize an NXCachedImageRep. Use the initFromWindow:rect: method instead.
See also: initFromWindow:rect: |
initFromWindow:rect: |
initFromWindow:(Window *)aWindow rect:(const NXRect *)aRect |
Initializes the receiver, a new NXCachedImageRep instance, for an image that will be rendered within the aRect rectangle in aWindow, and returns the initialized object. The rectangle is specified in aWindow's base coordinate system. The size of the image is set from the size of the rectangle.
You must draw the image in the rectangle yourself; there are no NXCachedImageRep methods for this purpose. |
read: |
read:(NXTypedStream *)stream |
Reads the NXCachedImageRep from the typed stream stream. |
write: |
write:(NXTypedStream *)stream |
Writes the NXCachedImageRep to the typed stream stream. |