writePNG.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Daniele Panozzo <daniele.panozzo@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_PNG_WRITE_PNG_H
  9. #define IGL_PNG_WRITE_PNG_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <string>
  13. namespace igl
  14. {
  15. namespace png
  16. {
  17. // Writes an image to a png file
  18. //
  19. // Input:
  20. // R,G,B,A texture channels
  21. // Output:
  22. // png_file path to .png file
  23. // Returns true on success, false on failure
  24. //
  25. IGL_INLINE bool writePNG
  26. (
  27. const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
  28. const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
  29. const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& B,
  30. const Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& A,
  31. const std::string png_file
  32. );
  33. }
  34. }
  35. #ifndef IGL_STATIC_LIBRARY
  36. # include "writePNG.cpp"
  37. #endif
  38. #endif