Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TASPngWriter.cxx
Go to the documentation of this file.
1#include "TASPngWriter.h"
2
3#include <afterrootpngwrite.h>
4
5#include <cerrno>
6
7/** \class TASPngWriter
8\ingroup asimage
9
10C++ wrapper over simple writer of PNG files for standard GL memory formats:
11LUMINANCE, LUMINANCE_ALPHA, RGB, and RGBA.
12*/
13
14int TASPngWriter::write_png_file(std::string_view filename)
15{
16 if ((int)row_pointers.size() != height)
17 return 1;
18
19 FILE *fp = fopen(filename.data(), "wb");
20 if (!fp)
21 return errno;
22
23 int ret = after_root_png_write(fp, width, height, color_type, bit_depth, row_pointers.data());
24 if (ret)
25 return ret;
26
27 fclose(fp);
28
29 return 0;
30}
char * ret
Definition Rotated.cxx:221
unsigned char bit_depth
unsigned char color_type
std::vector< unsigned char * > row_pointers
int write_png_file(std::string_view filename)