mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +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
108986ee7d
commit
c172a7ed18
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>
|
2004-02-02 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSFont.m
|
* Source/NSFont.m
|
||||||
|
|
|
@ -61,10 +61,7 @@
|
||||||
static BOOL supports_lzw_compression = NO;
|
static BOOL supports_lzw_compression = NO;
|
||||||
|
|
||||||
/* Backend methods (optional) */
|
/* Backend methods (optional) */
|
||||||
@interface NSBitmapImageRep (Backend)
|
@interface NSBitmapImageRep (GSPrivate)
|
||||||
+ (NSArray *) _wrasterFileTypes;
|
|
||||||
- _initFromWrasterFile: (NSString *)filename number: (int)imageNumber;
|
|
||||||
|
|
||||||
// GNUstep extension
|
// GNUstep extension
|
||||||
- _initFromTIFFImage: (TIFF *)image number: (int)imageNumber;
|
- _initFromTIFFImage: (TIFF *)image number: (int)imageNumber;
|
||||||
|
|
||||||
|
@ -133,9 +130,7 @@ static BOOL supports_lzw_compression = NO;
|
||||||
|
|
||||||
if (types == nil)
|
if (types == nil)
|
||||||
{
|
{
|
||||||
NSArray *wtypes = [self _wrasterFileTypes];
|
types = [[NSArray alloc] initWithObjects:
|
||||||
|
|
||||||
types = [[NSMutableArray alloc] initWithObjects:
|
|
||||||
@"tiff", @"tif",
|
@"tiff", @"tif",
|
||||||
@"pnm", @"ppm",
|
@"pnm", @"ppm",
|
||||||
#if HAVE_LIBUNGIF
|
#if HAVE_LIBUNGIF
|
||||||
|
@ -148,11 +143,6 @@ static BOOL supports_lzw_compression = NO;
|
||||||
@"png",
|
@"png",
|
||||||
#endif
|
#endif
|
||||||
nil];
|
nil];
|
||||||
|
|
||||||
if (wtypes != nil)
|
|
||||||
{
|
|
||||||
[(NSMutableArray *)types addObjectsFromArray: wtypes];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
|
@ -963,7 +953,7 @@ static BOOL supports_lzw_compression = NO;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation NSBitmapImageRep (GNUstepExtension)
|
@implementation NSBitmapImageRep (GSPrivate)
|
||||||
|
|
||||||
- (int) _localFromCompressionType: (NSTIFFCompression)type
|
- (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
|
/* Given a TIFF image (from the libtiff library), load the image information
|
||||||
into our data structure. Reads the specified image. */
|
into our data structure. Reads the specified image. */
|
||||||
- _initFromTIFFImage: (TIFF *)image number: (int)imageNumber
|
- _initFromTIFFImage: (TIFF *)image number: (int)imageNumber
|
||||||
|
@ -1115,15 +1049,5 @@ static BOOL supports_lzw_compression = NO;
|
||||||
return self;
|
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
|
@end
|
||||||
|
|
||||||
|
|
|
@ -182,24 +182,20 @@ static Class NSImageRep_class = NULL;
|
||||||
else
|
else
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
// This is a GNUstep extension for special file types
|
{
|
||||||
if ([rep respondsToSelector: @selector(imageRepsWithFile:)])
|
NSData* data;
|
||||||
return [rep imageRepsWithFile: filename];
|
|
||||||
else
|
data = [NSData dataWithContentsOfFile: filename];
|
||||||
{
|
if ([rep respondsToSelector: @selector(imageRepsWithData:)])
|
||||||
NSData* data;
|
return [rep imageRepsWithData: data];
|
||||||
|
else if ([rep respondsToSelector: @selector(imageRepWithData:)])
|
||||||
data = [NSData dataWithContentsOfFile: filename];
|
{
|
||||||
if ([rep respondsToSelector: @selector(imageRepsWithData:)])
|
NSImageRep *imageRep = [rep imageRepWithData: data];
|
||||||
return [rep imageRepsWithData: data];
|
|
||||||
else if ([rep respondsToSelector: @selector(imageRepWithData:)])
|
if (imageRep != nil)
|
||||||
{
|
return [NSArray arrayWithObject: imageRep];
|
||||||
NSImageRep *imageRep = [rep imageRepWithData: data];
|
}
|
||||||
|
}
|
||||||
if (imageRep != nil)
|
|
||||||
return [NSArray arrayWithObject: imageRep];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -232,13 +228,13 @@ static Class NSImageRep_class = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
if ([rep respondsToSelector: @selector(imageRepsWithData:)])
|
if ([rep respondsToSelector: @selector(imageRepsWithData:)])
|
||||||
return [rep imageRepsWithData: data];
|
return [rep imageRepsWithData: data];
|
||||||
else if ([rep respondsToSelector: @selector(imageRepWithData:)])
|
else if ([rep respondsToSelector: @selector(imageRepWithData:)])
|
||||||
{
|
{
|
||||||
NSImageRep *imageRep = [rep imageRepWithData: data];
|
NSImageRep *imageRep = [rep imageRepWithData: data];
|
||||||
|
|
||||||
if (imageRep != nil)
|
if (imageRep != nil)
|
||||||
return [NSArray arrayWithObject: imageRep];
|
return [NSArray arrayWithObject: imageRep];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue