Пример #1
0
        /// <summary>
        /// RecordVideo video into GIF.
        /// </summary>
        /// <param name="region"></param>
        /// <param name="offset"></param>
        /// <returns></returns>
        public static Task <MemoryStream> RecordGif(Rectangle region, Point offset)
        {
            if (VersionService.GetPlatform() == PlatformType.Windows)
            {
                return(RecordVideo(region, offset, EncodeGif));
            }

            return(RecordVideo(region, offset, EncodeGifUnix));
        }
Пример #2
0
        /// <summary>
        /// Get the percentage of scalling.
        /// </summary>
        /// <returns></returns>
        public static float GetScaling()
        {
            // For Unix
            if (VersionService.GetPlatform() != PlatformType.Windows)
            {
                using (var graphics = Graphics.FromHwnd(IntPtr.Zero))
                {
                    return(graphics.DpiX / 96);
                }
            }

            // For Windows
            var gfx     = Graphics.FromHwnd(IntPtr.Zero);
            var desktop = gfx.GetHdc();

            var logicalHeight  = GetDeviceCaps(desktop, 10);
            var physicalHeight = GetDeviceCaps(desktop, 117);

            return((float)physicalHeight / logicalHeight);
        }