diff --git a/ChangeLog b/ChangeLog index 0799440cc..ac0bc9319 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-02-03 23:38 Alexander Malmberg + + * Source/NSBitmapImageRep.m (+imageRepsWithFile:, + _initFromWrasterFile:, _wrasterFileTypes): Remove obsolete libwraster + image loading hack. Update callers. + + * Source/NSImageRep.m (+imageRepsWithContentsOfFile:): Remove uses + of the removed NSBitmapImageRep methods. + 2004-02-02 Fred Kiefer * Source/NSFont.m diff --git a/Source/NSBitmapImageRep.m b/Source/NSBitmapImageRep.m index c5136b023..89b16b799 100644 --- a/Source/NSBitmapImageRep.m +++ b/Source/NSBitmapImageRep.m @@ -61,10 +61,7 @@ static BOOL supports_lzw_compression = NO; /* Backend methods (optional) */ -@interface NSBitmapImageRep (Backend) -+ (NSArray *) _wrasterFileTypes; -- _initFromWrasterFile: (NSString *)filename number: (int)imageNumber; - +@interface NSBitmapImageRep (GSPrivate) // GNUstep extension - _initFromTIFFImage: (TIFF *)image number: (int)imageNumber; @@ -133,9 +130,7 @@ static BOOL supports_lzw_compression = NO; if (types == nil) { - NSArray *wtypes = [self _wrasterFileTypes]; - - types = [[NSMutableArray alloc] initWithObjects: + types = [[NSArray alloc] initWithObjects: @"tiff", @"tif", @"pnm", @"ppm", #if HAVE_LIBUNGIF @@ -148,11 +143,6 @@ static BOOL supports_lzw_compression = NO; @"png", #endif nil]; - - if (wtypes != nil) - { - [(NSMutableArray *)types addObjectsFromArray: wtypes]; - } } return types; @@ -963,7 +953,7 @@ static BOOL supports_lzw_compression = NO; @end -@implementation NSBitmapImageRep (GNUstepExtension) +@implementation NSBitmapImageRep (GSPrivate) - (int) _localFromCompressionType: (NSTIFFCompression)type { @@ -1002,62 +992,6 @@ static BOOL supports_lzw_compression = NO; } -/* A special method used mostly when we have the wraster library in the - backend, which can read several more image formats. - Don't use this for TIFF images, use the regular ...Data methods */ -+ (NSArray*) imageRepsWithFile: (NSString *)filename -{ - NSString *ext; - int images; - NSMutableArray *array; - NSBitmapImageRep* imageRep; - NSFileManager *manager = [NSFileManager defaultManager]; - - if ([manager fileExistsAtPath: filename] == NO) - { - return nil; - } - - ext = [filename pathExtension]; - if (!ext) - { - NSLog(@"Extension missing from filename - '%@'", filename); - return nil; - } - /* This is a quick hack to make it work - if the extension is that - of a tiff file, we init with data */ - if ([ext isEqualToString: @"tiff"] || [ext isEqualToString: @"tif"]) - { - NSData* data = [NSData dataWithContentsOfFile: filename]; - return [self imageRepsWithData: data]; - } - - /* Otherwise, we attempt using wraster classes to load the file - (which could be png, etc) */ - array = [NSMutableArray arrayWithCapacity: 2]; - images = 0; - do - { - imageRep = [[[self class] alloc] _initFromWrasterFile: filename - number: images]; - if (imageRep) - { - [array addObject: AUTORELEASE(imageRep)]; - } - images++; - } - while (imageRep); - - if ([array count] > 0) - { - return array; - } - else - { - return nil; - } -} - /* Given a TIFF image (from the libtiff library), load the image information into our data structure. Reads the specified image. */ - _initFromTIFFImage: (TIFF *)image number: (int)imageNumber @@ -1115,15 +1049,5 @@ static BOOL supports_lzw_compression = NO; return self; } -// This are just placeholders for the implementation in the backend -- _initFromWrasterFile: (NSString *)filename number: (int)imageNumber -{ - return nil; -} - -+ (NSArray *) _wrasterFileTypes -{ - return nil; -} - @end + diff --git a/Source/NSImageRep.m b/Source/NSImageRep.m index c84ea9c54..66a410d39 100644 --- a/Source/NSImageRep.m +++ b/Source/NSImageRep.m @@ -182,24 +182,20 @@ static Class NSImageRep_class = NULL; else return nil; - // This is a GNUstep extension for special file types - if ([rep respondsToSelector: @selector(imageRepsWithFile:)]) - return [rep imageRepsWithFile: filename]; - else - { - NSData* data; - - data = [NSData dataWithContentsOfFile: filename]; - if ([rep respondsToSelector: @selector(imageRepsWithData:)]) - return [rep imageRepsWithData: data]; - else if ([rep respondsToSelector: @selector(imageRepWithData:)]) - { - NSImageRep *imageRep = [rep imageRepWithData: data]; - - if (imageRep != nil) - return [NSArray arrayWithObject: imageRep]; - } - } + { + NSData* data; + + data = [NSData dataWithContentsOfFile: filename]; + if ([rep respondsToSelector: @selector(imageRepsWithData:)]) + return [rep imageRepsWithData: data]; + else if ([rep respondsToSelector: @selector(imageRepWithData:)]) + { + NSImageRep *imageRep = [rep imageRepWithData: data]; + + if (imageRep != nil) + return [NSArray arrayWithObject: imageRep]; + } + } return nil; } @@ -232,13 +228,13 @@ static Class NSImageRep_class = NULL; } else return nil; - + if ([rep respondsToSelector: @selector(imageRepsWithData:)]) return [rep imageRepsWithData: data]; else if ([rep respondsToSelector: @selector(imageRepWithData:)]) { NSImageRep *imageRep = [rep imageRepWithData: data]; - + if (imageRep != nil) return [NSArray arrayWithObject: imageRep]; }