Change ICapturer's signature.

This commit is contained in:
Jared Goodwin 2019-03-28 06:05:50 -07:00
parent a43e7cba27
commit b7c007b5fe
6 changed files with 47 additions and 15 deletions

View File

@ -8,16 +8,16 @@ using System.Threading.Tasks;
namespace Remotely_ScreenCast.Core.Capture
{
public interface ICapturer : IDisposable
{
{
bool CaptureFullscreen { get; set; }
Bitmap CurrentFrame { get; set; }
Rectangle CurrentScreenBounds { get; }
Bitmap PreviousFrame { get; set; }
EventHandler<Rectangle> ScreenChanged { get; set; }
int SelectedScreen { get; set; }
int ScreenCount { get; set; }
double VirtualScreenHeight { get; set; }
double VirtualScreenWidth { get; set; }
int GetScreenCount();
double GetVirtualScreenHeight();
double GetVirtualScreenWidth();
void Capture();
void Init();

View File

@ -48,7 +48,7 @@ namespace Remotely_ScreenCast.Core.Capture
await outgoingMessages.SendScreenCount(
capturer.SelectedScreen,
capturer.ScreenCount,
capturer.GetScreenCount(),
viewerID);
await outgoingMessages.SendScreenSize(capturer.CurrentScreenBounds.Width, capturer.CurrentScreenBounds.Height, viewerID);
@ -157,7 +157,7 @@ namespace Remotely_ScreenCast.Core.Capture
{
var absoluteX = (capturer.CurrentScreenBounds.Width * percentX) + capturer.CurrentScreenBounds.Left;
var absoluteY = (capturer.CurrentScreenBounds.Height * percentY) + capturer.CurrentScreenBounds.Top;
return new Tuple<double, double>(absoluteX / capturer.VirtualScreenWidth, absoluteY / capturer.VirtualScreenHeight);
return new Tuple<double, double>(absoluteX / capturer.GetVirtualScreenWidth(), absoluteY / capturer.GetVirtualScreenHeight());
}
public static Tuple<double, double> GetAbsolutePointFromRelativePercent(double percentX, double percentY, ICapturer capturer)
{

View File

@ -16,9 +16,6 @@ namespace Remotely_ScreenCast.Linux.Capture
public System.Drawing.Bitmap PreviousFrame { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public EventHandler<Rectangle> ScreenChanged { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public int SelectedScreen { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public int ScreenCount { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public double VirtualScreenHeight { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public double VirtualScreenWidth { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public void Capture()
{
@ -30,6 +27,21 @@ namespace Remotely_ScreenCast.Linux.Capture
throw new NotImplementedException();
}
public int GetScreenCount()
{
throw new NotImplementedException();
}
public double GetVirtualScreenHeight()
{
throw new NotImplementedException();
}
public double GetVirtualScreenWidth()
{
throw new NotImplementedException();
}
public void Init()
{
throw new NotImplementedException();

View File

@ -20,6 +20,7 @@ namespace Remotely_ScreenCast.Linux
try
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
// TODO: Works. Now make it happen.
//var display = Xlib.XOpenDisplay(null);
//Console.WriteLine($"Display is {display.ToString()}");
//var count = Xlib.XScreenCount(display);

View File

@ -57,9 +57,19 @@ namespace Remotely_ScreenCast.Win.Capture
}
}
public Rectangle CurrentScreenBounds { get; set; } = Screen.PrimaryScreen.Bounds;
public int ScreenCount { get; set; } = Screen.AllScreens.Length;
public double VirtualScreenHeight { get; set; } = SystemInformation.VirtualScreen.Width;
public double VirtualScreenWidth { get; set; } = SystemInformation.VirtualScreen.Height;
public int GetScreenCount()
{
return Screen.AllScreens.Length;
}
public double GetVirtualScreenHeight()
{
return SystemInformation.VirtualScreen.Width;
}
public double GetVirtualScreenWidth()
{
return SystemInformation.VirtualScreen.Height;
}
private int selectedScreen = Screen.AllScreens.ToList().IndexOf(Screen.PrimaryScreen);
private Graphics graphic;

View File

@ -65,9 +65,18 @@ namespace Remotely_ScreenCast.Win.Capture
}
}
public int ScreenCount { get; set; } = Screen.AllScreens.Length;
public double VirtualScreenHeight { get; set; } = SystemInformation.VirtualScreen.Width;
public double VirtualScreenWidth { get; set; } = SystemInformation.VirtualScreen.Height;
public int GetScreenCount()
{
return Screen.AllScreens.Length;
}
public double GetVirtualScreenHeight()
{
return SystemInformation.VirtualScreen.Width;
}
public double GetVirtualScreenWidth()
{
return SystemInformation.VirtualScreen.Height;
}
public void Capture()
{