// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2016 Daniele Panozzo // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "writePNG.h" #include #include IGL_INLINE bool igl::png::writePNG( const Eigen::Matrix& R, const Eigen::Matrix& G, const Eigen::Matrix& B, const Eigen::Matrix& A, const std::string png_file ) { assert((R.rows() == G.rows()) && (G.rows() == B.rows()) && (B.rows() == A.rows())); assert((R.cols() == G.cols()) && (G.cols() == B.cols()) && (B.cols() == A.cols())); const int comp = 4; // 4 Channels Red, Green, Blue, Alpha const int stride_in_bytes = R.rows()*comp; // Length of one row in bytes std::vector data(R.size()*comp,0); // The image itself; for (unsigned i = 0; i