Merge pull request #2071 from dreampiggy/macOS_isGIF_implementation
Implements -[NSImage isGIF] method to return whether current NSImage is GIF representation.
This commit is contained in:
commit
66289772b5
|
@ -23,7 +23,18 @@
|
|||
}
|
||||
|
||||
- (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
|
||||
|
|
Loading…
Reference in New Issue