93 unsigned int number = a_cols*a_rows;
94 if(number!=a_files.size()) {
95 a_out <<
"tools::image::concatenate :"
96 <<
" bad number of files. " << number <<
" expected."
98 a_bpp = a_w = a_h = 0;
101 if(a_files.empty()) {
102 a_out <<
"tools::image::concatenate :"
103 <<
" list of files is empty."
105 a_bpp = a_w = a_h = 0;
111 unsigned int bpp1 = 0;
113 typedef unsigned char* buffer_t;
114 buffer_t* bs =
new buffer_t[number];
115 {
for(
unsigned int i=0;i<number;i++) {bs[i] = 0;}}
117 bool read_failed =
false;
118 unsigned int index = 0;
119 for(
unsigned int j=0;j<a_rows;j++) {
120 for(
unsigned int i=0;i<a_cols;i++) {
121 const std::string& file = a_files[index];
122 unsigned int w,h,bpp;
123 unsigned char* b = a_file_reader(a_out,file,w,h,bpp);
125 a_out <<
"tools::image::concatenate :"
126 <<
" can't read " << file <<
" expected."
137 a_out <<
"tools::image::concatenate :"
139 <<
" does not have same width image as the first file one."
140 <<
" (" << w <<
"," << w1 <<
")."
147 a_out <<
"tools::image::concatenate :"
149 <<
" does not have same height image as the first file one."
150 <<
" (" << h <<
"," << h1 <<
")."
157 a_out <<
"tools::image::concatenate :"
159 <<
" does not have same bytes per pixel as the first file one."
160 <<
" (" << h <<
"," << h1 <<
")."
172 if(read_failed)
break;
176 {
for(
unsigned int i=0;i<number;i++) {
delete [] bs[i];}}
177 a_bpp = a_w = a_h = 0;
182 unsigned char* ba =
image::concatenate(bs,w1,h1,bpp1,a_cols,a_rows,a_bw,a_bh,a_bc,wa,ha);
184 a_out <<
"tools::image::concatenate :"
185 <<
" failed to concatenate all buffers."
187 {
for(
unsigned int i=0;i<number;i++) {
delete [] bs[i];}}
188 a_bpp = a_w = a_h = 0;
192 {
for(
unsigned int i=0;i<number;i++) {
delete [] bs[i];}}