Image.hh
00001 /* 00002 * Copyright 2011 Nate Koenig & Andrew Howard 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 */ 00017 /* Desc: Image class 00018 * Author: Nate Koenig 00019 * Date: 14 July 2008 00020 * SVN: $Id$ 00021 */ 00022 00023 #ifndef IMAGE_HH 00024 #define IMAGE_HH 00025 00026 #include <string> 00027 #include <FreeImage.h> 00028 00029 #include "common/Color.hh" 00030 00031 namespace gazebo 00032 { 00033 namespace common 00034 { 00035 00038 00040 class Image 00041 { 00043 public: Image(); 00044 00046 public: virtual ~Image(); 00047 00049 public: int Load(const std::string &filename); 00050 00057 public: void SetFromData( const unsigned char *data, unsigned int width, 00058 unsigned int height, int scanline_bytes, unsigned int bpp); 00059 00063 public: void GetData( unsigned char **data, unsigned int &count ); 00064 00066 public: unsigned int GetWidth() const; 00067 00069 public: unsigned int GetHeight() const; 00070 00072 public: unsigned int GetBPP() const; 00073 00075 public: Color GetPixel(unsigned int x, unsigned int y); 00076 00078 public: Color GetAvgColor(); 00079 00081 public: Color GetMaxColor(); 00082 00084 public: void Rescale(int width, int height); 00085 00087 //public: void RenderOpengl(float destW, float destH); 00088 00090 public: bool Valid() const; 00091 00093 public: std::string GetFilename() const; 00094 00096 private: static int count; 00097 00098 private: FIBITMAP *bitmap; 00099 00100 private: std::string fullName; 00101 }; 00103 } 00104 00105 } 00106 #endif

1.7.5.1