You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be beneficial to unify all stbi_write_xxx() funcitons to use the same arguments, so they could be be referenced with unified function pointers and so the user wouldn't have to wonder what is and what is not correct number of parameters to each and every one of them.
As they look like this:
int stbi_write_png(char const *filename, int w, int h, int comp, const void *data, int stride_in_bytes);
int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data);
int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data);
int stbi_write_jpg(char const *filename, int w, int h, int comp, const void *data, int quality);
first five arguments could stay the same and the last could be a pointer to option stucture where there would be options like stride, quality, etc.
typedef struct
{
int stride;
int clevel;
int quality;
type another_option;
} format_options_t;
int stbi_write_xxx(char const *filename, int w, int h, int comp, const void *data, *format_options_t format_options);
The options would be used as required by specific formats but would still be under one argument umbrella.
This would allow to use function pointers with ease, add options as fequired without breaking library compatibility, use multiple otions to specefic format, like for example PNG could use different compression levels beside stride.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Unify stbi_write_xxx functions
It would be beneficial to unify all stbi_write_xxx() funcitons to use the same arguments, so they could be be referenced with unified function pointers and so the user wouldn't have to wonder what is and what is not correct number of parameters to each and every one of them.
As they look like this:
first five arguments could stay the same and the last could be a pointer to option stucture where there would be options like stride, quality, etc.
The options would be used as required by specific formats but would still be under one argument umbrella.
This would allow to use function pointers with ease, add options as fequired without breaking library compatibility, use multiple otions to specefic format, like for example PNG could use different compression levels beside stride.
Beta Was this translation helpful? Give feedback.
All reactions