00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef IMAGERESIZE_H
00016 #define IMAGERESIZE_H
00017
00018 #include "pandatoolbase.h"
00019
00020 #include "imageFilter.h"
00021
00022
00023
00024
00025
00026
00027 class ImageResize : public ImageFilter {
00028 public:
00029 ImageResize();
00030
00031 void run();
00032
00033 private:
00034 static bool dispatch_size_request(const string &opt, const string &arg, void *var);
00035
00036 enum RequestType {
00037 RT_none,
00038 RT_pixel_size,
00039 RT_ratio,
00040 };
00041 class SizeRequest {
00042 public:
00043 INLINE SizeRequest();
00044 INLINE RequestType get_type() const;
00045
00046 INLINE void set_pixel_size(int pixel_size);
00047 INLINE int get_pixel_size() const;
00048 INLINE int get_pixel_size(int orig_pixel_size) const;
00049 INLINE void set_ratio(double ratio);
00050 INLINE double get_ratio() const;
00051 INLINE double get_ratio(int orig_pixel_size) const;
00052
00053 private:
00054 RequestType _type;
00055 union {
00056 int _pixel_size;
00057 double _ratio;
00058 } _e;
00059 };
00060
00061 SizeRequest _x_size;
00062 SizeRequest _y_size;
00063
00064 bool _use_gaussian_filter;
00065 double _filter_radius;
00066 };
00067
00068 #include "imageResize.I"
00069
00070 #endif
00071