fix(transcription): fix transcription in dark mode
This commit is contained in:
@@ -40,9 +40,13 @@ class HandwritingRecognizer {
|
|||||||
context.setFillColor(UIColor.white.cgColor)
|
context.setFillColor(UIColor.white.cgColor)
|
||||||
context.fill(CGRect(origin: .zero, size: bounds.size))
|
context.fill(CGRect(origin: .zero, size: bounds.size))
|
||||||
|
|
||||||
// Draw the PKDrawing
|
// Force light mode appearance to ensure dark ink on white background
|
||||||
let drawingImage = drawing.image(from: bounds, scale: scale)
|
let lightTraits = UITraitCollection(userInterfaceStyle: .light)
|
||||||
drawingImage.draw(at: .zero)
|
var drawingImage: UIImage!
|
||||||
|
lightTraits.performAsCurrent {
|
||||||
|
drawingImage = drawing.image(from: bounds, scale: scale)
|
||||||
|
}
|
||||||
|
drawingImage.draw(at: CGPoint.zero)
|
||||||
|
|
||||||
guard let image = UIGraphicsGetImageFromCurrentImageContext() else {
|
guard let image = UIGraphicsGetImageFromCurrentImageContext() else {
|
||||||
UIGraphicsEndImageContext()
|
UIGraphicsEndImageContext()
|
||||||
|
|||||||
Reference in New Issue
Block a user