getting there

This commit is contained in:
2026-02-20 12:23:23 +01:00
parent 5801b29f22
commit 7beadabb47
12 changed files with 214 additions and 56 deletions

View File

@@ -29,6 +29,9 @@ namespace RemoteFrameBuffer.Client
private RgbFrameBuffer? _frameBuffer;
public delegate void BitmapUpdateCallback(Byte[] bitmap);
public event BitmapUpdateCallback? FrameUpdate;
public RemoteFrameBufferClientProtocol(Stream s)
{
this.vncStream = s;
@@ -213,7 +216,8 @@ namespace RemoteFrameBuffer.Client
throw new NotImplementedException();
}
}
this._frameBuffer!.SaveBitmap($"{DateTime.Now:yyyyMMdd-HHmmss}.bmp");
this.FrameUpdate?.Invoke(this._frameBuffer!.ToBitmap());
//this._frameBuffer!.SaveBitmap($"{DateTime.Now:yyyyMMdd-HHmmss}.bmp");
}
protected void ServerMsg_SetColourMapEntries()

View File

@@ -20,6 +20,8 @@ namespace RemoteFrameBuffer
};
}
public Byte[] BitMap { get; protected set; } = [];
public RemoteFramebufferClient(IRemoteFrameBufferClientStreamProvider socketProvider)
{
this._socketProvider = socketProvider;
@@ -95,6 +97,10 @@ namespace RemoteFrameBuffer
// TODO: register auth callback and the like
proto.Handshake(this.cancellationTokenSource.Token);
proto.Initialization(this.cancellationTokenSource.Token);
proto.FrameUpdate += (bitmap) => {
Console.Error.WriteLine("####################################### CB hit");
this.BitMap = bitmap;
};
proto.StartListener(this.cancellationTokenSource.Token).Wait();
}
#warning REMOVE THIS

View File

@@ -44,7 +44,7 @@
public void CopyRegion(UInt16 source_x, UInt16 source_y, UInt16 width, UInt16 height, UInt16 target_x, UInt16 target_y) => this.SetRegion(this._frame, source_x, source_y, width, height, target_x, target_y);
public void SaveBitmap(String filename)
public Byte[] ToBitmap()
{
#warning Endianness is straight up ignored
Int32 rowBytes = (this.Width * 3) + 3;
@@ -72,7 +72,12 @@
buf[pos + 2] = this._frame[this.Height - j - 1][i].Red;
}
}
File.WriteAllBytes(filename, buf);
return buf;
}
public void SaveBitmap(String filename)
{
File.WriteAllBytes(filename, this.ToBitmap());
}
}
}