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

Image Encoder: write with progress #1695

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

johannesvollmer
Copy link
Contributor

@johannesvollmer johannesvollmer commented Apr 2, 2022

see #1488

Note: For backwards compatibility, unlike the reader, the writer adds a default implementation for write_with_progress, instead of implementing write in terms of write_with_progress. This way, we can add progress tracking to the individual image writers one by one.

On the other hand, not implementing it now might result in it never being implemented

@johannesvollmer johannesvollmer marked this pull request as ready for review April 7, 2022 17:39
@@ -259,12 +259,12 @@ impl<W: Write> FarbfeldEncoder<W> {

/// Encodes the image ```data``` (native endian)
/// that has dimensions ```width``` and ```height```
pub fn encode(self, data: &[u8], width: u32, height: u32) -> ImageResult<()> {
self.encode_impl(data, width, height)?;
pub fn encode<F: FnMut(Progress)>(self, data: &[u8], width: u32, height: u32, progress: F) -> ImageResult<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this an API breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure seems like it. We could rewrite this part such that only new methods are added and none of the existing are modified

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