Image Component Library (ICL)
|
00001 /******************************************************************** 00002 ** Image Component Library (ICL) ** 00003 ** ** 00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** 00005 ** Neuroinformatics Group ** 00006 ** Website: www.iclcv.org and ** 00007 ** http://opensource.cit-ec.de/projects/icl ** 00008 ** ** 00009 ** File : ICLUtils/src/ICLUtils/Size.h ** 00010 ** Module : ICLUtils ** 00011 ** Authors: Christof Elbrechter, Robert Haschke ** 00012 ** ** 00013 ** ** 00014 ** GNU LESSER GENERAL PUBLIC LICENSE ** 00015 ** This file may be used under the terms of the GNU Lesser General ** 00016 ** Public License version 3.0 as published by the ** 00017 ** ** 00018 ** Free Software Foundation and appearing in the file LICENSE.LGPL ** 00019 ** included in the packaging of this file. Please review the ** 00020 ** following information to ensure the license requirements will ** 00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** 00022 ** ** 00023 ** The development of this software was supported by the ** 00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** 00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** 00026 ** Forschungsgemeinschaft (DFG) in the context of the German ** 00027 ** Excellence Initiative. ** 00028 ** ** 00029 ********************************************************************/ 00030 00031 #pragma once 00032 00033 #include <ICLUtils/CompatMacros.h> 00034 #include <string> 00035 #include <iostream> 00036 00037 #ifdef ICL_HAVE_IPP 00038 #include <ipp.h> 00039 #endif 00040 00041 namespace icl { 00042 namespace utils{ 00043 #ifndef ICL_HAVE_IPP 00044 00045 struct IppiSize { 00046 // width 00047 int width; 00048 00049 // height 00050 int height; 00051 }; 00052 00053 #else 00054 #endif 00055 00057 class Size32f; 00060 00061 class ICLUtils_API Size : public IppiSize{ 00062 public: 00064 static const Size null; 00065 00067 static const Size QQVGA; 00068 00070 static const Size CGA; 00071 00073 static const Size QVGA; 00074 00076 static const Size HVGA; 00077 00079 static const Size EGA; 00080 00082 static const Size VGA; 00083 00085 static const Size WVGA; 00086 00088 static const Size SVGA; 00089 00091 static const Size QHD; 00092 00094 static const Size DVGA; 00095 00097 static const Size XGA; 00098 00100 static const Size XGAP; 00101 00103 static const Size DSVGA; 00104 00106 static const Size HD720; 00107 00109 static const Size WXGA; 00110 00112 static const Size WXGAP; 00113 00115 static const Size SXVGA; 00116 00118 static const Size SXGA; 00119 00121 static const Size WSXGA; 00122 00124 static const Size SXGAP; 00125 00127 static const Size WSXGAP; 00128 00130 static const Size UXGA; 00131 00133 static const Size HD1080; 00134 00136 static const Size WUXGA; 00137 00139 static const Size UD; 00140 00141 00142 // video formats 00143 00145 static const Size CIF; 00146 00148 static const Size SIF; 00149 00151 static const Size SQCIF; 00152 00154 static const Size QCIF; 00155 00157 static const Size PAL; 00158 00160 static const Size NTSC; 00161 00163 inline Size(){ this->width = 0; this->height = 0; } 00164 00166 inline Size(const Size &s){ this->width = s.width;this->height = s.height; } 00167 00169 inline Size(int width,int height){ this->width = width; this->height = height; } 00170 00172 explicit Size(const std::string &name); 00173 00175 Size(const Size32f &other); 00176 00178 bool isNull() const { return (*this)==null; } 00179 00181 bool operator==(const Size &s) const {return width==s.width && height==s.height;} 00182 00184 bool operator!=(const Size &s) const {return width!=s.width || height!=s.height;} 00185 00187 Size operator+(const Size &s) const {return Size(width+s.width,height+s.height);} 00188 00190 Size operator-(const Size &s) const {return Size(width-s.width,height-s.height);} 00191 00193 Size operator*(double d) const { return Size((int)(d*width),(int)(d*height));} 00194 00196 Size operator/(double d) const { return (*this)*(1.0/d); } 00197 00199 Size& operator+=(const Size &s){width+=s.width; height+=s.height; return *this;} 00200 00202 Size& operator-=(const Size &s){width-=s.width; height-=s.height; return *this;} 00203 00205 Size& operator*=(double d) {width=(int)((float)width*d); height=(int)((float)height*d); return *this;}; 00206 00208 Size& operator/=(double d) { return (*this)*=(1.0/d); } 00209 00211 int getDim() const {return width*height;} 00212 }; 00213 00215 ICLUtils_API std::ostream &operator<<(std::ostream &os, const Size &s); 00216 00218 00219 ICLUtils_API std::istream &operator>>(std::istream &is, Size &s); 00220 00221 } // namespace utils 00222 }// namespace icl 00223