The Wayback Machine - https://web.archive.org/web/20201021144647/https://github.com/SwifterSwift/SwifterSwift/issues/849
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIImage.filled(withColor: ) missing clip mask above iOS10 #849

Open
miku1958 opened this issue May 22, 2020 · 1 comment
Open

UIImage.filled(withColor: ) missing clip mask above iOS10 #849

miku1958 opened this issue May 22, 2020 · 1 comment

Comments

@miku1958
Copy link

@miku1958 miku1958 commented May 22, 2020

current code

        #if !os(watchOS)
        if #available(tvOS 10.0, *) {
            let format = UIGraphicsImageRendererFormat()
            format.scale = scale
            let renderer = UIGraphicsImageRenderer(size: size, format: format)
            return renderer.image { context in
                color.setFill()
                context.fill(CGRect(origin: .zero, size: size))
            }
        }
        #endif

just render a color to image
it should add

context.cgContext.clip(to: rect, mask: mask)

before color.setFill()

and also, the result after using UIGraphicsImageRenderer is different from old version, the old version is fliped vertically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.