Panda3D
 All Classes Functions Variables Enumerations
imageReader.cxx
1 // Filename: imageReader.cxx
2 // Created by: drose (19Jun00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "imageReader.h"
16 
17 ////////////////////////////////////////////////////////////////////
18 // Function: ImageReader::Constructor
19 // Access: Public
20 // Description:
21 ////////////////////////////////////////////////////////////////////
22 ImageReader::
23 ImageReader() {
24  clear_runlines();
25  add_runline("[opts] imagename");
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: ImageReader::handle_args
30 // Access: Protected, Virtual
31 // Description:
32 ////////////////////////////////////////////////////////////////////
33 bool ImageReader::
34 handle_args(ProgramBase::Args &args) {
35  if (args.empty()) {
36  nout << "You must specify the image file to read on the command line.\n";
37  return false;
38  }
39 
40  if (args.size() > 1) {
41  nout << "Specify only one image on the command line.\n";
42  return false;
43  }
44 
45  if (!_image.read(args[0])) {
46  nout << "Unable to read image file " << args[0] << ".\n";
47  exit(1);
48  }
49 
50  return true;
51 }