Implements -[NSImage isGIF] method to return whether current NSImage is GIF representation.
This commit is contained in:
parent
04855c945e
commit
30fd6cc6ab
|
@ -23,7 +23,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isGIF {
|
- (BOOL)isGIF {
|
||||||
return NO;
|
BOOL isGIF = NO;
|
||||||
|
for (NSImageRep *rep in self.representations) {
|
||||||
|
if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
|
||||||
|
NSBitmapImageRep *bitmapRep = (NSBitmapImageRep *)rep;
|
||||||
|
NSUInteger frameCount = [[bitmapRep valueForProperty:NSImageFrameCount] unsignedIntegerValue];
|
||||||
|
if (frameCount > 1) {
|
||||||
|
isGIF = YES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isGIF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue