00001 /* 00002 * 00003 * Copyright (C) 2004 Mekensleep 00004 * 00005 * Mekensleep 00006 * 24 rue vieille du temple 00007 * 75004 Paris 00008 * licensing@mekensleep.com 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00023 * 00024 * Author: 00025 * Igor Kravtchenko <igor@obraz.net> 00026 * 00027 * Description: 00028 * Class to load GIF, it's currently a changed version of a code that loaded GIF 00029 * with RGB promotion (without keeping the palette). This version keeps the image 00030 * as set of index inside a 256 colors palette. Would need to handle both case 00031 * at will with some user options, color index depth, etc. 00032 * 00033 */ 00034 00035 #ifndef GIFLOADER_H 00036 #define GIFLOADER_H 00037 00038 class GIFImage : public osg::Image { 00039 public: 00040 00041 GIFImage(); 00042 virtual ~GIFImage(); 00043 00044 class Color { 00045 public: 00046 unsigned char r, g, b; 00047 }; 00048 00049 void setPalette(int nbColors, Color *); 00050 virtual Color* getPalette() { return palette_; } 00051 00052 int getNbColors() const { return nbColors_; } 00053 00054 // -1 means for no transparence 00055 virtual void setTransparence(int _col) { transparence_ = _col; } 00056 virtual int getTransparentColor() const { return transparence_; } 00057 00058 protected: 00059 int transparence_; 00060 int nbColors_; 00061 Color *palette_; 00062 }; 00063 00064 #endif