SDWebImageDecoder.h
1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* This file is part of the SDWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* Created by james <https://github.com/mystcolor> on 9/28/11.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import <Foundation/Foundation.h>
#import "SDWebImageCompat.h"
@protocol SDWebImageDecoderDelegate;
/**
* Decoding image data is the most expensive step, and it is performed on the main thread. SDWebImageDecoder force the
* image decoding in a separate thread so UIImage will have high chance to reuse the cached result when used by UI in
* the main thread.
*
* @see https://github.com/rs/SDWebImage/pull/18
*/
@interface SDWebImageDecoder : NSObject
{
NSOperationQueue *imageDecodingQueue;
}
/**
* Returns a shared global instance of image decoder
*
* @return An SDWebImageDecoder shared instance
*/
+ (SDWebImageDecoder *)sharedImageDecoder;
/**
* Pre-decode a given image in a separate thread.
*
* @param image The image to pre-decode
* @param delegate The object to notify once pre-decoding is completed
* @param info A user info object
*/
- (void)decodeImage:(UIImage *)image withDelegate:(id <SDWebImageDecoderDelegate>)delegate userInfo:(NSDictionary *)info;
@end
/**
* Delegate protocol for SDWebImageDecoder
*/
@protocol SDWebImageDecoderDelegate <NSObject>
/**
* Called when pre-decoding is completed
*
* @param decoder The image decoder instance
* @param image The pre-decoded image
* @param userInfo the provided user info dictionary
*/
- (void)imageDecoder:(SDWebImageDecoder *)decoder didFinishDecodingImage:(UIImage *)image userInfo:(NSDictionary *)userInfo;
@end
@interface UIImage (ForceDecode)
+ (UIImage *)decodedImageWithImage:(UIImage *)image;
@end