//============================================================ // <T>导出多个打包到目录。</T> // // @param fileName 文件名称 // @param widthCount 横向分割个数 // @param hightCount 纵向分割个数 //============================================================ public void ExportPath(string path, int tileWidth, int tileHight, int colorCount, int widthCount, int hightCount) { // 计算分割数量 int tileCx = _bitmap.Width / tileWidth; int tileCy = _bitmap.Height / tileHight; // 分割图片 for (int y = 0; y < tileCy; y++) { for (int x = 0; x < tileCx; x++) { // 绘制局部图形 FBitmap bitmap = new FBitmap(tileWidth, tileHight); bitmap.Fill(_bitmap, tileWidth * x, tileHight * y); // 存储索引图片 string fileName = path + "_" + RString.PadLeft(y.ToString(), 2, '0') + "_" + RString.PadLeft(x.ToString(), 2, '0') + "." + EXTEND_NAME; _logger.Debug(this, "ExportPath", "Export path file. (file_name={0}, color_count={1}, width_count={2}, hight_count={3})", fileName, colorCount, widthCount, hightCount); FLzmaFile file = new FLzmaFile(); file.EnsureSize(tileWidth * tileHight); StoreCompress(file, bitmap.Native, colorCount, widthCount, hightCount); file.Compress(fileName); file.Reset(); } } }
//============================================================ // <T>导出打包文件。</T> // // @param fileName 文件名称 // @param widthCount 横向分割个数 // @param hightCount 纵向分割个数 //============================================================ public void ExportFile(string fileName, int colorCount, int widthCount, int hightCount) { _logger.Debug(this, "ExportFile", "Export file. (file_name={0}, color_count={1}, width_count={2}, hight_count={3})", fileName, colorCount, widthCount, hightCount); // 创建压缩文件 FLzmaFile file = new FLzmaFile(); file.EnsureSize(_bitmap.Width * _bitmap.Height); StoreCompress(file, _bitmap, colorCount, widthCount, hightCount); file.Compress(fileName); }