123456789101112131415161718192021222324252627282930313233 |
- //
- // WebPProcessor.swift
- // Pods
- //
- // Created by yeatse on 2016/10/19.
- //
- //
- import Foundation
- import Kingfisher
- public struct WebPProcessor: ImageProcessor {
- public static let `default` = WebPProcessor()
- public let identifier = "com.yeatse.WebPProcessor"
- public init() {}
- public func process(item: ImageProcessItem, options: KingfisherParsedOptionsInfo) -> KFCrossPlatformImage? {
- switch item {
- case .image(let image):
- return image
- case .data(let data):
- if data.isWebPFormat {
- return KingfisherWrapper<KFCrossPlatformImage>.image(webpData: data, scale: options.scaleFactor, onlyFirstFrame: options.onlyLoadFirstFrame)
- } else {
- return DefaultImageProcessor.default.process(item: item, options: options)
- }
- }
- }
- }
|