packages
packages copied to clipboard
Replace deprecated UIGraphicsBeginImageContextWithOptions with UIGraphicsImageRenderer
UIGraphicsBeginImageContextWithOptions isn't technically deprecated, but API_TO_BE_DEPRECATED. However, according to reports it's crashing in iOS 17. Replace usage with UIGraphicsImageRenderer, available in iOS 10.
I kept introducing horizontal flipping bugs when I was writing this, but it wasn't causing test failures. Changed the test images from a single color to a gradient with different colors in each corner, then updated the tests to confirm the orientation is still correct.
Generated the test image with ImageMagick:
magick \( xc:red xc:blue +append \) \( xc:yellow xc:cyan +append \) -append -filter triangle -resize 12x7\! jpgImage.jpg
Also avoid doing extra work if there's nothing to scale, and return the original image.
Fixes https://github.com/flutter/flutter/issues/144602