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

Suggestion: Filter parameter for tdefl_write_image_to_png_file_in_memory() #30

Open
GoogleCodeExporter opened this issue May 21, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

The simple PNG writer sets all of the rows to unfiltered '0' 
I've made a low-profile change to the method in miniz.c in my own code to 
accept a pre-filtered input image. It simply passes an array of filter types to 
the function, and places them in the image data to be compressed.

tdefl_write_image_to_png_file_in_memory_ex()
line 2802 : Add parameter "mz_uint8* filters"
line 2813 : Replace second parameter of the first call to 
tdefl_compress_buffer() [&z] 
            with (filters == NULL ? &t : filters+(flip ? (h - 1 - y) : y))

tdefl_write_image_to_png_file_in_memory()
line 2831 : Add parameter "mz_uint8* filters"
line 2834 : Pass filters to tdefl_write_image_to_png_file_in_memory_ex()

Alternatively, set the parameter to NULL on line 2834 to reduce the impact on 
the API 

I'm using t (mz_uint8) instead of z (int), because the function is passing a 
byte of data. In face, z should probably also be mz_uint8 for its use in 
writing the header. 

Original issue reported on code.google.com by Lok...@gmail.com on 25 Jan 2014 at 6:35

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

No branches or pull requests

2 participants