-
Notifications
You must be signed in to change notification settings - Fork 3
/
AnimatedGIFsCoder.swift
49 lines (37 loc) · 1.09 KB
/
AnimatedGIFsCoder.swift
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
//
// AnimatedGIFsCoder.swift
// ImageX
//
// Created by Condy on 2023/7/15.
//
import Foundation
import Harbeth
public struct AnimatedGIFsCoder: AnimatedCodering {
public var data: Data
public var imageSource: CGImageSource?
public var frameCount: Int = 0
public var format: AssetType {
.gif
}
public var unclampedDelayTimeProperty: String {
String(kCGImagePropertyGIFUnclampedDelayTime)
}
public var delayTimeProperty: String {
String(kCGImagePropertyGIFDelayTime)
}
public var dictionaryProperty: String {
String(kCGImagePropertyGIFDictionary)
}
public init(data: Data) {
self.data = data
}
public func decodedCGImage(options: ImageCoderOptions, index: Int) -> CGImage? {
guard canDecode(), let imageSource = self.imageSource else {
return nil
}
return imageSource.img.toCGImage(index: index)
}
public static func encodeImage(_ image: Harbeth.C7Image, options: ImageCoderOptions) -> Data? {
return nil
}
}