readPNG.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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_READ_PNG_H
  9. #define IGL_PNG_READ_PNG_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <string>
  13. namespace igl
  14. {
  15. namespace png
  16. {
  17. // Read an image from a .png file into 4 memory buffers
  18. //
  19. // Input:
  20. // png_file path to .png file
  21. // Output:
  22. // R,G,B,A texture channels
  23. // Returns true on success, false on failure
  24. //
  25. IGL_INLINE bool readPNG(const std::string png_file,
  26. Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& R,
  27. Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& G,
  28. Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& B,
  29. Eigen::Matrix<unsigned char,Eigen::Dynamic,Eigen::Dynamic>& A
  30. );
  31. }
  32. }
  33. #ifndef IGL_STATIC_LIBRARY
  34. # include "readPNG.cpp"
  35. #endif
  36. #endif