-
Notifications
You must be signed in to change notification settings - Fork 325
Open
Labels
UIWork related to visual components, Android Auto, Camera, 3D, voice, etc.Work related to visual components, Android Auto, Camera, 3D, voice, etc.jira-sync-completeop-exRefactoring, Tech Debt or any other operational excellence work.Refactoring, Tech Debt or any other operational excellence work.
Description
#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.
mapbox-navigation-ios/Sources/MapboxNavigation/UIImage.swift
Lines 82 to 97 in 111551d
| 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
Metadata
Metadata
Assignees
Labels
UIWork related to visual components, Android Auto, Camera, 3D, voice, etc.Work related to visual components, Android Auto, Camera, 3D, voice, etc.jira-sync-completeop-exRefactoring, Tech Debt or any other operational excellence work.Refactoring, Tech Debt or any other operational excellence work.