/// <summary> /// Reads a single byte from an unmanaged stream. /// </summary> protected unsafe int ReadByte(FreeImageIO io, fi_handle handle) { byte buffer = 0; return (int)io.readProc(new IntPtr(&buffer), 1, 1, handle) > 0 ? buffer : -1; }
/// <summary> /// Reads from an unmanaged stream. /// </summary> protected unsafe int Read(FreeImageIO io, fi_handle handle, uint size, uint count, ref byte[] buffer) { fixed (byte* ptr = buffer) { return (int)io.readProc(new IntPtr(ptr), size, count, handle); } }