// An `FLAnimatedImage`'s job is to deliver frames in a highly performant way and works in conjunction with `FLAnimatedImageView`.
// It subclasses `NSObject` and not `UIImage` because it's only an "image" in the sense that a sea lion is a lion.
// It tries to intelligently choose the frame cache size depending on the image and memory situation with the goal to lower CPU usage for smaller ones, lower memory usage for larger ones and always deliver frames for high performant play-back.
// Note: `posterImage`, `size`, `loopCount`, `delayTimes` and `frameCount` don't change after successful initialization.
//
@interfaceFLAnimatedImage:NSObject
@property(nonatomic,strong,readonly)UIImage*posterImage;// Guaranteed to be loaded; usually equivalent to `-imageLazilyCachedAtIndex:0`
@property(nonatomic,assign,readonly)CGSizesize;// The `.posterImage`'s `.size`
@property(nonatomic,assign,readonly)NSUIntegerloopCount;// 0 means repeating the animation indefinitely
@property(nonatomic,strong,readonly)NSDictionary*delayTimesForIndexes;// Of type `NSTimeInterval` boxed in `NSNumber`s
@property(nonatomic,assign,readonly)NSUIntegerframeCount;// Number of valid frames; equal to `[.delayTimes count]`
@property(nonatomic,assign,readonly)NSUIntegerframeCacheSizeCurrent;// Current size of intelligently chosen buffer window; can range in the interval [1..frameCount]
@property(nonatomic,assign)NSUIntegerframeCacheSizeMax;// Allow to cap the cache size; 0 means no specific limit (default)
// Intended to be called from main thread synchronously; will return immediately.
// If the result isn't cached, will return `nil`; the caller should then pause playback, not increment frame counter and keep polling.
// After an initial loading time, depending on `frameCacheSize`, frames should be available immediately from the cache.
// Copyright (c) 2013-2015 Flipboard. All rights reserved.
//
#import <UIKit/UIKit.h>
@classFLAnimatedImage;
@protocolFLAnimatedImageViewDebugDelegate;
//
// An `FLAnimatedImageView` can take an `FLAnimatedImage` and plays it automatically when in view hierarchy and stops when removed.
// The animation can also be controlled with the `UIImageView` methods `-start/stop/isAnimating`.
// It is a fully compatible `UIImageView` subclass and can be used as a drop-in component to work with existing code paths expecting to display a `UIImage`.
// Under the hood it uses a `CADisplayLink` for playback, which can be inspected with `currentFrame` & `currentFrameIndex`.
//
@interfaceFLAnimatedImageView:UIImageView
// Setting `[UIImageView.image]` to a non-`nil` value clears out existing `animatedImage`.
// And vice versa, setting `animatedImage` will initially populate the `[UIImageView.image]` to its `posterImage` and then start animating and hold `currentFrame`.
// The animation runloop mode. Enables playback during scrolling by allowing timer events (i.e. animation) with NSRunLoopCommonModes.
// To keep scrolling smooth on single-core devices such as iPhone 3GS/4 and iPod Touch 4th gen, the default run loop mode is NSDefaultRunLoopMode. Otherwise, the default is NSDefaultRunLoopMode.