Files
PINRemoteImage/Pod/Classes/PINProgressiveImage.h
Wendy Lu 0e81f77d16 Have PINProgressiveImage pass back the quality of the current progressive image (#185)
* Have PINProgressiveImage pass back the quality of the current progressive image
* fix
* Check for nil for imageProgress pointer
* Rename some variables
* Rename a bunch of things
* Update comment
2016-04-13 07:42:37 -07:00

47 lines
1.6 KiB
Objective-C

//
// PINProgressiveImage.h
// Pods
//
// Created by Garrett Moon on 2/9/15.
//
//
#import <Foundation/Foundation.h>
#if PIN_TARGET_IOS
#import <UIKit/UIKit.h>
#elif PIN_TARGET_MAC
#import <Cocoa/Cocoa.h>
#endif
#import "PINRemoteImageMacros.h"
/** An object which store the data of a downloading image and vends progressive scans **/
@interface PINProgressiveImage : NSObject
@property (atomic, copy, nonnull) NSArray *progressThresholds;
@property (atomic, assign) CFTimeInterval estimatedRemainingTimeThreshold;
@property (atomic, assign) CFTimeInterval startTime;
- (void)updateProgressiveImageWithData:(nonnull NSData *)data expectedNumberOfBytes:(int64_t)expectedNumberOfBytes;
/**
Returns the latest image based on thresholds, returns nil if no new image is generated
@param blurred A boolean to indicate if the image should be blurred
@param maxProgressiveRenderSize the maximum dimensions at which to apply a blur. If an image exceeds either the height
or width of this dimension, the image will *not* be blurred regardless of the blurred parameter.
@param renderedImageQuality Value between 0 and 1. Computed by dividing the received number of bytes by the expected number of bytes
@return PINImage a progressive scan of the image or nil if a new one has not been generated
*/
- (nullable PINImage *)currentImageBlurred:(BOOL)blurred maxProgressiveRenderSize:(CGSize)maxProgressiveRenderSize renderedImageQuality:(nonnull out CGFloat *)renderedImageQuality;
/**
Returns the current data for the image.
@return NSData the current data for the image
*/
- (nullable NSData *)data;
@end