Home > Back-end >  Delphi udp can receive pictures speed or DSPARK reads the images or flow
Delphi udp can receive pictures speed or DSPARK reads the images or flow

Time:10-05

Procedure TForm1. IdUDPServer1UDPRead (Sender: TObject; AData: TBytes;
ABinding: TIdSocketHandle);
Var temp: an array of byte [0.. 2];
Jpg: TJpegImage;
Ct, CapX, CapY: integer;
BMP: TBitmap;
Stream: TMemoryStream;
STR: string;
Bit: TBitmap;
The begin

Stream:=TMemoryStream. Create;
//bit:=TBitmap. Create;
WriteTIdBytesToStream (stream, AData);
If the stream. Size & gt; 0 then the begin
Stream. Position:=0;
Stream. ReadBuffer (temp, 3);
Ct:=\ [0].
Capx:=(ct mod 8) * Dw.
Capy:=(8) ct div * DH;
If ct<=63 then with ShowJpg [ct] do begin
LoadFromStream (stream);
DIBNeeded;
//bit. Assign (ShowJpg [ct]);
//showjpg [ct].
//BitBlt (Image1. Canvas. Handle, capx, capy, capx + DW, capy + DH, bit. Canvas. Handle, 0, 0, SRCCOPY);
Image1. Canvas. StretchDraw (the rect (capx, capy, capx + dw, capy + dh), bit);
end;
end;
//Str='OK I Received! ';//need to inform the client has received,
//ABinding. SendTo (ABinding. PeerIP, ABinding PeerPort, ToBytes (STR));
//memo1. Lines. The Add (' ipServerUserData=https://bbs.csdn.net/topics/=> len: '+ IntToStr (stream. Size));
Stream. Free;
//bit. Free;
end;

Draw: how can you make it faster,, or can use DSPARK reads the images or flow, o method
  • Related