Skip to content

Conversation

@valadaptive
Copy link
Contributor

I accidentally pushed this to main (reverted it now); sorry about that.

It's nice to be able to create a Pixmap or Mask, draw into it, and then take its raw data back directly without having to do any cloning; this is a common pattern when interoperating with other libraries that have their own bitmap types.

@LaurenzV
Copy link
Contributor

Isn't there already a take method on Pixmap?

@LaurenzV
Copy link
Contributor

I guess it doesn't exist for Mask, but then it should probably also be called take for consistency.

@valadaptive
Copy link
Contributor Author

I've removed Pixmap::into_data and renamed the method to Mask::take. I've also moved the take methods on Pixmap to be just below data and data_mut--I can't remember if rustdoc sorts alphabetically, but if not, that should make them easier to find.

Copy link
Contributor

@LaurenzV LaurenzV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but the PR should be renamed to reflect the new changes.

@valadaptive valadaptive changed the title Add {Mask, Pixmap}::into_data Add Mask::take method Aug 22, 2025
@valadaptive
Copy link
Contributor Author

Renamed it.

@LaurenzV
Copy link
Contributor

Ideally shifting the methods should happen in a separate PR, but I'll leave that to you.

@valadaptive valadaptive merged commit ab40557 into linebender:main Aug 22, 2025
4 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.

2 participants