Wavelet and Image class library  1.3.2
ColorBuffer.hh
Go to the documentation of this file.
00001 /*
00002  * class ColorBuffer
00003  *
00004  * $Date$
00005  * $Revision$
00006  *
00007  */
00008 
00009 #ifndef COLOR_BUFFER_HH__
00010 #define COLOR_BUFFER_HH__
00011 
00012 #include "WImage/Image.hh"
00013 
00021 class
00022 ColorBuffer
00023 {
00024 public:
00032   ColorBuffer (int xysize, int colors = 3, clrmodel cmodel = cm_rgb);
00033 
00035   virtual ~ColorBuffer (void);
00036 
00041   virtual void swapColors (int ch1, int ch2);
00042 
00047   inline clrmodel colormodel (void) const { return m_cmodel; }
00050   inline int colors (void) const { return m_colors; }
00056   virtual void colormodel (clrmodel model);
00057 
00063   virtual coeff smax (void) const;
00069   virtual coeff smin (void) const;
00070 
00071 #ifndef _WIN32_WCE
00072 
00075   virtual int fileSize (char const *fname) const;
00076 #endif
00077 
00083   virtual bool equals (ColorBuffer &buf) const;
00092   virtual bool epsilons (ColorBuffer &buf, coeff epsilon) const;
00093 
00102   virtual void truncate (coeff min = 0, coeff max = 255);
00103 
00119   virtual void beautify (int yoffs = 0, int xoffs = 0,
00120                          int ysize = 0, int xsize = 0) = 0;
00121 
00130   virtual coeff averageColor (int fromY = 0, int fromX = 0,
00131                               int toY = -1, int toX = -1);
00132 
00141   virtual unsigned char *toPixmap (clrmodel cmodel);
00142 
00146   inline int rows (void) const { return m_images[0]->rows (); }
00150   inline int cols (void) const { return m_images[0]->cols (); }
00154   inline int size (void) const { return m_images[0]->size (); }
00155 
00156 protected:
00157   /* The way the current image's colors are encoded. */
00158   clrmodel m_cmodel;
00160   int m_xsize;
00162   int m_ysize;
00164   int m_xysize;
00166   int m_colors;
00168   Image **m_images;
00170   bool m_isReference;
00176   void init (int colors, clrmodel cmodel = cm_rgb);
00178   virtual void destroy (void);
00180   virtual void valadjust (void);
00181 }; /* class ColorBuffer */
00182 
00185 #endif /* COLOR_BUFFER_HH__ */
00186 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines