function Tform1.bmptojpg(Bmp: TBitmap; Quality: Integer = 100): TJpegImage; //将bmp转换为jpg begin result:=nil; if assigned(Bmp) then begin result:=TjpegImage.Create; result.Assign(Bmp); result.CompressionQuality:=Quality; result.JPEGNeeded; result.Compress; end; end;procedure TForm1.Timer1Timer(Sender: TObject); ... begin ... if ((fileExt='SWF') or (fileExt='EXE') ) then begin jpg:=bmptojpg(bmp,50); jpgname:=BmpPaths+'temp'; jpg.SaveToFile(jpgname); jpgobj.makepicture(x1,y1,x2,y2,x2/20,y2/20,jpgname); swf.addobject(jpgobj); frame:=frame+1; swf.gotoframe(frame); end; end;
各个图片直接用固定的字符等区分开来,然后你那个exe宿主,就根据这个格式将
各个图片读取出来,这样就是连续的了。
uses//需要用到的东西
//bukoo swf
JPEG,comobj, OleServer, SWFOBJSLib_TLB, ActiveX;function Tform1.RecordSwf():boolean; //录制swf文件,无声音
begin
try
swf:=createoleobject('swfObjs.swfMovie');
swf.setsize(sourceRect.Right*20,sourceRect.Bottom*20);
frame:=1;
x1:=(sourceRect.Left)*20;
y1:=(sourceRect.Top)*20;
x2:=(sourceRect.Right)*20;
y2:=(sourceRect.Bottom)*20;
swf.setframerate(Framerate);
jpgobj:=createoleobject('swfObjs.swfObject');
soudobj:=createoleobject('swfObjs.swfObject');
except
application.MessageBox('创建swf文件失败!请重试!','提示',mb_iconinformation);
result:=false;
exit;
end;result:=true;
end;那么生产EXE呢,这里采用把swf加入到exe后面的方式了,希望有能给出更好的方案的,过几天结贴
begin
result:=nil;
if assigned(Bmp) then
begin
result:=TjpegImage.Create;
result.Assign(Bmp);
result.CompressionQuality:=Quality;
result.JPEGNeeded;
result.Compress;
end;
end;procedure TForm1.Timer1Timer(Sender: TObject);
...
begin
...
if ((fileExt='SWF') or (fileExt='EXE') ) then
begin
jpg:=bmptojpg(bmp,50);
jpgname:=BmpPaths+'temp';
jpg.SaveToFile(jpgname);
jpgobj.makepicture(x1,y1,x2,y2,x2/20,y2/20,jpgname);
swf.addobject(jpgobj);
frame:=frame+1;
swf.gotoframe(frame);
end;
end;