mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
62ead6a8ee
Add blur and tint mode implementation
30 lines
592 B
Swift
30 lines
592 B
Swift
// Copyright 2022 Yandex LLC. All rights reserved.
|
|
|
|
import CoreImage
|
|
|
|
public enum ImageGeneratorType: FilterProtocol {
|
|
case constantColor(color: CIColor)
|
|
|
|
public var name: String {
|
|
switch self {
|
|
case .constantColor:
|
|
return "CIConstantColorGenerator"
|
|
}
|
|
}
|
|
|
|
public var parameters: [String: Any] {
|
|
switch self {
|
|
case let .constantColor(color):
|
|
return [kCIInputColorKey: color]
|
|
}
|
|
}
|
|
|
|
private var filter: CIFilter? {
|
|
CIFilter(name: name, parameters: parameters)
|
|
}
|
|
|
|
public var imageGenerator: ImageGenerator {
|
|
{ filter?.outputImage }
|
|
}
|
|
}
|