|
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;
织梦好,好织梦 |
上一篇:如何设置二级网管,不会导致@make命令的滥用下一篇:修改RunGate,减少卡机现象
|