00001 // Filename: imageResize.h 00002 // Created by: drose (13Mar03) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef IMAGERESIZE_H 00020 #define IMAGERESIZE_H 00021 00022 #include "pandatoolbase.h" 00023 00024 #include "imageFilter.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : ImageResize 00028 // Description : A program to read an image file and resize it to a 00029 // larger or smaller image file. 00030 //////////////////////////////////////////////////////////////////// 00031 class ImageResize : public ImageFilter { 00032 public: 00033 ImageResize(); 00034 00035 void run(); 00036 00037 private: 00038 static bool dispatch_size_request(const string &opt, const string &arg, void *var); 00039 00040 enum RequestType { 00041 RT_none, 00042 RT_pixel_size, 00043 RT_ratio, 00044 }; 00045 class SizeRequest { 00046 public: 00047 INLINE SizeRequest(); 00048 INLINE RequestType get_type() const; 00049 00050 INLINE void set_pixel_size(int pixel_size); 00051 INLINE int get_pixel_size() const; 00052 INLINE int get_pixel_size(int orig_pixel_size) const; 00053 INLINE void set_ratio(double ratio); 00054 INLINE double get_ratio() const; 00055 INLINE double get_ratio(int orig_pixel_size) const; 00056 00057 private: 00058 RequestType _type; 00059 union { 00060 int _pixel_size; 00061 double _ratio; 00062 } _e; 00063 }; 00064 00065 SizeRequest _x_size; 00066 SizeRequest _y_size; 00067 00068 bool _use_gaussian_filter; 00069 double _filter_radius; 00070 }; 00071 00072 #include "imageResize.I" 00073 00074 #endif 00075