/usr/include/GNUstep/AppKit/NSImage.h is in libgnustep-gui-dev 0.20.0-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | /*
NSImage.h
Load, manipulate and display images
Copyright (C) 1996, 2005 Free Software Foundation, Inc.
Written by: Adam Fedor <fedor@colorado.edu>
Date: Feb 1996
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_NSImage
#define _GNUstep_H_NSImage
#import <GNUstepBase/GSVersionMacros.h>
#import <AppKit/NSGraphicsContext.h>
#import <Foundation/NSBundle.h>
#import <AppKit/NSBitmapImageRep.h>
@class NSString;
@class NSMutableArray;
@class NSData;
@class NSURL;
@class NSPasteboard;
@class NSImageRep;
@class NSColor;
@class NSView;
/** Defines how an NSImage is to be cached. Possible values are:
* <list>
* <item>NSImageCacheDefault</item>
* <item>NSImageCacheAlways</item>
* <item>NSImageCacheBySize</item>
* <item>NSImageCacheNever</item>
* </list>
* <p>See Also:</p>
* <list>
* <item>-setCacheMode:</item>
* <item>-cacheMode</item>
* </list>
*/
typedef enum {
NSImageCacheDefault,
NSImageCacheAlways,
NSImageCacheBySize,
NSImageCacheNever
} NSImageCacheMode;
@interface NSImage : NSObject <NSCoding, NSCopying>
{
// Attributes
NSString *_name;
NSString *_fileName;
NSSize _size;
struct __imageFlags {
unsigned archiveByName: 1;
unsigned scalable: 1;
unsigned dataRetained: 1;
unsigned flipDraw: 1;
unsigned sizeWasExplicitlySet: 1;
unsigned useEPSOnResolutionMismatch: 1;
unsigned colorMatchPreferred: 1;
unsigned multipleResolutionMatching: 1;
unsigned cacheSeparately: 1;
unsigned unboundedCacheDepth: 1;
unsigned syncLoad: 1;
} _flags;
NSMutableArray *_reps;
NSColor *_color;
NSView *_lockedView;
id _delegate;
NSImageCacheMode _cacheMode;
}
//
// Initializing a New NSImage Instance
//
/** Initializes and returns a NSImage from the NSString fileName.
*/
- (id) initByReferencingFile: (NSString*)fileName;
/** Initializes and returns a new NSImage from the file
* fileName. fileName should be an absolute path.
* <p>See Also:</p>
* <list>
* <item>[NSImageRep+imageRepsWithContentsOfFile:]</item>
* </list>
*/
- (id) initWithContentsOfFile: (NSString*)fileName;
/** Initializes and returns a new NSImage from the NSData data.
* <p>See Also:</p>
* <list>
* <item>[NSBitmapImageRep+imageRepWithData:]</item>
* <item>[NSEPSImageRep+imageRepWithData:]</item>
* </list>
*/
- (id) initWithData: (NSData*)data;
/** Initializes and returns a new NSImage from the data in pasteboard.
* The pasteboard types can be whose defined in
* [NSImageRep+imagePasteboardTypes] or NSFilenamesPboardType
* <p>See Also:</p>
* <list>
* <item>[NSImageRep+imageRepsWithPasteboard:]</item>
* </list>
*/
- (id) initWithPasteboard: (NSPasteboard*)pasteboard;
/** Initialize and returns a new NSImage with aSize as specified
* size.
* <p>See Also:</p>
* <list>
* <item>-setSize:</item>
* <item>-size</item>
* </list>
*/
- (id) initWithSize: (NSSize)aSize;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (id)initWithBitmapHandle:(void *)bitmap;
- (id)initWithContentsOfURL:(NSURL *)anURL;
- (id)initWithIconHandle:(void *)icon;
#endif
//
// Setting the Size of the Image
//
/** Sets the NSImage size to aSize. Changing the size recreate
* the cache.
* <p>See Also:</p>
* <list>
* <item>-size</item>
* <item>-initWithSize:</item>
* </list>
*/
- (void) setSize: (NSSize)aSize;
/** Returns NSImage size if the size have been set. Returns the
* size of the best representation otherwise.
* <p>See Also:</p>
* <list>
* <item>-setSize:</item>
* <item>-initWithSize:</item>
* </list>
*/
- (NSSize) size;
//
// Referring to Images by Name
//
/** Returns the NSImage named aName. The search is done in the main bundle
* first and then in the usual images directories.
*/
+ (id) imageNamed: (NSString*)aName;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
+ (NSImage*) _standardImageWithName: (NSString*)name;
#endif
#endif
/** Sets aName as the name of the receiver.
*/
- (BOOL) setName: (NSString*)aName;
/** Returns the name of the receiver.
*/
- (NSString*) name;
//
// Specifying the Image
//
/** Adds the NSImageRep imageRep to the NSImage's representations array.
* <p>See Also:</p>
* <list>
* <item>-addRepresentations:</item>
* <item>-removeRepresentation:</item>
* </list>
*/
- (void) addRepresentation: (NSImageRep*)imageRep;
/** Adds the NSImageRep array imageRepArray to the NSImage's
* representations array.
* <p>See Also:</p>
* <list>
* <item>-addRepresentation:</item>
* <item>-removeRepresentation:</item>
* </list>
*/
- (void) addRepresentations: (NSArray*)imageRepArray;
/** Locks the focus on the best representation.
* <p>See Also:</p>
* <list>
* <item>-lockFocusOnRepresentation:</item>
* </list>
*/
- (void) lockFocus;
/** Locks the focus in the imageRep. If imageRep is nil this method
* locks the focus on the best representation.
*/
- (void) lockFocusOnRepresentation: (NSImageRep*)imageRep;
/** Unlocks the focus on the receiver.
* <p>See Also:</p>
* <list>
* <item>-lockFocus</item>
* </list>
*/
- (void) unlockFocus;
//
// Using the Image
//
- (void) compositeToPoint: (NSPoint)aPoint
operation: (NSCompositingOperation)op;
- (void) compositeToPoint: (NSPoint)aPoint
fromRect: (NSRect)aRect
operation: (NSCompositingOperation)op;
- (void) dissolveToPoint: (NSPoint)aPoint
fraction: (float)aFloat;
- (void) dissolveToPoint: (NSPoint)aPoint
fromRect: (NSRect)aRect
fraction: (float)aFloat;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
- (void) compositeToPoint: (NSPoint)aPoint
fromRect: (NSRect)srcRect
operation: (NSCompositingOperation)op
fraction: (float)delta;
- (void) compositeToPoint: (NSPoint)aPoint
operation: (NSCompositingOperation)op
fraction: (float)delta;
#endif
//
// Choosing Which Image Representation to Use
//
/** Sets the preferred representation of a NSImage.
* <p>See Also:</p>
* <list>
* <item>-prefersColorMatch</item>
* <item>-bestRepresentationForDevice:</item>
* </list>
*/
- (void) setPrefersColorMatch: (BOOL)flag;
/** Returns YES if color matching is the preferred representation
* and NO otherwise.
*/
- (BOOL) prefersColorMatch;
- (void) setUsesEPSOnResolutionMismatch: (BOOL)flag;
- (BOOL) usesEPSOnResolutionMismatch;
- (void) setMatchesOnMultipleResolution: (BOOL)flag;
- (BOOL) matchesOnMultipleResolution;
//
// Getting the Representations
//
/** Finds the best representation for deviceDescription. If
* deviceDescription is nil, it guesses where drawing is taking
* place and finds the best representation.
*/
- (NSImageRep*) bestRepresentationForDevice: (NSDictionary*)deviceDescription;
- (NSArray*) representations;
/** Remove the NSImageRep imageRep from the NSImage's representations
* array
* <p>See Also:</p>
* <list>
* <item>-addRepresentations:</item>
* <item>-addRepresentation:</item>
* </list>
*/
- (void) removeRepresentation: (NSImageRep*)imageRep;
//
// Determining How the Image is Stored
//
- (void) setCachedSeparately: (BOOL)flag;
- (BOOL) isCachedSeparately;
- (void) setDataRetained: (BOOL)flag;
- (BOOL) isDataRetained;
- (void) setCacheDepthMatchesImageDepth: (BOOL)flag;
- (BOOL) cacheDepthMatchesImageDepth;
- (void) setCacheMode: (NSImageCacheMode)mode;
- (NSImageCacheMode) cacheMode;
//
// Drawing
//
- (BOOL) drawRepresentation: (NSImageRep*)imageRep
inRect: (NSRect)aRect;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
/** Calls -drawAtPoint:fromRect:operation:fraction: with
* <code>dstRect</code> given by <code>point</code> and the size of
* <code>srcRect</code>.
*/
- (void) drawAtPoint: (NSPoint)point
fromRect: (NSRect)srcRect
operation: (NSCompositingOperation)op
fraction: (float)delta;
/** <p>Takes the part of the receiver given by <code>srcRect</code> and
* draws it in <code>dstRect</code> in the current coordinate system,
* transforming the image as necessary.
* </p><p>
* The image is drawn as if it was drawn to a cleared window, then
* dissolved using the fraction <code>delta</code> to another cleared
* window, and finally composited using <code>op</code> to the
* destination.
* </p><p>
* Note that compositing and dissolving doesn't work on all devices
* (printers, in particular).
* </p>
*/
- (void) drawInRect: (NSRect)dstRect
fromRect: (NSRect)srcRect
operation: (NSCompositingOperation)op
fraction: (float)delta;
#endif
//
// Determining How the Image is Drawn
//
- (BOOL) isValid;
- (void) setScalesWhenResized: (BOOL)flag;
- (BOOL) scalesWhenResized;
/** Sets the color of the NSImage's background to aColor.
* <p>See Also:</p>
* <list>
* <item>-backgroundColor</item>
* </list>
*/
- (void) setBackgroundColor: (NSColor*)aColor;
/** Returns the color of the NSImage's background.
* <p>See Also:</p>
* <list>
* <item>-setBackgroundColor:</item>
* </list>
*/
- (NSColor*) backgroundColor;
- (void) recache;
- (void) setFlipped: (BOOL)flag;
- (BOOL) isFlipped;
//
// Assigning a Delegate
//
- (void) setDelegate: (id)anObject;
- (id) delegate;
//
// Producing TIFF Data for the Image
//
- (NSData*) TIFFRepresentation;
- (NSData*) TIFFRepresentationUsingCompression: (NSTIFFCompression)comp
factor: (float)aFloat;
//
// Managing NSImageRep Subclasses
//
+ (NSArray*) imageUnfilteredFileTypes;
+ (NSArray*) imageUnfilteredPasteboardTypes;
//
// Testing Image Data Sources
//
+ (BOOL) canInitWithPasteboard: (NSPasteboard*)pasteboard;
+ (NSArray*) imageFileTypes;
+ (NSArray*) imagePasteboardTypes;
@end
@interface NSBundle (NSImageAdditions)
- (NSString*) pathForImageResource: (NSString*)name;
@end
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
/*
* A formal protocol that duplicates the informal protocol for delegates.
*/
@protocol GSImageDelegateProtocol
- (NSImage*) imageDidNotDraw: (id)sender
inRect: (NSRect)aRect;
@end
#endif
#endif // _GNUstep_H_NSImage
|