mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
62ead6a8ee
Add blur and tint mode implementation
40 lines
784 B
Swift
40 lines
784 B
Swift
import CommonCore
|
|
import DivKit
|
|
import LayoutKit
|
|
|
|
public final class ImageExtensionHandler: DivExtensionHandler {
|
|
public let id: String
|
|
private let image: ImageHolder?
|
|
|
|
public init(
|
|
id: String,
|
|
image: ImageHolder?
|
|
) {
|
|
self.id = id
|
|
self.image = image
|
|
}
|
|
|
|
public func applyBeforeBaseProperties(
|
|
to block: Block,
|
|
div _: DivBase,
|
|
context _: DivBlockModelingContext
|
|
) -> Block {
|
|
guard
|
|
let block = block as? ImageBlock,
|
|
let image = image
|
|
else {
|
|
return block
|
|
}
|
|
|
|
return ImageBlock(
|
|
imageHolder: image,
|
|
widthTrait: block.widthTrait,
|
|
height: block.height,
|
|
contentMode: block.contentMode,
|
|
tintColor: block.tintColor,
|
|
tintMode: block.tintMode,
|
|
effects: block.effects
|
|
)
|
|
}
|
|
}
|