in delphi there is tmemorystream.setpointer(pointer,size)
Same thing, there is a protected method in FPC:
procedure TCustomMemoryStream.SetPointer(Ptr: Pointer; ASize: PtrInt);
In Delphi method also protected:
procedure TCustomMemoryStream.SetPointer(Ptr: Pointer; const Size: NativeInt);
you are right its protected in both , i didn't noticed that
anyway stream.write or writebuffer is what i was looking for
and stream.Seek(0,soFromBeginning) is also needed after finish writing to the buffer
but now i have a strange problem , i wrote a 2 version of funtion that load png image (from file or memory ) and return pSDL_Texture
function LoadFromMemory(const ptr : pointer; const size : longint):pSDL_Texture;
with this declaration i got this exception :
An unhandled exception occurred at $0040F332:
FPImageException: Wrong image format
but with this declaration it works fine
function LoadFromMemory(const ptr : array of byte; const size : longint):pSDL_Texture;