TIEBitmap.LoadRawFromBufferOrStream
TIEBitmap.LoadRawFromBufferOrStream
Declaration
function LoadRawFromBufferOrStream(Buffer: Pointer; Stream: TStream; BufferSize: Int64 = -1): Boolean;
Description
Loads an image that was saved with
SaveRawToBufferOrStream.
Return True on success.
Note: When loading from a
Buffer (as opposed to a
Stream), pass the buffer's actual allocated size in
BufferSize whenever it is known, e.g. the value returned by
CalcRawSize. This lets the method detect a truncated, corrupted or untrusted buffer and raise an exception instead of reading past the end of the allocation. If omitted (-1), no such check is performed, matching the previous behavior.
Example
// Load Raw from a stream
if ImageEnView1.IEBitmap.LoadRawFromBufferOrStream( nil, ms ) then
ShowMessage('Load OK');
// Load Raw from a buffer, with bounds checking
if ImageEnView1.IEBitmap.LoadRawFromBufferOrStream( pBuf, nil, BufSize ) then
ShowMessage('Load OK');
See Also
◼SaveRawToBufferOrStream
◼CalcRawSize