home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / AppKit.framework / Versions / B / Headers / NSImage.h < prev    next >
Text File  |  1996-10-17  |  4KB  |  121 lines

  1. /*
  2.     NSImage.h
  3.     Application Kit
  4.     Copyright (c) 1994-1996, NeXT Software, Inc.
  5.     All rights reserved.
  6. */
  7.  
  8. #import <Foundation/NSObject.h>
  9. #import <AppKit/NSGraphics.h>
  10. #import <AppKit/NSBitmapImageRep.h>
  11. @class NSColor;
  12. @class NSImageRep;
  13. @class NSPasteboard;
  14. @class NSArray;
  15.  
  16. @interface NSImage : NSObject <NSCopying, NSCoding> {
  17.     NSString *_name;
  18.     NSSize _size;
  19.     struct __imageFlags {
  20.     unsigned int scalable:1;
  21.     unsigned int dataRetained:1;
  22.     unsigned int uniqueWindow:1;
  23.     unsigned int sizeWasExplicitlySet:1;
  24.     unsigned int builtIn:1;
  25.     unsigned int needsToExpand:1;
  26.     unsigned int useEPSOnResolutionMismatch:1;
  27.     unsigned int colorMatchPreferred:1;
  28.     unsigned int multipleResolutionMatching:1;
  29.     unsigned int subImage:1;
  30.     unsigned int archiveByName:1;
  31.     unsigned int unboundedCacheDepth:1;
  32.         unsigned int flipped:1;
  33.     unsigned int reserved1:19;
  34.     } _flags;
  35.     void *_reps;
  36.     NSColor *_color;
  37. }
  38.  
  39. + (id)imageNamed:(NSString *)name;    /* If this finds & creates the image, only name is saved when archived */
  40.  
  41. - (id)initWithSize:(NSSize)aSize;
  42. - (id)initWithData:(NSData *)data;            /* When archived, saves contents */
  43. - (id)initWithContentsOfFile:(NSString *)fileName;    /* When archived, saves contents */
  44. - (id)initByReferencingFile:(NSString *)fileName;    /* When archived, saves fileName */
  45. - (id)initWithPasteboard:(NSPasteboard *)pasteboard;
  46.  
  47. - (void)setSize:(NSSize)aSize;
  48. - (NSSize)size;
  49. - (BOOL)setName:(NSString *)string;
  50. - (NSString *)name;
  51. - (void)setScalesWhenResized:(BOOL)flag;
  52. - (BOOL)scalesWhenResized;
  53. - (void)setDataRetained:(BOOL)flag;
  54. - (BOOL)isDataRetained;
  55. - (void)setCachedSeparately:(BOOL)flag;
  56. - (BOOL)isCachedSeparately;
  57. - (void)setCacheDepthMatchesImageDepth:(BOOL)flag;
  58. - (BOOL)cacheDepthMatchesImageDepth;
  59. - (void)setBackgroundColor:(NSColor *)aColor;
  60. - (NSColor *)backgroundColor;
  61. - (void)setUsesEPSOnResolutionMismatch:(BOOL)flag;
  62. - (BOOL)usesEPSOnResolutionMismatch;
  63. - (void)setPrefersColorMatch:(BOOL)flag;
  64. - (BOOL)prefersColorMatch;
  65. - (void)setMatchesOnMultipleResolution:(BOOL)flag;
  66. - (BOOL)matchesOnMultipleResolution;
  67. - (void)dissolveToPoint:(NSPoint)point fraction:(float)aFloat;
  68. - (void)dissolveToPoint:(NSPoint)point fromRect:(NSRect)rect fraction:(float)aFloat;
  69. - (void)compositeToPoint:(NSPoint)point operation:(NSCompositingOperation)op;
  70. - (void)compositeToPoint:(NSPoint)point fromRect:(NSRect)rect operation:(NSCompositingOperation)op;
  71. - (BOOL)drawRepresentation:(NSImageRep *)imageRep inRect:(NSRect)rect;
  72. - (void)recache;
  73. - (NSData *)TIFFRepresentation;
  74. - (NSData *)TIFFRepresentationUsingCompression:(NSTIFFCompression)comp factor:(float)aFloat;
  75.  
  76. - (NSArray *)representations;
  77. - (void)addRepresentations:(NSArray *)imageReps;
  78. - (void)addRepresentation:(NSImageRep *)imageRep;
  79. - (void)removeRepresentation:(NSImageRep *)imageRep;
  80.  
  81. - (BOOL)isValid;
  82. - (void)lockFocus;
  83. - (void)lockFocusOnRepresentation:(NSImageRep *)imageRepresentation;
  84. - (void)unlockFocus;
  85.  
  86. - (NSImageRep *)bestRepresentationForDevice:(NSDictionary *)deviceDescription;
  87.  
  88. - (void)setDelegate:(id)anObject;
  89. - (id)delegate;
  90.  
  91. /* These return union of all the types registered with NSImageRep.
  92. */
  93. + (NSArray *)imageUnfilteredFileTypes;
  94. + (NSArray *)imageUnfilteredPasteboardTypes;
  95. + (NSArray *)imageFileTypes;
  96. + (NSArray *)imagePasteboardTypes;
  97.  
  98. + (BOOL)canInitWithPasteboard:(NSPasteboard *)pasteboard;
  99.  
  100. - (void)setFlipped:(BOOL)flag;
  101. - (BOOL)isFlipped;
  102.  
  103. @end
  104.  
  105. #if !defined(STRICT_OPENSTEP) && defined(WIN32)
  106.  
  107. @interface NSImage (NSWindowsExtensions)
  108. - (id)initWithIconHandle:(void * /* HICON */)icon;
  109. - (id)initWithBitmapHandle:(void * /* HBITMAP */)bitmap;
  110. @end
  111.  
  112. #endif
  113.  
  114. @interface NSObject(NSImageDelegate)
  115. - (NSImage *)imageDidNotDraw:(id)sender inRect:(NSRect)aRect;
  116. @end
  117.  
  118. @interface NSBundle(NSBundleImageExtension)
  119. - (NSString *)pathForImageResource:(NSString *)name;    /* May return nil if no file found */
  120. @end
  121.