Hello
D2007 and TeeTree VCL 8.04
I load BackImage from Stream, it's Ok that good result with under methode
function LoadBackImageFromStream:Boolean;
Var i:integer;
jpg: TJPEGImage;
Stream1:TMemoryStream;
begin
try
Stream1:=TMemoryStream.Create;
jpg:=TJPEGImage.Create;
try
Stream1:=GetStreamImageFromSever; //Load Stream from my server by Webservice > it's Ok
if Stream1.size>=0 then
jpg.LoadFromStream(Stream1);
Tree1.BackImage.Assign(jpg);
finally
FreeAndNil(jpg);
FreeAndNil(Stream1);
end;
except
//managment error
end;
end;
Q1) do hou have other solution for direct load image by stream, without TJPEGImage and without file disk?
Q2) How do take for clear Image if my stream is empty or bad ?
Q3) do you have best practice and géneral méthode for image (jpeg,bmp,Gif etc) without file disk ?
BackImage Stream and clear
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: BackImage Stream and clear
Hi mivchart,
I think those are Delphi generic issues. I'll give my 2 cents. though.
I think those are Delphi generic issues. I'll give my 2 cents. though.
You could use TBitmap as in the code snippet below.Q1) do hou have other solution for direct load image by stream, without TJPEGImage and without file disk?
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var Bitmap: TBitmap;
Stream: TMemoryStream;
begin
Bitmap:=Bitmap.Create;
Stream:=TMemoryStream.Create;
//Load your image to the stream here.
if Assigned(Stream) then
begin
Stream.Position:=0;
Bitmap.LoadFromStream(Stream);
end;
end;
Use Assigned as in the code snippet above.Q2) How do take for clear Image if my stream is empty or bad ?
I don't know if this is best practice but I'd try doing something as in the code example I posted.Q3) do you have best practice and géneral méthode for image (jpeg,bmp,Gif etc) without file disk ?
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: BackImage Stream and clear
OK,
But if my Stream used for several type (Jpeg, Gif, Bmp, etc), for each i need déclare spécial grapic type ??
But if my Stream used for several type (Jpeg, Gif, Bmp, etc), for each i need déclare spécial grapic type ??
Re: BackImage Stream and clear
Hi mivchart,
You could try with TOleGraphic as in the example here.
Also, if you are source code customer, feel free to look into TeeChart sources to see how the different types are treated.
You could try with TOleGraphic as in the example here.
Also, if you are source code customer, feel free to look into TeeChart sources to see how the different types are treated.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |