Insert gif is ok,but cannot load the stream
Posted: Thu Dec 22, 2011 6:14 pm
dear sir,now I do a demo about insert gif ,save to stream,and load from stream.(the bmp,jpg,png,etc is all ok,only the gif is not ok)
1.down http://www.trichview.com/resources/thir ... fimage.zip
2.Use RVGifAnimate,GifImage(and set RichView.AnimationMode = rvaniOnFormat).
3.
initialization
TPicture.RegisterFileFormat('gif','Gif Image',TGifImage);
(It looks like not importent)
4.insert the gif file:
pic := TPicture.Create;
try
pic.LoadFromFile(OpenDialog1.FileName);
gr := RV_CreateGraphics(TGraphicClass(pic.Graphic.ClassType));
gr.Assign(pic.Graphic);
rve.TopLevelEditor.BeginUndoGroup(rvutInsert);
rve.TopLevelEditor.SetUndoGroupMode(True);
try
rve.InsertPicture('', gr, rvvaBaseline)
finally
rve.TopLevelEditor.SetUndoGroupMode(False);
end;
finally
pic.Free;
end;
===================================
1-4 steps work normally.
5.save to the stream:
TS := TStringStream.Create('');
try
rve.SaveRVFToStream(TS,False);
TS.Position := 0;
Memo1.Lines.Text := TS.DataString;
finally
TS.Free;
end;
( transport the data by tcp/ip sometimes,so not use memory stream)
6.load from the stream:
TS := TStringStream.Create(Memo1.Lines.Text);
try
TS.Position := 0;
rve.LoadRVFFromStream(TS);
finally
TS.Free;
end;
===================================
The gif picture can not show normally.
maybe I lost some steps?
1.down http://www.trichview.com/resources/thir ... fimage.zip
2.Use RVGifAnimate,GifImage(and set RichView.AnimationMode = rvaniOnFormat).
3.
initialization
TPicture.RegisterFileFormat('gif','Gif Image',TGifImage);
(It looks like not importent)
4.insert the gif file:
pic := TPicture.Create;
try
pic.LoadFromFile(OpenDialog1.FileName);
gr := RV_CreateGraphics(TGraphicClass(pic.Graphic.ClassType));
gr.Assign(pic.Graphic);
rve.TopLevelEditor.BeginUndoGroup(rvutInsert);
rve.TopLevelEditor.SetUndoGroupMode(True);
try
rve.InsertPicture('', gr, rvvaBaseline)
finally
rve.TopLevelEditor.SetUndoGroupMode(False);
end;
finally
pic.Free;
end;
===================================
1-4 steps work normally.
5.save to the stream:
TS := TStringStream.Create('');
try
rve.SaveRVFToStream(TS,False);
TS.Position := 0;
Memo1.Lines.Text := TS.DataString;
finally
TS.Free;
end;
( transport the data by tcp/ip sometimes,so not use memory stream)
6.load from the stream:
TS := TStringStream.Create(Memo1.Lines.Text);
try
TS.Position := 0;
rve.LoadRVFFromStream(TS);
finally
TS.Free;
end;
===================================
The gif picture can not show normally.
maybe I lost some steps?