@@ -36,22 +36,23 @@ bool progress_callback(void* opaque_data, float portion_done)
3636 return (portion_done >= 1 .f );
3737}
3838
39- int main (int argc, char * argv[]) {
40- if (argc != 3 ) {
41- std::cerr << " Usage: " << argv[0 ] << " INPUT OUTPUT\n " ;
42- return 1 ;
43- }
39+ // int main(int argc, char* argv[]) {
40+ int solidify_main (const std::string& inputFileName, const std::string& outputFileName) {
41+ // if (argc != 3) {
42+ // std::cerr << "Usage: " << argv[0] << " INPUT OUTPUT\n";
43+ // return 1;
44+ // }
4445
4546 Timer g_timer;
4647
47- const char * input_filename = argv[1 ];
48- const char * output_filename = argv[2 ];
48+ // const char* input_filename = argv[0 ];
49+ // const char* output_filename = argv[1 ];
4950
5051 // Create an ImageBuf object for the input file
51- ImageBuf input_buf (input_filename );
52+ ImageBuf input_buf (inputFileName );
5253
5354 // Read the image with a progress callback
54- std::cout << " Reading " << input_filename << std::endl;
55+ std::cout << " Reading " << inputFileName << std::endl;
5556 bool read_ok = input_buf.read (0 , 0 , 0 , -1 , true , TypeUnknown, *progress_callback, nullptr );
5657 if (!read_ok) {
5758 std::cerr << " Error: Could not read input image\n " ;
@@ -75,28 +76,26 @@ int main(int argc, char* argv[]) {
7576
7677 std::cout << " Push-Pull time : " << pushpull_timer.nowText () << std::endl;
7778
78- auto out = ImageOutput::create (output_filename );
79+ auto out = ImageOutput::create (outputFileName );
7980 if (!out) {
80- std::cerr << " Could not create output file: " << output_filename << std::endl;
81+ std::cerr << " Could not create output file: " << outputFileName << std::endl;
8182 return 1 ;
8283 }
8384
8485 ImageSpec spec = result_buf.spec ();
8586 spec.nchannels = 3 ; // Only write RGB channels
8687 spec.alpha_channel = -1 ; // No alpha channel
8788
88- out->open (output_filename , spec, ImageOutput::Create);
89+ out->open (outputFileName , spec, ImageOutput::Create);
8990
90- std::cout << " Writing " << output_filename << std::endl;
91+ std::cout << " Writing " << outputFileName << std::endl;
9192
9293 out->write_image (result_buf.spec ().format , result_buf.localpixels (),
9394 result_buf.pixel_stride (), result_buf.scanline_stride (), result_buf.z_stride (),
9495 *progress_callback, nullptr );
9596 out->close ();
9697
97- std::cout << std::endl;
98-
99- std::cout << " Total processing time : " << g_timer.nowText () << std::endl;
98+ std::cout << std::endl << " Total processing time : " << g_timer.nowText () << std::endl;
10099
101100 return 0 ;
102101}
0 commit comments