Copyright (c) 1988, 1989, 1990, NeXT, Inc. All rights reserved.
*/
#import <Foundation/NSObject.h>
#import "NSGraphics.h"
@class NSPasteboard;
/* NSImageRepMatchesDevice indicates the value is variable, depending on the output device. It can be passed in (or received back) as the value of bitsPerSample, pixelsWide, and pixelsHigh.
*/
enum {
NSImageRepMatchesDevice = 0
};
@interface NSImageRep : NSObject <NSCopying> {
struct __repFlags {
unsigned int hasAlpha:1;
unsigned int :3;
unsigned int bitsPerSample:6;
unsigned int :3;
unsigned int dataLoaded:1;
unsigned int isOpaque:1;
unsigned int :0;
} _repFlags;
NSSize size;
int _pixelsWide;
int _pixelsHigh;
int _gsaved;
NSString *_colorSpaceName;
}
/* Drawing methods. drawAtPoint: and drawInRect: go through draw after modifying the CTM.
*/
- (BOOL)draw;
- (BOOL)drawAtPoint:(NSPoint)point;
- (BOOL)drawInRect:(NSRect)rect;
/* Methods to return info about the image. NSImageRep provides storage for all of these; however, it's illegal to set them in some subclasses.
*/
- setSize:(NSSize)aSize;
- (NSSize)size;
- setAlpha:(BOOL)flag;
- (BOOL)hasAlpha;
- setOpaque:(BOOL)flag;
- (BOOL)isOpaque;
- (void)setColorSpaceName:(NSString *)string;
- (NSString *)colorSpaceName;
- setBitsPerSample:(int)anInt;
- (int)bitsPerSample;
- setPixelsWide:(int)anInt;
- (int)pixelsWide;
- setPixelsHigh:(int)anInt;
- (int)pixelsHigh;
/* The rest of the methods all deal with subclassers which can read/write data in files or pasteboards.
*/
/* Registry management: Subclasses which deal with file & pasteboard types should register themselves. These classes should also implement imageUnfilteredFileTypes, imageUnfilteredPasteboardTypes, initWithData:, canInitWithData:, imageRepWithData:, and, if they have the ability to read multiple images from a file, imageRepsWithData:. These last three should not do any filtering; all filtering is automatic.
/* Should be overridden by subclassers to load an unfiltered image.
*/
+ (BOOL)canInitWithData:(NSData *)data;
/* Implemented by subclassers to indicate what data types they can deal with.
*/
+ (NSArray *)imageUnfilteredFileTypes;
+ (NSArray *)imageUnfilteredPasteboardTypes;
/* These expand the unfiltered lists returned by imageUnfilteredFileTypes and imageUnfilteredPasteboardTypes.
*/
+ (NSArray *)imageFileTypes;
+ (NSArray *)imagePasteboardTypes;
/* Convenience method: Checks to see if any of the types on the pasteboard can be understood by a registered imagerep class after filtering or if the pasteboard contains a filename that can be understood by a registered imagerep class after filtering. If sent to a subclass, does this for just the types understood by the subclass.
/* Convenience methods: Checks to see if the provided file or pasteboard types can be understood by a registered imagerep class after filtering; if so, calls imageRepsWithData: or imageRepWithData:. If sent to a subclass, does this just for the types understood by that subclass.