Panda3D

imageResize.h

00001 // Filename: imageResize.h
00002 // Created by:  drose (13Mar03)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef IMAGERESIZE_H
00016 #define IMAGERESIZE_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include "imageFilter.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : ImageResize
00024 // Description : A program to read an image file and resize it to a
00025 //               larger or smaller image file.
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 
 All Classes Functions Variables Enumerations