00001 //------------------------------------------------------------------------------ 00002 // Lamp : Open source game middleware 00003 // Copyright (C) 2004 Junpei Ohtani ( Email : junpee@users.sourceforge.jp ) 00004 // 00005 // This library is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // This library is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with this library; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 //------------------------------------------------------------------------------ 00019 00020 /** @file 00021 * Targaローダヘッダ 00022 * @author Junpee 00023 */ 00024 00025 #ifndef TARGA_LOADER_H_ 00026 #define TARGA_LOADER_H_ 00027 00028 namespace Lamp{ 00029 00030 class BinaryReader; 00031 00032 //------------------------------------------------------------------------------ 00033 /** 00034 * Targaローダ 00035 * 00036 * パレット化されていない非圧縮Targaローダ 00037 */ 00038 class TargaLoader{ 00039 public: 00040 /** 00041 * コンストラクタ 00042 * @param reader リーダ 00043 */ 00044 TargaLoader(BinaryReader* reader); 00045 00046 /** 00047 * コンストラクタ 00048 * @param fileName ファイル名 00049 */ 00050 TargaLoader(const String& fileName); 00051 00052 /** 00053 * デストラクタ 00054 */ 00055 virtual ~TargaLoader(); 00056 00057 /** 00058 * ヘッダのロード 00059 * @return 成功すればtrue 00060 */ 00061 virtual bool loadHeader(); 00062 00063 //-------------------------------------------------------------------------- 00064 /** 00065 * サイズの取得 00066 * @return サイズ 00067 */ 00068 virtual DimensionI getSize() const{ return size_; } 00069 00070 /** 00071 * 幅の取得 00072 * @return 幅 00073 */ 00074 virtual int getWidth() const{ return size_.width; } 00075 00076 /** 00077 * 高さの取得 00078 * @return 高さ 00079 */ 00080 virtual int getHeight() const{ return size_.height; } 00081 00082 /** 00083 * アルファを持つかどうか 00084 * @return アルファを持つならtrue 00085 */ 00086 virtual int hasAlpha() const{ return hasAlpha_; } 00087 00088 //-------------------------------------------------------------------------- 00089 /** 00090 * アルファ無しイメージのロード 00091 * @param output 出力先バッファ、(width * height) 個のカラー配列へのポインタ 00092 */ 00093 virtual void loadImage(Color3c* output); 00094 00095 /** 00096 * アルファ有りイメージのロード 00097 * @param output 出力先バッファ、(width * height) 個のカラー配列へのポインタ 00098 */ 00099 virtual void loadImage(Color4c* output); 00100 00101 //-------------------------------------------------------------------------- 00102 private: 00103 // コピーコンストラクタの隠蔽 00104 TargaLoader(const TargaLoader& copy); 00105 00106 // 代入コピーの隠蔽 00107 void operator =(const TargaLoader& copy); 00108 00109 // バイナリリーダ 00110 BinaryReader* reader_; 00111 // サイズ 00112 DimensionI size_; 00113 // アルファを持つか 00114 bool hasAlpha_; 00115 // リーダをアロケートしたか 00116 bool allocateReader_; 00117 }; 00118 00119 //------------------------------------------------------------------------------ 00120 } // End of namespace Lamp 00121 #endif // End of TARGA_LOADER_H_ 00122 //------------------------------------------------------------------------------ 00123