Inherits From:
NSImageRep : NSObject
Conforms To:
NSCoding (from NSImageRep)
NSCopying (from NSImageRep)
NSObject (from NSObject)
Declared In:
AppKit/NSEPSImageRep.h
Like most other kinds of NSImageReps, an NSEPSImageRep is generally used indirectly, through an NSImage object. An NSImage must be able to choose between various representations of a given image. It also needs to provide an off-screen cache of the appropriate depth for any image it uses. It determines this information by querying its NSImageReps.
Thus to work with an NSImage, an NSEPSImageRep must be able to provide some information about its image. The size of the object is set from the bounding box specified in the EPS header comments. Use these methods, inherited from the NSImageRep class, to set the other attributes of the NSEPSImageRep:
setColorSpaceName:
setAlpha:
setPixelsHigh:
setPixelsWide:
setBitsPerSample:
Note that if these attributes aren't set, and an NSEPSImageRep is used in an NSImage with other representations, NSImage won't be able to select between them. In actual practice, this usually isn't a problem.
imageRepWithData:
(NSData *)epsData
Creates a new NSEPSImageRep instance and then invokes initWithData:
to initialize it with the contents of epsData. If the new object can't be initialized for any reason (for example, epsData doesn't contain EPS code), this method frees the receiver and returns nil
. Otherwise, it returns a new instance of NSEPSImageRep.
The size of the object is set from the bounding box specified in the EPS header comments.
EPSRepresentation
Returns the EPS representation of the image.
boundingBox
Returns the rectangle that bounds the image. The rectangle is obtained from the "%%BoundingBox:" comment in the EPS header when the NSEPSImageRep is initialized.
See also:
+ imageRepWithData:
, - initWithData:
initWithData:
(NSData *)epsData
Initializes the receiver, a newly allocated NSEPSImageRep object, with the contents of epsData. If the new object can't be initialized for any reason (for example, epsData doesn't contain EPS code), this method frees the receiver and returns nil
. Otherwise, it returns self
.
The size of the object is set from the bounding box specified in the EPS header comments.
prepareGState
Implemented by subclasses to initialize the graphics state before the image is drawn. NSEPSImageRep's draw
method sends a prepareGState
message just before rendering the EPS code. The default implementation of prepareGState
does nothing.