Panda3D
imageResize.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file imageResize.h
10  * @author drose
11  * @date 2003-03-13
12  */
13 
14 #ifndef IMAGERESIZE_H
15 #define IMAGERESIZE_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "imageFilter.h"
20 
21 /**
22  * A program to read an image file and resize it to a larger or smaller image
23  * file.
24  */
25 class ImageResize : public ImageFilter {
26 public:
27  ImageResize();
28 
29  void run();
30 
31 private:
32  static bool dispatch_size_request(const std::string &opt, const std::string &arg, void *var);
33 
34  enum RequestType {
35  RT_none,
36  RT_pixel_size,
37  RT_ratio,
38  };
39  class SizeRequest {
40  public:
41  INLINE SizeRequest();
42  INLINE RequestType get_type() const;
43 
44  INLINE void set_pixel_size(int pixel_size);
45  INLINE int get_pixel_size() const;
46  INLINE int get_pixel_size(int orig_pixel_size) const;
47  INLINE void set_ratio(double ratio);
48  INLINE double get_ratio() const;
49  INLINE double get_ratio(int orig_pixel_size) const;
50 
51  private:
52  RequestType _type;
53  union {
54  int _pixel_size;
55  double _ratio;
56  } _e;
57  };
58 
59  SizeRequest _x_size;
60  SizeRequest _y_size;
61 
62  bool _use_gaussian_filter;
63  double _filter_radius;
64 };
65 
66 #include "imageResize.I"
67 
68 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class for a program that reads an image file, operates on it, and writes another ima...
Definition: imageFilter.h:26
A program to read an image file and resize it to a larger or smaller image file.
Definition: imageResize.h:25
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.