Class CPImage

CPObject
    extended byCPImage

@implementation CPImage : CPObject

CPImage is used to represent images in the Cappuccino framework. It supports loading all image types supported by the browser.


Method Summary
-(CPImage)initByReferencingFile:(CPString)aFilename size:(CGSize)aSize
          Initializes the image, by associating it with a filename.
-(id)initWithCoder:(CPCoder)aCoder
          Initializes the image with data from a coder.
-(CPImage)initWithContentsOfFile:(CPString)aFilename
          Initializes the receiver with the contents of the specified image file.
-(CPImage)initWithContentsOfFile:(CPString)aFilename size:(CGSize)aSize
          Initializes the image.
-(id)delegate
          Returns the receiver's delegate.
-(void)encodeWithCoder:(CPCoder)aCoder
          Writes the image data from memory into the coder.
-(CPString)filename
          Returns the path of the file associated with this image.
-(BOOL)isNinePartImage
-(BOOL)isThreePartImage
-(void)load
          Loads the image data from the file into memory.
-(BOOL)loadStatus
          Returns YES if the image data has already been loaded.
-(void)setDelegate:(id)aDelegate
          Sets the receiver's delegate.
-(void)setSize:(CGSize)aSize
          Sets the size of the image.
-(CGSize)size
          Returns the size of the image.

Methods inherited from class CPObject
initialize, alloc, class, instanceMethodForSelector, instancesRespondToSelector, isSubclassOfClass, load, new, setVersion, superclass, version, init, autorelease, awakeAfterUsingCoder, class, classForCoder, classForKeyedArchiver, className, copy, dealloc, description, doesNotRecognizeSelector, forwardInvocation, hash, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableCopy, performSelector, performSelector, performSelector, release, replacementObjectForArchiver, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, retain, self, superclass

Delegate Method Summary
-(void)imageDidLoad:(CPImage)image
          Called when the specified image has finished loading.
-(void)imageDidError:(CPImage)image
          Called when the specified image had an error loading.
-(void)imageDidAbort:(CPImage)image
          Called when the image loading was aborted.


Method Detail

initByReferencingFile

-(CPImage)initByReferencingFile:(CPString)aFilename size:(CGSize)aSize
Initializes the image, by associating it with a filename. The image denoted in aFilename is not actually loaded. It will be loaded once needed.
Parameters:
aFilename - the file containing the image
aSize - the image's size
Returns:
the initialized image

initWithCoder

-(id)initWithCoder:(CPCoder)aCoder
Initializes the image with data from a coder.
Parameters:
aCoder - the coder from which to read the image data
Returns:
the initialized image

initWithContentsOfFile

-(CPImage)initWithContentsOfFile:(CPString)aFilename
Initializes the receiver with the contents of the specified image file. The method loads the data into memory.
Parameters:
aFilename - the file name of the image
Returns:
the initialized image

initWithContentsOfFile

-(CPImage)initWithContentsOfFile:(CPString)aFilename size:(CGSize)aSize
Initializes the image. Loads the specified image into memory.
Parameters:
aFilename - the image to load
aSize - the size of the image
Returns:
the initialized image.

delegate

-(id)delegate
Returns the receiver's delegate

encodeWithCoder

-(void)encodeWithCoder:(CPCoder)aCoder
Writes the image data from memory into the coder.
Parameters:
aCoder - the coder to which the data will be written

filename

-(CPString)filename
Returns the path of the file associated with this image.

isNinePartImage

-(BOOL)isNinePartImage

isThreePartImage

-(BOOL)isThreePartImage

load

-(void)load
Loads the image data from the file into memory. You should not call this method directly. Instead use one of the initializers.

loadStatus

-(BOOL)loadStatus
Returns YES if the image data has already been loaded.

setDelegate

-(void)setDelegate:(id)aDelegate
Sets the receiver's delegate.
Parameters:
aDelegate

setSize

-(void)setSize:(CGSize)aSize
Sets the size of the image.
Parameters:
aSize

size

-(CGSize)size
Returns the size of the image

Delegate Method Detail

imageDidLoad

-(void)imageDidLoad:(CPImage)image
Called when the specified image has finished loading.
Parameters:
image - the image that loaded

imageDidError

-(void)imageDidError:(CPImage)image
Called when the specified image had an error loading.
Parameters:
image - the image with the loading error

imageDidAbort

-(void)imageDidAbort:(CPImage)image
Called when the image loading was aborted.
Parameters:
image - the image that was aborted

Created on Sat Sep 13 14:15:43 PDT 2008