Exemplo n.º 1
0
        public static Eto.Drawing.PointF ScreenToLogical(this sd.Point point, swf.Screen sdscreen = null)
        {
            sdscreen = sdscreen ?? swf.Screen.FromPoint(point);
            var location  = sdscreen.GetLogicalLocation();
            var pixelSize = sdscreen.GetLogicalPixelSize();

            var x = location.X + (point.X - sdscreen.Bounds.X) / pixelSize;
            var y = location.Y + (point.Y - sdscreen.Bounds.Y) / pixelSize;

            return(new Drawing.PointF(x, y));
        }
Exemplo n.º 2
0
        public static Eto.Drawing.PointF ScreenToLogical(this sd.Point point, swf.Screen sdscreen = null)
        {
            sdscreen = sdscreen ?? swf.Screen.FromPoint(point);
            var location       = sdscreen.GetLogicalLocation();
            var pixelSize      = sdscreen.GetLogicalPixelSize();
            var sdscreenBounds = sdscreen.GetBounds();

            var x = location.X + (point.X - sdscreenBounds.X) / pixelSize;
            var y = location.Y + (point.Y - sdscreenBounds.Y) / pixelSize;

            // Console.WriteLine($"In: {point}, out: {x},{y}");
            return(new Drawing.PointF(x, y));
        }
Exemplo n.º 3
0
        public static Eto.Drawing.RectangleF ScreenToLogical(this Eto.Drawing.Rectangle rect, swf.Screen screen)
        {
            screen = screen ?? swf.Screen.FromPoint(rect.Location.ToSD());
            var location     = screen.GetLogicalLocation();
            var pixelSize    = screen.GetLogicalPixelSize();
            var screenBounds = screen.GetBounds();

            return(new Eto.Drawing.RectangleF(
                       location.X + (rect.X - screenBounds.X) / pixelSize,
                       location.Y + (rect.Y - screenBounds.Y) / pixelSize,
                       rect.Width / pixelSize,
                       rect.Height / pixelSize
                       ));
        }