Coder Social home page Coder Social logo

Breaking API changes for 1.0.0 about libspng HOT 10 OPEN

randy408 avatar randy408 commented on August 27, 2024
Breaking API changes for 1.0.0

from libspng.

Comments (10)

randy408 avatar randy408 commented on August 27, 2024

3d94f11 deprecates SPNG_DECODE_USE_* flags.

from libspng.

randy408 avatar randy408 commented on August 27, 2024

struct spng_bkgd.plte_index is an uint16_t, it should be uint8_t.

from libspng.

randy408 avatar randy408 commented on August 27, 2024

Consider combining spng_ctx_new() and spng_ctx_new2() and changing the return value to int.

from libspng.

randy408 avatar randy408 commented on August 27, 2024

Consider renaming spng_set_png_buffer/stream() to something like spng_set_src_buffer/stream() to allow for more consistent function names once encode support is added, functions for setting the output buffer/stream for the encoder would be named spng_set_dst_buffer/stream().

from libspng.

randy408 avatar randy408 commented on August 27, 2024

New types could be introduced as typedefs to spng_ctx:

  • spng_dec - decoder
  • spng_enc - encoder

To simplify the API and make things clearer:

  • spng_set_*() functions would be changed to take spng_enc*
  • Functions for context creation and setting of source/destination PNG can be merged:
  • int spng_new_buffer_decoder(spng_dec**, spng_alloc*, int flags, void *buf, size_t len);
  • int spng_new_stream_decoder(spng_dec**, spng_alloc*, int flags, spng_read_fn*, void *user);
  • int spng_new_stream_encoder(spng_enc**, spng_alloc*, int flags, spng_write_fn*, void *user);

These functions could also be added without introducing the typedefs, spng_new_buffer_decoder() is more descriptive than spng_ctx_new() + spng_set_src_buffer().

from libspng.

randy408 avatar randy408 commented on August 27, 2024

spng_get_text() and spng_get_splt() should use regular int pointers for array counts and check for INT32_MAX instead of checking for unsigned overflow when adding a new entry to its internal list, the list should also be assigned to a pointer instead of making the user allocate a struct array:

spng_get_text(spng_ctx*, struct spng_text **text, int *n_text);

struct spng_text should also change to reflect the internal version.

from libspng.

randy408 avatar randy408 commented on August 27, 2024

Progressive encode/decode functions should probably not return SPNG_EOI on the last row (#205).

from libspng.

randy408 avatar randy408 commented on August 27, 2024

struct spng_chunk should have been removed from the header before the API was stabilized, this led to struct spng_unknown_chunk as a workaround.

Consider renaming the latter to the former and shortening spng_set/get_unknown_chunks() too.

from libspng.

randy408 avatar randy408 commented on August 27, 2024

struct spng_ihdr.color_type is currently uint8_t, enum spng_color_type would be better.

from libspng.

randy408 avatar randy408 commented on August 27, 2024

Consider widening struct spng_offs.unit_specifier and struct spng_phys.unit_specifier to enums.

edit: struct spng_row_info.filter and struct spng_ihdr.interlace_method too

from libspng.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.