forked from czqasngit/BerryPlant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.md
85 lines (61 loc) · 2.23 KB
/
README.md
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# BerryPlant
[](https://travis-ci.org/czqasngit/BerryPlant)
[](https://cocoapods.org/pods/BerryPlant)
[](https://cocoapods.org/pods/BerryPlant)
[](https://cocoapods.org/pods/BerryPlant)
A swift image kit for iOS to display/decode WebP,APNG,GIF,PNG,JPG and more.
Decode image on async thread and render when runloop idle.

## Futures
Decode and display WEBP,APNG,GIF,PNG and so on
## Usage
```
self.imageView = BerryAnimateImage(data, frame: CGRect(x: 0, y: 200, width: self.view.frame.size.width, height: 300), cache: BerryAnimateImage.Policy.noCache)
self.view.addSubview(self.imageView)
self.imageView.contentMode = .scaleAspectFit
self.imageView.animationRepeatCount = 0
```
## Animation control
```
self.imageView.startAnimating()
self.imageView.stopAnimating()
```
## Get real format
```
static public func getImageFormat(_ data: Data) -> BerryImageFormat
```
Find image decoder
```
public func FindImageDecoder(with data: Data) -> BerryImageProvider
```
## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Installation
Berry is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
# **Don't use 'use_frameworks!'**
```ruby
pod 'Berry'
```
### Add fix code
```
post_install do |installer|
FixBerryUmbrella()
end
def FixBerryUmbrella
berry_unbrella_file_path = (Dir::pwd + '/Pods/Headers/Public/BerryPlant/BerryPlant-umbrella.h')
File.open(berry_unbrella_file_path,"r:utf-8") do |lines|
buffer = lines.read
buffer = buffer.gsub("decode.h","WebP/decode.h")
buffer = buffer.gsub("encode.h","WebP/encode.h")
buffer = buffer.gsub("types.h","WebP/types.h")
File.open(berry_unbrella_file_path,"w"){|l|
l.write(buffer)
}
end
end
```
## Author
czqasn, [email protected]
## License
Berry is available under the MIT license. See the LICENSE file for more info.