Panda3D
 All Classes Functions Variables Enumerations
imageResize.h
1 // Filename: imageResize.h
2 // Created by: drose (13Mar03)
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 #ifndef IMAGERESIZE_H
16 #define IMAGERESIZE_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "imageFilter.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : ImageResize
24 // Description : A program to read an image file and resize it to a
25 // larger or smaller image file.
26 ////////////////////////////////////////////////////////////////////
27 class ImageResize : public ImageFilter {
28 public:
29  ImageResize();
30 
31  void run();
32 
33 private:
34  static bool dispatch_size_request(const string &opt, const string &arg, void *var);
35 
36  enum RequestType {
37  RT_none,
38  RT_pixel_size,
39  RT_ratio,
40  };
41  class SizeRequest {
42  public:
43  INLINE SizeRequest();
44  INLINE RequestType get_type() const;
45 
46  INLINE void set_pixel_size(int pixel_size);
47  INLINE int get_pixel_size() const;
48  INLINE int get_pixel_size(int orig_pixel_size) const;
49  INLINE void set_ratio(double ratio);
50  INLINE double get_ratio() const;
51  INLINE double get_ratio(int orig_pixel_size) const;
52 
53  private:
54  RequestType _type;
55  union {
56  int _pixel_size;
57  double _ratio;
58  } _e;
59  };
60 
61  SizeRequest _x_size;
62  SizeRequest _y_size;
63 
64  bool _use_gaussian_filter;
65  double _filter_radius;
66 };
67 
68 #include "imageResize.I"
69 
70 #endif
71 
This is the base class for a program that reads an image file, operates on it, and writes another ima...
Definition: imageFilter.h:29
A program to read an image file and resize it to a larger or smaller image file.
Definition: imageResize.h:27