公布传奇2图片(WIL)获取原代码DELPHI函数
function MakeBmp(FileName:String;BmpIdx:integer):TMemoryStream;
var
wil_FileName,wix_FileName:String;
MS:TfileStream;
BMP_Start,BMP_Width,BMP_High,BMP_SIZE:Integer;
HeadFileName:String;
width,high:string;
begin
Result:=TMemoryStream.Create;
//获取图形源文件名
wix_FileName:=FileName;
wil_FileName:=Copy(FileName,1,length(FileName)-4)+'.wil';
//生成图片
MS:=TFileStream.Create(wix_FileName,fmOpenRead);
ms.Position:=47+(BmpIdx-1)*4+1;
ms.Read(BMP_Start,4);//开始位置
BMP_Start:=StrToInt((IntToStr(BMP_Start)));
ms.Free;
MS:=TFileStream.Create(wil_fileName,fmOpenRead);
ms.Position:=BMP_Start;
ms.Read(BMP_Width,2);
MS.Position:=BMP_Start+2; //宽
ms.Read(BMP_High,2); //高
BMP_Width:=StrToInt(IntToStr(BMP_Width));
BMP_High:=StrToInt(IntToStr(BMP_High));
BMP_SIZE:=BMP_Width*BMP_High+54+1024;
ms.free;
HeadFileName:=AppPath+'bmphead';
MS:=TFileStream.Create(HeadFileName,fmOpenRead);
Result.CopyFrom(ms,1078);
ms.free;
Result.Position:=2;
Result.Write(bmp_size,4);
Result.Position:=18;
Result.Write(bmp_width,4);
Result.Position:=22;
Result.Write(bmp_high,4);
Result.Position:=34;
BMP_SIZE:=BMP_Width*BMP_High;
Result.Write(bmp_size,4);
Result.Size:=1078+BMP_Width*bmp_high;
Result.Position:=1078;
MS:=TFileStream.Create(wil_FileName,fmOpenRead);
ms.Position:=BMP_Start+8;
Result.CopyFrom(ms,BMP_Width*BMP_High);
Result.Position:=0;
ms.free;
end;
var
wil_FileName,wix_FileName:String;
MS:TfileStream;
BMP_Start,BMP_Width,BMP_High,BMP_SIZE:Integer;
HeadFileName:String;
width,high:string;
begin
Result:=TMemoryStream.Create;
//获取图形源文件名
wix_FileName:=FileName;
wil_FileName:=Copy(FileName,1,length(FileName)-4)+'.wil';
//生成图片
MS:=TFileStream.Create(wix_FileName,fmOpenRead);
ms.Position:=47+(BmpIdx-1)*4+1;
ms.Read(BMP_Start,4);//开始位置
BMP_Start:=StrToInt((IntToStr(BMP_Start)));
ms.Free;
MS:=TFileStream.Create(wil_fileName,fmOpenRead);
ms.Position:=BMP_Start;
ms.Read(BMP_Width,2);
MS.Position:=BMP_Start+2; //宽
ms.Read(BMP_High,2); //高
BMP_Width:=StrToInt(IntToStr(BMP_Width));
BMP_High:=StrToInt(IntToStr(BMP_High));
BMP_SIZE:=BMP_Width*BMP_High+54+1024;
ms.free;
HeadFileName:=AppPath+'bmphead';
MS:=TFileStream.Create(HeadFileName,fmOpenRead);
Result.CopyFrom(ms,1078);
ms.free;
Result.Position:=2;
Result.Write(bmp_size,4);
Result.Position:=18;
Result.Write(bmp_width,4);
Result.Position:=22;
Result.Write(bmp_high,4);
Result.Position:=34;
BMP_SIZE:=BMP_Width*BMP_High;
Result.Write(bmp_size,4);
Result.Size:=1078+BMP_Width*bmp_high;
Result.Position:=1078;
MS:=TFileStream.Create(wil_FileName,fmOpenRead);
ms.Position:=BMP_Start+8;
Result.CopyFrom(ms,BMP_Width*BMP_High);
Result.Position:=0;
ms.free;
end;
Tags:
作者:佚名评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论