jo_jpeg.h 1.2 KB

123456789101112131415161718192021222324252627282930
  1. /* public domain Simple, Minimalistic JPEG writer - http://jonolick.com
  2. *
  3. * Quick Notes:
  4. * Based on a javascript jpeg writer
  5. * JPEG baseline (no JPEG progressive)
  6. * Supports 1, 3 or 4 component input. (luminance, RGB or RGBX)
  7. *
  8. * Latest revisions:
  9. * 1.52 (2012-22-11) Added support for specifying Luminance, RGB, or RGBA via comp(onents) argument (1, 3 and 4 respectively).
  10. * 1.51 (2012-19-11) Fixed some warnings
  11. * 1.50 (2012-18-11) MT safe. Simplified. Optimized. Reduced memory requirements. Zero allocations. No namespace polution. Approx 340 lines code.
  12. * 1.10 (2012-16-11) compile fixes, added docs,
  13. * changed from .h to .cpp (simpler to bootstrap), etc
  14. * 1.00 (2012-02-02) initial release
  15. *
  16. * Basic usage:
  17. * char *foo = new char[128*128*4]; // 4 component. RGBX format, where X is unused
  18. * jo_write_jpg("foo.jpg", foo, 128, 128, 4, 90); // comp can be 1, 3, or 4. Lum, RGB, or RGBX respectively.
  19. *
  20. * */
  21. // Modified by Yao Wei Tjong for Urho3D
  22. #ifndef JO_INCLUDE_JPEG_H
  23. #define JO_INCLUDE_JPEG_H
  24. // Returns false on failure
  25. bool jo_write_jpg(const char *filename, const void *data, int width, int height, int comp, int quality);
  26. #endif // JO_INCLUDE_JPEG_H