#2873 introduced a UIImage.tint(_:) method that uses the dated UIGraphicsBeginImageContextWithOptions(_:_:_:), UIGraphicsGetImageFromCurrentImageContext(), and UIGraphicsEndImageContext() functions. We should migrate this method to the more readable and less error-prone UIGraphicsImageRenderer API.
|
UIGraphicsBeginImageContextWithOptions(imageSize, false, imageScale) |
|
|
|
defer { UIGraphicsEndImageContext() } |
|
|
|
UIColor.black.setFill() |
|
UIRectFill(contextBounds) |
|
draw(at: .zero) |
|
|
|
guard let imageOverBlack = UIGraphicsGetImageFromCurrentImageContext() else { return self } |
|
tintColor.setFill() |
|
UIRectFill(contextBounds) |
|
|
|
imageOverBlack.draw(at: .zero, blendMode: .multiply, alpha: 1) |
|
draw(at: .zero, blendMode: .destinationIn, alpha: 1) |
|
|
|
guard let finalImage = UIGraphicsGetImageFromCurrentImageContext() else { return self } |
/ref #2928 (comment)
/cc @S2Ler
#2873 introduced a
UIImage.tint(_:)method that uses the datedUIGraphicsBeginImageContextWithOptions(_:_:_:),UIGraphicsGetImageFromCurrentImageContext(), andUIGraphicsEndImageContext()functions. We should migrate this method to the more readable and less error-prone UIGraphicsImageRenderer API.mapbox-navigation-ios/Sources/MapboxNavigation/UIImage.swift
Lines 82 to 97 in 111551d
/ref #2928 (comment)
/cc @S2Ler