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

Add CGDisplayCreateImageForRect function #547

Merged
merged 1 commit into from Apr 27, 2023
Merged

Conversation

mtfcd
Copy link
Contributor

@mtfcd mtfcd commented Apr 25, 2023

Thanks for your work, this crate is very useful to me.
I have a use case to capture a portion of a display. originally I use the method screenshot, but this method will capture the mouse cursor, after some google I tried to put CGDisplayHideCursor and CGDisplayShowCursor around the screenshot. But when my program is not the foreground the cursor won't hide.
Then I found CGDisplayCreateImage and CGDisplayCreateImageForRect from apple document, these two worked fine.
I also added a image_for_rect method to wrap this unsafe one, just like image which is already there. Because the from_ptr method is from ForeignType trait, and there are some break changes in the foreign-type crates, I think it's a little odd to import a crate that is used by core-display just for this function, and had to keep the same version.
Thanks very much.

@jrmuizel jrmuizel merged commit 75f424f into servo:master Apr 27, 2023
3 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants