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

Change argument type from &CGImage to &CGImageRef #466

Open
gyk opened this issue Oct 14, 2021 · 0 comments
Open

Change argument type from &CGImage to &CGImageRef #466

gyk opened this issue Oct 14, 2021 · 0 comments

Comments

@gyk
Copy link

gyk commented Oct 14, 2021

Some methods of CGContext accept an argument image: &CGImage. CGImage will automatically call CGImageRelease when it is dropped.

The problem is, sometimes we don't actually own the CGImage. For example, I try to obtain a sys::CGImageRef from an NSImage using CGImageForProposedRect, and draw it on some CGBitmapContext with CGContext::draw_image. As the documentation says, the caller should not release the returned value. So it should be only possible to convert the raw pointer to a&CGImageRef rather than a CGImage. Changing the argument type to &CGImageRef will make the interface more flexible.

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

No branches or pull requests

1 participant