Autor Beitrag
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Mi 04.04.07 18:27 
Also liebe Leute,
ich kriege in einer IdTCPClient ein Bild übers netzwerk geschickt, welches ich in einen Stream speichere.
Es handelt sich um ein Jpeg.
Wie kann ich das Bild laden. Code sieht so aus:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
var
  fs:TMemoryStream;//: TFileStream;
  SizeOfIncomingStream: integer;
begin
  fs:=TmemoryStream.Create;
  //fs := TFileStream.Create(ExtractFilePath(Application.Exename)+'bild.jpg', fmCreate or fmShareExclusive);
  with AThread.Connection do
    try
      SizeOfIncomingStream:=ReadInteger;
      ReadStream(fs, SizeOfIncomingStream); //und übergeben
    finally
      Disconnect;
      fs.Free;
  end;

  //Bild laden und hier ist auch das Problem ... Klient[aktuellerklient].pic ist ein Image

  Klient[aktuellerklient].pic.Picture.LoadFromStream(fs);

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mi 04.04.07 19:27 
Probier's mal mit: Image1.Picture.LoadFromStream ;-)

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
Fighter#1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Mi 04.04.07 20:05 
Blöd nur das weder Delphi 5 noch Delphi 7 den Befehl kennen, sonst hätt ich das natürlich gemacht ... trotzdem danke für die ANtwort

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
Fighter#1 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Mi 04.04.07 20:15 
Ok leute, habs jetzt hingekriegt!
Sieht jetzt so aus:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
var
  jpeg:TJpegimage;
  fs:TMemoryStream;
  SizeOfIncomingStream: integer;
begin

  fs:=TmemoryStream.Create;
  with AThread.Connection do
    try
      SizeOfIncomingStream:=ReadInteger;
      ReadStream(fs, SizeOfIncomingStream); //und übergeben
    finally
      Disconnect;

  end;

  //Bild laden

  jpeg:=TJpegImage.Create;
  fs.position:=0;
  Jpeg.LoadFromStream(fs);
  fs.Free;
  Klient[aktuellerklient].pic.Picture.Bitmap.Assign(jpeg);
  jpeg.Free;


Ich hab einfach ein TJpegimage genommen, da kann man Streams mit laden und dann ins bitmap geschoben!


____________________________________
Bald bekommt ihr eine neue Version von Being - Watched :-)

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse