FMX Bitmap Image Loading Fail from Socket Stream

  

I got some problems with the TImage component of loading bitmap from stream. When i call that my image loading like that.
Normal Window
Fullscreen Window
Okay, but when i build my codes on VCL Application mode its working good.
procedure SaveToStream(Stream: TStream; Bitm: TBitmap);
var
Surface: TBitmapSurface;
begin
Surface:= TBitmapSurface.Create;
try
Surface.Assign(Bitm);
TBitmapCodecManager.SaveToStream(Stream, Surface, ‘.bmp’);
finally
Surface.Free;
end;
end;

Calling like that,
B := TBitmap.Create;
BS:= TMemoryStream.Create;
try
B := ParseData((FData)); // my image data is converting from TByteArray to Bitmap now. Its
working no problem.
SaveToStream(BS, B);
FrmScreenViewer.ImgScreen.Bitmap.LoadFromStream(BS);
//FrmScreenViewer.ImgScreen.Bitmap:= B; //I tryed without SaveToStream method but same
result.
finally
B.Free;
BS.Free;
end;

Are there some limitations on the FMX side? Why isn’t working?
ParseData Function (I used RTC Framework and some variables are customizable like RTCByteArray)
function ParseData(Data: RtcByteArray): TBitmap;
var
B: TBitmap;
M: TRtcByteArrayStream;
begin
B := TBitmap.Create;
M := TRtcByteArrayStream.Create(Data);
try
B.LoadFromStream(M);
Result := B;
finally
M.Free;
end;
end;

Comments are closed.