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_SAVER_H_ 00026 #define TARGA_SAVER_H_ 00027 00028 namespace Lamp{ 00029 00030 class BinaryWriter; 00031 00032 //------------------------------------------------------------------------------ 00033 /** 00034 * Targaセーバ 00035 * 00036 * パレット化されていない非圧縮Targaセーバ 00037 */ 00038 class TargaSaver{ 00039 public: 00040 /** 00041 * コンストラクタ 00042 */ 00043 TargaSaver(); 00044 00045 /** 00046 * デストラクタ 00047 */ 00048 virtual ~TargaSaver(); 00049 00050 /** 00051 * セーブ 00052 * @param writer バイナリライタ 00053 * @param size サイズ 00054 * @param colors 書き出す色配列 00055 */ 00056 virtual void save(BinaryWriter* writer, 00057 const DimensionI& size, const Color3c* colors); 00058 00059 /** 00060 * セーブ 00061 * @param writer バイナリライタ 00062 * @param size サイズ 00063 * @param colors 書き出す色配列 00064 */ 00065 virtual void save(BinaryWriter* writer, 00066 const DimensionI& size, const Color4c* colors); 00067 00068 /** 00069 * セーブ 00070 * @param writer バイナリライタ 00071 * @param width 幅 00072 * @param height 高さ 00073 * @param colors 書き出す色配列 00074 */ 00075 virtual void save(BinaryWriter* writer, 00076 int width, int height, const Color3c* colors); 00077 00078 /** 00079 * セーブ 00080 * @param writer バイナリライタ 00081 * @param width 幅 00082 * @param height 高さ 00083 * @param colors 書き出す色配列 00084 */ 00085 virtual void save(BinaryWriter* writer, 00086 int width, int height, const Color4c* colors); 00087 00088 /** 00089 * セーブ 00090 * @param filePath ファイルパス 00091 * @param size サイズ 00092 * @param colors 書き出す色配列 00093 */ 00094 virtual void save(const String& filePath, 00095 const DimensionI& size, const Color3c* colors); 00096 00097 /** 00098 * セーブ 00099 * @param filePath ファイルパス 00100 * @param size サイズ 00101 * @param colors 書き出す色配列 00102 */ 00103 virtual void save(const String& filePath, 00104 const DimensionI& size, const Color4c* colors); 00105 00106 /** 00107 * セーブ 00108 * @param filePath ファイルパス 00109 * @param width 幅 00110 * @param height 高さ 00111 * @param colors 書き出す色配列 00112 */ 00113 virtual void save(const String& filePath, 00114 int width, int height, const Color3c* colors); 00115 00116 /** 00117 * セーブ 00118 * @param filePath ファイルパス 00119 * @param width 幅 00120 * @param height 高さ 00121 * @param colors 書き出す色配列 00122 */ 00123 virtual void save(const String& filePath, 00124 int width, int height, const Color4c* colors); 00125 00126 protected: 00127 /** 00128 * ヘッダの書き出し 00129 * @param hasAlpha アルファを持つならtrue 00130 */ 00131 virtual void writeHeader(bool hasAlpha); 00132 00133 /** 00134 * フッタの書き出し 00135 */ 00136 virtual void writeFooter(); 00137 00138 private: 00139 // コピーコンストラクタの隠蔽 00140 TargaSaver(const TargaSaver& copy); 00141 00142 // 代入コピーの隠蔽 00143 void operator =(const TargaSaver& copy); 00144 00145 // バイナリライタ 00146 BinaryWriter* writer_; 00147 // サイズ 00148 DimensionI size_; 00149 00150 // フッタ 00151 static const char footer_[]; 00152 }; 00153 00154 //------------------------------------------------------------------------------ 00155 } // End of namespace Lamp 00156 #endif // End of TARGA_SAVER_H_ 00157 //------------------------------------------------------------------------------ 00158