ImageArgs.h

00001 # ifndef ImageArgs_h
00002 # define ImageArgs_h ImageArgs_h
00003 
00004 # include "Root.h"
00005 # include "Coord.h"  // uint8_t, uint16_t
00006 
00007 namespace Conjecture {
00008     class Image;
00009     /**********************************************************************
00010      * \class ImageArgs
00011      *
00012      * \brief A tiny service class that stores image and
00013      * pixel-filtering information.
00014      *
00015      * Instances of this class are often used as literal arguments to
00016      * Image-related methods.  See Image::Image and Glyph::writeImage
00017      * for examples.
00018      *
00019      * This class may be removed when a more general Image
00020      * infrastructure is in place!
00021      *
00022      ********************************************************************/
00023 
00024     // FUTURE FIX: Should the max values of 'threshold' and 'quantize'
00025     // be downgraded to 255? Currently uint16_t values to support max
00026     // intensities up to 65535, but this is probably entirely
00027     // unnecessary. If we put them down to uint8_t's, the structure as-is
00028     // would fit in a word.  But more fields are likely to be added.
00029     
00030     // FUTURE FIX: Should we add a 'verbose' field to this class?
00031     // Would help in Image::Image.
00032 
00033     class ImageArgs : public Root {
00034         
00035       public:
00041         ImageArgs(uint8_t magnification = 1, uint16_t threshold = 0, uint16_t quantize = 0, uint8_t filter = 0, uint8_t dustsize = 0);
00042         
00043         uint8_t  magnification() const   { return this->_magnification; }
00044         uint16_t threshold()     const   { return this->_threshold;     }
00045         uint16_t quantize()      const   { return this->_quantize;      }
00046         uint8_t  filter()        const   { return this->_filter;        }
00047         uint8_t  dustsize()      const   { return this->_dustsize;      }
00048         
00049         uint8_t&  magnification()        { return this->_magnification; }
00050         uint16_t& threshold()            { return this->_threshold;     }
00051         uint16_t& quantize()             { return this->_quantize;      }
00052         uint8_t&  filter()               { return this->_filter;        }
00053         uint8_t&  dustsize()             { return this->_dustsize;      }
00054         
00064         uint16_t apply(const Image* image, const Coord& pos) const;
00065 
00074         static const uint16_t MaxVal;
00075         static const uint16_t MinVal;
00076 
00077       private:
00087         uint8_t _magnification;
00088 
00095         uint16_t _threshold;
00096 
00105         uint16_t _quantize;
00106 
00115         uint8_t _filter;
00116         
00122         uint8_t _dustsize;
00123 
00128         std::string str() const; // printable representation
00129     };
00130 };
00131 
00132 # endif // ImageArgs_h
00133 

Generated on Wed Jun 14 15:08:02 2006 for Conjecture by  doxygen 1.4.6