Go to the documentation of this file.
4 #ifndef tools_sg_plots_viewer
5 #define tools_sg_plots_viewer
31 virtual void set_size(
unsigned int a_width,
unsigned int a_height) {
32 parent::set_size(a_width,a_height);
37 unsigned int a_cols = 1,
unsigned int a_rows = 1,
38 unsigned int a_width = 500,
unsigned int a_height = 500)
39 :parent(a_out,a_width,a_height)
64 parent::operator=(a_from);
78 typedef bool (*
png_writer)(std::ostream&,
const std::string&,
79 unsigned char*,
unsigned int,
unsigned int,
unsigned int);
88 action.zbuffer().clear_color_buffer(0);
90 action.zbuffer().clear_depth_buffer();
94 uchar* buffer =
new unsigned char[a_width*a_height*bpp];
96 m_out <<
"tools::sg::plots_viewer::write_inzb_png : can't alloc buffer." << std::endl;
99 unsigned char* pos = buffer;
101 for(
unsigned int row=0;row<a_height;row++) {
102 for(
unsigned int col=0;col<a_width;col++) {
104 *pos = (
uchar)(255.0F*r);pos++;
105 *pos = (
uchar)(255.0F*g);pos++;
106 *pos = (
uchar)(255.0F*b);pos++;
110 bool status = (*a_writer)(
m_out,a_file,buffer,a_width,a_height,bpp);
112 m_out <<
"tools::sg::plots_viewer::write_inzb_png : can't write " << a_file <<
"." << std::endl;
122 unsigned char*,
unsigned int,
unsigned int,
unsigned int,int);
131 action.zbuffer().clear_color_buffer(0);
133 action.zbuffer().clear_depth_buffer();
136 unsigned int bpp = 3;
137 uchar* buffer =
new unsigned char[a_width*a_height*bpp];
139 m_out <<
"tools::sg::plots_viewer::write_inzb_jpeg : can't alloc buffer." << std::endl;
142 unsigned char* pos = buffer;
144 for(
unsigned int row=0;row<a_height;row++) {
145 for(
unsigned int col=0;col<a_width;col++) {
147 *pos = (
uchar)(255.0F*r);pos++;
148 *pos = (
uchar)(255.0F*g);pos++;
149 *pos = (
uchar)(255.0F*b);pos++;
153 bool status = (*a_writer)(
m_out,a_file,buffer,a_width,a_height,bpp,a_quality);
155 m_out <<
"tools::sg::plots_viewer::write_inzb_jpeg : can't write " << a_file <<
"." << std::endl;
165 bool write_inzb_ps(
const std::string& a_file,
unsigned int a_width,
unsigned int a_height,
bool a_anonymous =
false) {
167 action.zbuffer().clear_color_buffer(0);
169 action.zbuffer().clear_depth_buffer();
173 m_out <<
"tools::viewplot::write_inzb_ps : can't open " << a_file <<
"." << std::endl;
190 m_out <<
"tools::plots_viewer::open_inzb_ps_file : can't open " << a_file <<
"." << std::endl;
197 action.zbuffer().clear_color_buffer(0);
199 action.zbuffer().clear_depth_buffer();
210 bool write_gl2ps(
const std::string& a_file,
int a_gl2ps_format,
unsigned int a_width,
unsigned int a_height) {
213 if(!
action.open(a_file,a_gl2ps_format))
return false;
#define TOOLS_HEADER(a__class, a__sclass, a__parent)