mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Remove obsolete libwraster image loading hacks.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18533 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
afabdddd55
commit
edc0a6f614
3 changed files with 29 additions and 100 deletions
|
@ -1,3 +1,12 @@
|
|||
2004-02-03 23:38 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* 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 <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSFont.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
|
||||
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue