public PictureCropControl(StorageFile file, AspectRatio aspect = AspectRatio.Custom, CropSelectionSize cropsize = CropSelectionSize.Half)
 {
     this.InitializeComponent();
     this.file = file;
     this.aspect = aspect;
     this.cropsize = cropsize;
 }
示例#2
0
        public static AspectRatio AspectRatioFromResolution(float width, float height, AspectRatio defaultAspect = AspectRatio.R16_9)
        {
            float aspect = width/height;
            
            if (DeltaCompare(aspect, 1.777f))
            {
                return AspectRatio.R16_9;
            }
            
            if (DeltaCompare(aspect, 1.6f))
            {
                return AspectRatio.R16_10;
            }

            if (DeltaCompare(aspect, 1.333f))
            {
                return AspectRatio.R4_3;
            }

            if (DeltaCompare(aspect, 2.333f))
            {
                return AspectRatio.R16_9;
            }

            return defaultAspect;
        }
示例#3
0
        public VideoRender(System.Windows.Forms.Control owner)
        {
            direct3D = null;
            device = null;
            this.owner = owner;       
            windowed = true;
            renderLock = new object();

            backBuffer = null;
            offscreen = null;
            screenShot = null;

            InfoText = null;
            DisplayInfoText = false;

            SubtitleItem = null;
            DisplaySubtitles = true;

            RenderMode = VideoPlayerControl.RenderMode.PAUSED;
            AspectRatio = VideoPlayerControl.AspectRatio.DEFAULT;
        }
示例#4
0
 //-------------------------------------------------------------------
 public Viewport()
 {
     m_world_x1  = (0.0);
     m_world_y1  = (0.0);
     m_world_x2  = (1.0);
     m_world_y2  = (1.0);
     m_device_x1 = (0.0);
     m_device_y1 = (0.0);
     m_device_x2 = (1.0);
     m_device_y2 = (1.0);
     m_aspect    = AspectRatio.Stretch;
     m_is_valid  = (true);
     m_align_x   = (0.5);
     m_align_y   = (0.5);
     m_wx1       = (0.0);
     m_wy1       = (0.0);
     m_wx2       = (1.0);
     m_wy2       = (1.0);
     m_dx1       = (0.0);
     m_dy1       = (0.0);
     m_kx        = (1.0);
     m_ky        = (1.0);
 }
示例#5
0
        public static float GetRealAR(AspectRatio aspectRatio)
        {
            switch (aspectRatio)
            {
            case AspectRatio.x16_9:
                return(16.0f / 9.0f);

            case AspectRatio.x16_10:
                return(16.0f / 10.0f);

            case AspectRatio.x19_10:
                return(19.0f / 10.0f);

            case AspectRatio.x5_4:
                return(5.0f / 4.0f);

            case AspectRatio.x4_3:
                return(4.0f / 3.0f);

            default:
                throw new ArgumentOutOfRangeException("aspectRatio", aspectRatio, null);
            }
        }
示例#6
0
 //-------------------------------------------------------------------
 public Viewport()
 {
     m_world_x1 = (0.0);
     m_world_y1 = (0.0);
     m_world_x2 = (1.0);
     m_world_y2 = (1.0);
     m_device_x1 = (0.0);
     m_device_y1 = (0.0);
     m_device_x2 = (1.0);
     m_device_y2 = (1.0);
     m_aspect = AspectRatio.Stretch;
     m_is_valid = (true);
     m_align_x = (0.5);
     m_align_y = (0.5);
     m_wx1 = (0.0);
     m_wy1 = (0.0);
     m_wx2 = (1.0);
     m_wy2 = (1.0);
     m_dx1 = (0.0);
     m_dy1 = (0.0);
     m_kx = (1.0);
     m_ky = (1.0);
 }
        public static float GetRatioValue(this AspectRatio ratio)
        {
            switch (ratio)
            {
            case AspectRatio.Landscape5To4: return(LANDSCAPE5TO4);

            case AspectRatio.Landscape4To3: return(LANDSCAPE4TO3);

            case AspectRatio.Landscape3To2: return(LANDSCAPE3TO2);

            case AspectRatio.Landscape16To10: return(LANDSCAPE16TO10);

            case AspectRatio.Landscape5To3: return(LANDSCAPE5TO3);

            case AspectRatio.Landscape16To9: return(LANDSCAPE16TO9);

            case AspectRatio.Landscape21To9: return(LANDSCAPE21TO9);

            case AspectRatio._: return(1);

            case AspectRatio.Portrait21To9: return(PORTRAIT21TO9);

            case AspectRatio.Portrait16To9: return(PORTRAIT16TO9);

            case AspectRatio.Portrait5To3: return(PORTRAIT5TO3);

            case AspectRatio.Portrait16To10: return(PORTRAIT16TO10);

            case AspectRatio.Portrait3To2: return(PORTRAIT3TO2);

            case AspectRatio.Portrait4To3: return(PORTRAIT4TO3);

            case AspectRatio.Portrait5To4: return(PORTRAIT5TO4);

            default: throw new ArgumentException();
            }
        }
        public static string ToShortString(this AspectRatio ratio)
        {
            switch (ratio)
            {
            case AspectRatio.Landscape5To4: return("5:4");

            case AspectRatio.Landscape4To3: return("4:3");

            case AspectRatio.Landscape3To2: return("3:2");

            case AspectRatio.Landscape16To10: return("16:10 (8:5)");

            case AspectRatio.Landscape5To3: return("5:3");

            case AspectRatio.Landscape16To9: return("16:9");

            case AspectRatio.Landscape21To9: return("21:9 (64:27)");

            case AspectRatio._: return("1:1");

            case AspectRatio.Portrait5To4: return("4:5");

            case AspectRatio.Portrait4To3: return("3:4");

            case AspectRatio.Portrait3To2: return("2:3");

            case AspectRatio.Portrait16To10: return("10:16 (5:8)");

            case AspectRatio.Portrait5To3: return("3:5");

            case AspectRatio.Portrait16To9: return("9:16");

            case AspectRatio.Portrait21To9: return("9:21 (27:64)");

            default: throw new ArgumentException();
            }
        }
        public bool Apply(List<SkinModule> skinModules)
        {
            currentAspectRatio = Util.AspectRatioFromResolution(Screen.width, Screen.height);

            stickyProperties = new List<StickyProperty>();
            rollbackStack = new List<RollbackAction>();

            foreach (var skinModule in skinModules)
            {
                Debug.LogFormat("Applying skin module \"{0}\"", skinModule.SourcePath);

                try
                {
                    ApplyInternal(skinModule);
                    Debug.LogFormat("Skin module \"{0}\" successfully applied!", skinModule.SourcePath);
                }
                catch (ParseException ex)
                {
                    ErrorLogger.LogErrorFormat("Error while applying skin module \"{1}\" at node \"{2}\": {3}",
                        ex.GetType(), skinModule.SourcePath, XmlUtil.XmlNodeInfo(ex.Node), ex.ToString());
                    return false;
                }
                catch (XmlNodeException ex)
                {
                    ErrorLogger.LogErrorFormat("{0} while applying skin module \"{1}\" at node \"{2}\": {3}",
                        ex.GetType(), skinModule.SourcePath, XmlUtil.XmlNodeInfo(ex.Node), ex.ToString());
                    return false;
                }
                catch (Exception ex)
                {
                    ErrorLogger.LogErrorFormat("{0} while applying skin module \"{1}\": {2}", ex.GetType(), skinModule.SourcePath, ex.ToString());
                    return false;
                }
            }

            return true;
        }
示例#10
0
        public TenorClient(
            string apiKey,
            Locale locale               = null,
            AspectRatio arRange         = AspectRatio.all,
            ContentFilter contentFilter = ContentFilter.off,
            MediaFilter mediaFilter0    = MediaFilter.off,
            string anonId               = null,
            RestClient testClient       = null
            )
        {
            _locale = locale ?? DefaultLocale;
            _client = testClient ?? new RestClient(BaseUri);

            _arRange       = arRange;
            _contentFilter = contentFilter;
            _mediaFilter   = mediaFilter0;
            _apiKey        = apiKey;

            _anonId = anonId;

            _client = (RestClient)_client.AddDefaultParameter("key", apiKey, ParameterType.QueryString);

            UpdateGeneralParams();
        }
示例#11
0
        public void UpdateDataSet(DicomAttributeCollection dataset)
        {
            dataset.SaveDicomFields(this);

            if (IsColor)
            {
                dataset[DicomTags.PixelRepresentation].SetEmptyValue();;
            }
            else
            {
                dataset[DicomTags.PlanarConfiguration].SetEmptyValue();;
            }

            if (PixelSpacing.IsNull && ImagerPixelSpacing.IsNull)
            {
                dataset[DicomTags.PixelAspectRatio].SetStringValue(AspectRatio.ToString());
            }

            if (!PixelSpacing.IsNull)
            {
                dataset[DicomTags.PixelSpacing].SetStringValue(PixelSpacing.ToString());
            }
            else
            {
                dataset[DicomTags.PixelSpacing].SetEmptyValue();
            }

            if (!ImagerPixelSpacing.IsNull)
            {
                dataset[DicomTags.ImagerPixelSpacing].SetStringValue(ImagerPixelSpacing.ToString());
            }
            else
            {
                dataset[DicomTags.ImagerPixelSpacing].SetEmptyValue();
            }
        }
示例#12
0
        public Bitmap CreateThumbnail(byte[] imageByte,
                                      bool maintainAspectRatio, int desiredWidth, int desiredHeight)
        {
            Bitmap bmp = null;

            MemoryStream memStream = new MemoryStream(imageByte);

            System.Drawing.Image img = System.Drawing.Image.FromStream(memStream);

            if (maintainAspectRatio)
            {
                AspectRatio aspectRatio = new AspectRatio();
                aspectRatio.WidthAndHeight(img.Width, img.Height,
                                           desiredWidth, desiredHeight);
                bmp = new Bitmap(img, aspectRatio.Width, aspectRatio.Height);
            }
            else
            {
                bmp = new Bitmap(img, desiredWidth, desiredHeight);
            }
            memStream.Dispose();

            return(bmp);
        }
示例#13
0
        string GetEmulatorInfo()
        {
            if (Emulator == null)
            {
                return("未选择模拟器");
            }
            var msg = $"模拟器:{Emulator.Name}";
            var nl  = Environment.NewLine;

            if (Emulator.IsAlive)
            {
                msg += "  状态:在线";
                var resolution = Emulator.GetResolution();
                msg += $"{nl}分辨率:{resolution}";
                var aspectRatio = AspectRatio.GetAspectRatio(resolution);
                msg += $"  宽高比:{(aspectRatio?.ToString() ?? "不支持")}";
                msg += $"{nl}实际窗口大小:" + (emulator.IsAreaValid() ? GetRectInfo(emulator.Area) : "模拟器区域不合法");
            }
            else
            {
                msg += "  状态:离线";
            }
            return(msg);
        }
示例#14
0
        private void PostFrameBuffer(Layer layer, BufferItem item)
        {
            int frameBufferWidth  = item.GraphicBuffer.Object.Width;
            int frameBufferHeight = item.GraphicBuffer.Object.Height;

            int nvMapHandle = item.GraphicBuffer.Object.Buffer.Surfaces[0].NvMapHandle;

            if (nvMapHandle == 0)
            {
                nvMapHandle = item.GraphicBuffer.Object.Buffer.NvMapId;
            }

            ulong bufferOffset = (ulong)item.GraphicBuffer.Object.Buffer.Surfaces[0].Offset;

            NvMapHandle map = NvMapDeviceFile.GetMapFromHandle(layer.Owner, nvMapHandle);

            ulong frameBufferAddress = map.Address + bufferOffset;

            Format format = ConvertColorFormat(item.GraphicBuffer.Object.Buffer.Surfaces[0].ColorFormat);

            int bytesPerPixel =
                format == Format.B5G6R5Unorm ||
                format == Format.R4G4B4A4Unorm ? 2 : 4;

            int gobBlocksInY = 1 << item.GraphicBuffer.Object.Buffer.Surfaces[0].BlockHeightLog2;

            // Note: Rotation is being ignored.
            Rect cropRect = item.Crop;

            bool flipX = item.Transform.HasFlag(NativeWindowTransform.FlipX);
            bool flipY = item.Transform.HasFlag(NativeWindowTransform.FlipY);

            AspectRatio aspectRatio = _device.Configuration.AspectRatio;
            bool        isStretched = aspectRatio == AspectRatio.Stretched;

            ImageCrop crop = new ImageCrop(
                cropRect.Left,
                cropRect.Right,
                cropRect.Top,
                cropRect.Bottom,
                flipX,
                flipY,
                isStretched,
                aspectRatio.ToFloatX(),
                aspectRatio.ToFloatY());

            TextureCallbackInformation textureCallbackInformation = new TextureCallbackInformation
            {
                Layer = layer,
                Item  = item
            };

            _device.Gpu.Window.EnqueueFrameThreadSafe(
                layer.Owner,
                frameBufferAddress,
                frameBufferWidth,
                frameBufferHeight,
                0,
                false,
                gobBlocksInY,
                format,
                bytesPerPixel,
                crop,
                AcquireBuffer,
                ReleaseBuffer,
                textureCallbackInformation);

            if (item.Fence.FenceCount == 0)
            {
                _device.Gpu.Window.SignalFrameReady();
                _device.Gpu.GPFifo.Interrupt();
            }
            else
            {
                item.Fence.RegisterCallback(_device.Gpu, (x) =>
                {
                    _device.Gpu.Window.SignalFrameReady();
                    _device.Gpu.GPFifo.Interrupt();
                });
            }
        }
 // Enables the specified aspect ratio.
 public static extern void SetAspectRatio(AspectRatio aspectRatio, bool enable);
 public static void SetAspectRatio(AspectRatio aspectRatio, bool enable)
 {
 }
 public static extern bool HasAspectRatio(AspectRatio aspectRatio);
        /// <summary>
        /// Writes Data Matrix Bar Code for ZPL.
        /// ZPL Command: ^BX.
        /// Manual: <see href="https://www.zebra.com/content/dam/zebra/manuals/printers/common/programming/zpl-zbi2-pm-en.pdf#page=122"/>
        /// </summary>
        /// <param name="left">Horizontal axis.</param>
        /// <param name="top">Vertical axis.</param>
        /// <param name="height">Height is determined by dimension and data that is encoded.</param>
        /// <param name="rotation">Rotate field.</param>
        /// <param name="text">Text to be encoded</param>
        /// <param name="qualityLevel">Version of Data Matrix.</param>
        /// <param name="aspectRatio">Choices the symbol, it is possible encode the same data in two forms of Data Matrix, a square form or rectangular.</param>
        /// <returns>Array of bytes containing ZPLII data to be sent to the Zebra printer.</returns>
        public static byte[] DataMatrixWrite(int left, int top, ElementDrawRotation rotation, int height, string text, QualityLevel qualityLevel = QualityLevel.ECC_200, AspectRatio aspectRatio = AspectRatio.SQUARE)
        {
            var rotationValue     = (char)rotation;
            var qualityLevelValue = (int)qualityLevel;
            var aspectRatioValue  = (int)aspectRatio;

            return(Encoding.GetEncoding(850).GetBytes($"^FO{left},{top}^BX{rotationValue}, {height},{qualityLevelValue},,,,,{aspectRatioValue},^FD{text}^FS"));
        }
示例#19
0
 public OpenGLWindow(InputManager inputManager, GraphicsDebugLevel glLogLevel, AspectRatio aspectRatio, bool enableMouse) : base(inputManager, glLogLevel, aspectRatio, enableMouse)
 {
     _glLogLevel = glLogLevel;
 }
示例#20
0
        private Settings()
        {
            CreateDirectories();

            int  graphicsMode     = (int)_graphicsMode;
            bool fullScreen       = _fullScreen;
            bool rightSideBar     = _rightSideBar;
            int  scale            = _scale;
            int  aspectRatio      = (int)_aspectRatio;
            int  expandWidth      = (int)_expandWidth;
            int  expandHeight     = (int)_expandHeight;
            bool revealWorld      = false;
            bool debugMenu        = false;
            bool deityEnabled     = false;
            bool arrowHelper      = false;
            bool customMapSize    = false;
            int  cursorType       = (int)_cursorType;
            int  destroyAnimation = (int)_destroyAnimation;

            // Read settings
            Int32.TryParse(GetSetting("GraphicsMode"), out graphicsMode);
            fullScreen   = (GetSetting("FullScreen") == "1");
            rightSideBar = (GetSetting("SideBar") == "1");
            Int32.TryParse(GetSetting("Scale"), out scale);
            Int32.TryParse(GetSetting("AspectRatio"), out aspectRatio);
            Int32.TryParse(GetSetting("ExpandWidth"), out expandWidth);
            Int32.TryParse(GetSetting("ExpandHeight"), out expandHeight);
            revealWorld   = (GetSetting("RevealWorld") == "1");
            debugMenu     = (GetSetting("DebugMenu") == "1");
            deityEnabled  = (GetSetting("DeityEnabled") == "1");
            arrowHelper   = (GetSetting("ArrowHelper") == "1");
            customMapSize = (GetSetting("CustomMapSize") == "1");
            Int32.TryParse(GetSetting("CursorType"), out cursorType);
            Int32.TryParse(GetSetting("DestroyAnimation"), out destroyAnimation);

            // Set settings
            if (graphicsMode > 0 && graphicsMode < 3)
            {
                _graphicsMode = (GraphicsMode)graphicsMode;
            }
            _fullScreen   = fullScreen;
            _rightSideBar = rightSideBar;
            if (scale < 1 || scale > 4)
            {
                scale = 2;
            }
            _scale       = scale;
            _aspectRatio = (AspectRatio)aspectRatio;
            if (expandWidth < 320 || expandWidth > 512 || expandHeight < 200 || expandHeight > 384)
            {
                _expandWidth  = -1;
                _expandHeight = -1;
            }
            else
            {
                _expandWidth  = expandWidth;
                _expandHeight = expandHeight;
            }
            _revealWorld      = revealWorld;
            _debugMenu        = debugMenu;
            _deityEnabled     = deityEnabled;
            _arrowHelper      = arrowHelper;
            _customMapSize    = customMapSize;
            _cursorType       = (CursorType)cursorType;
            _destroyAnimation = (DestroyAnimation)destroyAnimation;

            // Set game options
            EndOfTurn = false;
            AutoSave  = true;
        }
示例#21
0
		public LocalScalePerAspectRatio (AspectRatio _aspectRatio, Vector3 _localScale) {
			aspectRatio = _aspectRatio;
			localScale = _localScale;
		}
	public void RecalculateMesh(){
		//set backdrop's placement:
		gameObject.transform.position = mainCamera.transform.forward * distance;
		
		//calculate mesh:
		if(textureWidth == 0 || textureHeight == 0)
			return;
		mesh.vertices = CalcVerts();
		mesh.RecalculateNormals();
		
		//readjust comparison values:
		prevDistance = distance;
		prevPosition = mainCamera.transform.position;
		prevRotation = mainCamera.transform.localEulerAngles;
		screenWidth = Screen.width;
		screenHeight = Screen.height;
		prevAspectRatio = aspectRatio;
	}
示例#23
0
        /// <summary>
        /// Reads the whole configuration
        /// </summary>
        private void ReadConfig()
        {
            try
              {
            ExtensionSettings mplayerSetting = new ExtensionSettings(".mplayer", PlayMode.Unrecognized, "", true);
            _extensionSettings = new Dictionary<string, ExtensionSettings>();
            _extensionSettings.Add(mplayerSetting.Name, mplayerSetting);
            _extensionSettingsExtPlayer = new Dictionary<string, ExtensionSettings>();
            _extensionSettingsExtPlayer.Add(mplayerSetting.Name, mplayerSetting);
            ExtensionSettings settings;
            using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
            {
              _osdMode = (OSDMode)xmlreader.GetValueAsInt("mplayer", "osd", (int)OSDMode.InternalMPlayer);
              _rebuildIndex = xmlreader.GetValueAsBool("mplayer", "rebuildIndex", false);
              _priorityBoost = xmlreader.GetValueAsBool("mplayer", "priorityBoost", true);
              _framedrop = xmlreader.GetValueAsBool("mplayer", "framedrop", false);
              _doubleBuffering = xmlreader.GetValueAsBool("mplayer", "doubleBuffering", true);
              _directRendering = xmlreader.GetValueAsBool("mplayer", "directRendering", true);
              _audioNormalize = xmlreader.GetValueAsBool("mplayer", "audioNormalize", false);
              _passthroughAC3_DTS = xmlreader.GetValueAsBool("mplayer", "passthroughAC3DTS", false);
              _soundOutputDriver = (SoundOutputDriver)xmlreader.GetValueAsInt("mplayer", "soundOutputDriver", (int)SoundOutputDriver.DirectSound);
              _soundOutputDevice = xmlreader.GetValueAsInt("mplayer", "soundOutputDevice", 0);
              _deinterlace = (Deinterlace)xmlreader.GetValueAsInt("mplayer", "deinterlace", (int)Deinterlace.Adaptive);
              _aspectRatio = (AspectRatio)xmlreader.GetValueAsInt("mplayer", "aspectRatio", (int)AspectRatio.Automatic);
              _postProcessing = (PostProcessing)xmlreader.GetValueAsInt("mplayer", "postProcessing", (int)PostProcessing.Maximum);
              _audioChannels = (AudioChannels)xmlreader.GetValueAsInt("mplayer", "audioChannels", (int)AudioChannels.Default);
              _noiseDenoise = (NoiseDenoise)xmlreader.GetValueAsInt("mplayer", "noise", (int)NoiseDenoise.Nothing);
              _cacheSize = xmlreader.GetValueAsInt("mplayer", "cacheSize", 0);
              _audioDelayStep = xmlreader.GetValueAsInt("mplayer", "audioDelayStep", 100);
              _subtitleDelayStep = xmlreader.GetValueAsInt("mplayer", "subtitleDelayStep", 100);
              _subtitlePosition = xmlreader.GetValueAsInt("mplayer", "subtitlePosition", 100);
              _subtitleSize = xmlreader.GetValueAsInt("mplayer", "subtitleSize", 5);
              string subtitleFontName = xmlreader.GetValueAsString("mplayer", "subtitleFontName", "Arial");
              _subtitleFontSet = CheckSubtitleFont(subtitleFontName, out _subtitleFontFileName);
              _mplayerPath = xmlreader.GetValueAsString("mplayer", "mplayerPath", "C:\\Program Files\\MPlayer\\");
              xmlreader.GetValueAsString("mplayer", "mplayerPath", "C:\\Program Files\\MPlayer\\Mplayer.exe");
              string arguments = xmlreader.GetValueAsString("mplayer", "generalArguments", "");
              settings = new ExtensionSettings("general", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "dvdArguments", String.Empty);
              settings = new ExtensionSettings("dvd://", PlayMode.Video, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "vcdArguments", String.Empty);
              settings = new ExtensionSettings("vcd://", PlayMode.Video, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "svcdArguments", String.Empty);
              settings = new ExtensionSettings("svcd://", PlayMode.Video, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "cueArguments", String.Empty);
              settings = new ExtensionSettings("cue://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "ftpArguments", String.Empty);
              settings = new ExtensionSettings("ftp://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "httpArguments", String.Empty);
              settings = new ExtensionSettings("http://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              settings = new ExtensionSettings("http_proxy://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "mmsArguments", String.Empty);
              settings = new ExtensionSettings("mms://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              settings = new ExtensionSettings("mmst://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "mpstArguments", String.Empty);
              settings = new ExtensionSettings("mpst://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "rtspArguments", String.Empty);
              settings = new ExtensionSettings("rtsp://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              settings = new ExtensionSettings("rtp://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "sdpArguments", String.Empty);
              settings = new ExtensionSettings("sdp://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "udpArguments", String.Empty);
              settings = new ExtensionSettings("udp://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              arguments = xmlreader.GetValueAsString("mplayer", "unsvArguments", String.Empty);
              settings = new ExtensionSettings("unsv://", PlayMode.Unrecognized, arguments, false);
              _extensionSettings.Add(settings.Name, settings);
              _enableSubtitles = xmlreader.GetValueAsBool("mplayer", "enableSubtitles", false);
              _videoOutputDriver = (VideoOutputDriver)xmlreader.GetValueAsInt("mplayer", "videoOutputDriver", (int)VideoOutputDriver.DirectX);
              string timeout = (xmlreader.GetValueAsString("movieplayer", "skipsteptimeout", "1500"));

              if (timeout == string.Empty)
            _seekStepTimeout = 1500;
              else
            _seekStepTimeout = Convert.ToInt16(timeout);

              String m_strLanguage = xmlreader.GetValueAsString("skin", "language", "English");
              LocalizeStrings.Load(m_strLanguage);
            }
            LoadXMLData();
              }
              catch (Exception e)
              {
            Log.Error(e);
              }
              _supportedExtensions = new String[_extensionSettingsExtPlayer.Count];
              _extensionSettingsExtPlayer.Keys.CopyTo(_supportedExtensions, 0);
        }
        protected override void InitConfig()
        {
            RoomAnchor = GetV("RoomAnchor", Vector3.Zero, "The anchor point for the room. All room position values will be offset by this in relation to the eye position.");
            DrawRoom = Get("DrawRoom", true, "Whether to draw the room on the window diagrams.");
            DrawGlobalLabels = Get("DrawLabels", true, "Whether to draw for the room on the window diagrams.");

            RoomFile = GetStr("RoomFile", null, "The file containing the layout for the room the projector is in.");
            if (RoomFile != null && !Path.IsPathRooted(RoomFile))
                RoomFile = Path.Combine(Folder, RoomFile);

            ProjectorPosition = GetVFrame("Position", new Vector3(0f, 1000f, -30f), "Where the projector is, relative to the Room Anchor.");
            ProjectorPitch = GetFrame("Pitch", 5.0, "The pitch the projector is set at.");
            ProjectorYaw = GetFrame("Yaw", 0.0, "The yaw the projector is set at.");
            ThrowRatio = GetFrame("ThrowRatio", 1.7f, "The throw ratio of the projector. Throw ratio is the screen distance/screenWidth");
            WallDistance = GetFrame("WallDistance", 2000f, "How far away from the projector the wall is.");
            VOffset = GetFrame("VOffset", .09f, "How for that image is shifted up above the level of the projector.");
            Draw = GetFrame("Draw", true, "Whether to draw the projector on the window diagrams.");
            DrawLabels = GetFrame("DrawLabels", true, "Whether to draw labels for the specified projector on the window diagrams.");
            AutoUpdate = GetFrame("AutoUpdate", false, "Whether to automatically update the screen size based on the projector position.");
            UpsideDown = GetFrame("UpsideDown", true, "Whether the projector is mounted upside down.");

            AspectRatio = GetEnum<AspectRatio>("AspectRatio", Plugins.AspectRatio.SixteenNine, "Aspect ratio the projector is set to.", LogManager.GetLogger(Frame + "Projector"));
            NativeAspectRatio = GetEnum<AspectRatio>("NativeAspectRatio", Plugins.AspectRatio.SixteenNine, "Native aspect ratio the projector supports.", LogManager.GetLogger(Frame + "Projector"));

            string lockStr = GetFrame("Lock", "Nothing", "The variable that will remain constant as the properties of the system are altered. Valid choices are 'Nothing', 'Width', 'Height' and 'Position'.");
            Enum.TryParse(lockStr, out Lock);
        }
 public static extern void SetAspectRatio(AspectRatio aspectRatio, bool enable);
示例#26
0
 byte[] BuildVideoStreamCodingInfo(ElementaryStreamTypes type, VideoFormat format, FrameRate rate, AspectRatio ratio)
 {
     List<byte> info = new List<byte>();
     info.Add(0x15);
     info.Add((byte)type);
     info.Add((byte)((((byte)format) << 4) | (byte)rate));
     info.Add((byte)(((byte)(ratio)) << 4));
     for(int i = 0; i < 18; i++)
         info.Add(0x00);
     return info.ToArray();
 }
示例#27
0
		public LocalPositionPerAspectRatio (AspectRatio _aspectRatio, Vector3 _localPosition) {
			aspectRatio = _aspectRatio;
			localPosition = _localPosition;
		}
示例#28
0
 /// <summary>
 /// Sets a ImageComponent to the BobbleContainer hero
 /// </summary>
 /// <param name="self">BubbleContainer</param>
 /// <param name="imageUrl">
 /// Image URL (Required)<para>
 /// / Protocol: HTTPS
 /// / Image format: JPEG or PNG
 /// / Maximum image size: 1024×1024 pixels
 /// / Maximum data size: 1 MB</para>
 /// </param>
 /// <param name="flex">
 /// The ratio of the width or height of this component within the parent box. <para>
 /// The default value for the horizontal parent box is 1, and the default value for the vertical parent box is 0.
 /// For more information, see Width and height of components.</para>
 /// </param>
 /// <param name="margin">
 /// Minimum space between this component and the previous component in the parent box.<para>
 /// You can specify one of the following values: none, xs, sm, md, lg, xl, or xxl.
 /// none does not set a space while the other values set a space whose size increases in the order of listing.
 /// The default value is the value of the spacing property of the parent box.
 ///If this component is the first component in the parent box, the margin property will be ignored.</para>
 /// </param>
 /// <param name="align">
 /// Horizontal alignment style.<para>
 /// Specify one of the following values:
 /// / start: Left-aligned
 /// / end: Right-aligned
 /// / center: Center-aligned
 /// , The default value is center.</para>
 /// </param>
 /// <param name="gravity">
 /// Vertical alignment style.<para>
 /// Specify one of the following values:
 /// / top: Top-aligned
 /// / bottom: Bottom-aligned
 /// / center: Center-aligned
 /// , The default value is top.</para><para>
 /// If the layout property of the parent box is baseline, the gravity property will be ignored.</para>
 /// </param>
 /// <param name="size">
 /// Maximum size of the image width.<para>
 /// You can specify one of the following values: xxs, xs, sm, md, lg, xl, xxl, 3xl, 4xl, 5xl, or full.
 /// The size increases in the order of listing.
 /// The default value is md.</para>
 /// </param>
 /// <param name="aspectRatio">
 /// Aspect ratio of the image.
 /// Specify in the {width}:{height} format. <para>
 /// Specify the value of the {width} property and the {height} property in the range from 1 to 100000. However,
 /// you cannot set the {height} property to a value that is more than three times the value of the {width} property. </para>
 /// The default value is 1:1.
 /// </param>
 /// <param name="aspectMode">
 /// Style of the image.<para>
 /// Specify one of the following values:
 /// / cover: The image fills the entire drawing area.Parts of the image that do not fit in the drawing area are not displayed.
 /// / fit: The entire image is displayed in the drawing area.The background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images.
 /// The default value is fit.</para>
 /// </param>
 /// <param name="backgroundColor">
 /// Background color of the image. Use a hexadecimal color code.
 /// </param>
 /// <returns>BubbleContainer</returns>
 public static BubbleContainer SetHero(this BubbleContainer self, string imageUrl,
                                       int?flex              = null, Spacing?margin     = null, Align?align = null,
                                       Gravity?gravity       = null, ComponentSize?size = null, AspectRatio aspectRatio = null,
                                       AspectMode?aspectMode = null, ColorCode backgroundColor = null)
 {
     self.Hero = new ImageComponent(imageUrl)
     {
         Flex            = flex,
         Margin          = margin,
         Align           = align,
         Gravity         = gravity,
         Size            = size,
         AspectRatio     = aspectRatio,
         AspectMode      = aspectMode,
         BackgroundColor = backgroundColor
     };
     return(self);
 }
示例#29
0
 private static bool TryGetAspectRatio(string source, out AspectRatio result)
 {
     return(Ratios.TryGetValue(source, out result));
 }
        public bool Apply(List<SkinModule> skinModules)
        {
            _currentAspectRatio = Util.AspectRatioFromResolution(Screen.width, Screen.height);

            _stickyProperties = new List<StickyProperty>();
            _rollbackStack = new List<RollbackAction>();

            foreach (var skinModule in skinModules)
            {
                Debug.LogFormat("Applying skin module \"{0}\"", skinModule.SourcePath);

                try
                {
                    ApplyInternal(skinModule);
                    Debug.LogFormat("Skin module \"{0}\" successfully applied!", skinModule.SourcePath);
                }
                catch (ParseException ex)
                {
                    ErrorLogger.LogErrorFormat("Error while applying skin module \"{1}\" at node \"{2}\": {3}",
                        ex.GetType(), skinModule.SourcePath, XmlUtil.XmlNodeInfo(ex.Node), ex.ToString());
                    return false;
                }
                catch (XmlNodeException ex)
                {
                    ErrorLogger.LogErrorFormat("{0} while applying skin module \"{1}\" at node \"{2}\": {3}",
                        ex.GetType(), skinModule.SourcePath, XmlUtil.XmlNodeInfo(ex.Node), ex.ToString());
                    return false;
                }
                catch (Exception ex)
                {
                    ErrorLogger.LogErrorFormat("{0} while applying skin module \"{1}\": {2}", ex.GetType(), skinModule.SourcePath, ex.ToString());
                    return false;
                }
            }

            return true;
        }
示例#31
0
        public bool Equals([AllowNull] Scene other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((BgColor == other.BgColor && BgColor != null && other.BgColor != null && BgColor.Equals(other.BgColor)) &&
                   (Camera == other.Camera && Camera != null && other.Camera != null && Camera.Equals(other.Camera)) &&
                   (Domain == other.Domain && Domain != null && other.Domain != null && Domain.Equals(other.Domain)) &&
                   (AspectMode == other.AspectMode && AspectMode != null && other.AspectMode != null && AspectMode.Equals(other.AspectMode)) &&
                   (AspectRatio == other.AspectRatio && AspectRatio != null && other.AspectRatio != null && AspectRatio.Equals(other.AspectRatio)) &&
                   (XAxis == other.XAxis && XAxis != null && other.XAxis != null && XAxis.Equals(other.XAxis)) &&
                   (YAxis == other.YAxis && YAxis != null && other.YAxis != null && YAxis.Equals(other.YAxis)) &&
                   (ZAxis == other.ZAxis && ZAxis != null && other.ZAxis != null && ZAxis.Equals(other.ZAxis)) &&
                   (DragMode == other.DragMode && DragMode != null && other.DragMode != null && DragMode.Equals(other.DragMode)) &&
                   (HoverMode == other.HoverMode && HoverMode != null && other.HoverMode != null && HoverMode.Equals(other.HoverMode)) &&
                   (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) &&
                   (Equals(Annotations, other.Annotations) || Annotations != null && other.Annotations != null && Annotations.SequenceEqual(other.Annotations)));
        }
示例#32
0
 public static float getYVel(float Velocity)
 {
     aspectRatio = AspectRatio.GetAspectRatio(Screen.width, Screen.height);
     return(Velocity * (aspectRatio.y / 9f));
 }
示例#33
0
 public AspectRatio MediaInfoReadAspectRatioIfNotPresent(AspectRatio value)
 {
     sut.ForceAspectRatio = value;
     sut.Validate(mockMediaInfoFacade.Object, mockTimeProvider.Object);
     return(sut.AspectRatio);
 }
 public AspectRatioAttribute(AspectRatio ar)
 {
     AspectRatio = ar;
 }
示例#35
0
 //-------------------------------------------------------------------
 public void preserve_aspect_ratio(double alignx,
                            double aligny,
                            AspectRatio aspect)
 {
     m_align_x = alignx;
     m_align_y = aligny;
     m_aspect = aspect;
     update();
 }
示例#36
0
 public static Vector2 getTransVel(Vector2 Velocity)
 {
     aspectRatio = AspectRatio.GetAspectRatio(Screen.width, Screen.height);
     return(new Vector2(Velocity.x * (aspectRatio.x / 16f), Velocity.y * (aspectRatio.y / 9f)));
 }
示例#37
0
        private void AspectRatio_Clicked(object sender, ButtonReleaseEventArgs args)
        {
            AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value;

            ConfigurationState.Instance.Graphics.AspectRatio.Value = ((int)aspectRatio + 1) > Enum.GetNames(typeof(AspectRatio)).Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1;
        }
示例#38
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (BgColor != null)
                {
                    hashCode = hashCode * 59 + BgColor.GetHashCode();
                }

                if (Camera != null)
                {
                    hashCode = hashCode * 59 + Camera.GetHashCode();
                }

                if (Domain != null)
                {
                    hashCode = hashCode * 59 + Domain.GetHashCode();
                }

                if (AspectMode != null)
                {
                    hashCode = hashCode * 59 + AspectMode.GetHashCode();
                }

                if (AspectRatio != null)
                {
                    hashCode = hashCode * 59 + AspectRatio.GetHashCode();
                }

                if (XAxis != null)
                {
                    hashCode = hashCode * 59 + XAxis.GetHashCode();
                }

                if (YAxis != null)
                {
                    hashCode = hashCode * 59 + YAxis.GetHashCode();
                }

                if (ZAxis != null)
                {
                    hashCode = hashCode * 59 + ZAxis.GetHashCode();
                }

                if (DragMode != null)
                {
                    hashCode = hashCode * 59 + DragMode.GetHashCode();
                }

                if (HoverMode != null)
                {
                    hashCode = hashCode * 59 + HoverMode.GetHashCode();
                }

                if (UiRevision != null)
                {
                    hashCode = hashCode * 59 + UiRevision.GetHashCode();
                }

                if (Annotations != null)
                {
                    hashCode = hashCode * 59 + Annotations.GetHashCode();
                }

                return(hashCode);
            }
        }
示例#39
0
        public Projector(Frame frame, ProjectorPlugin projectorPlugin)
        {
            mProjectorPlugin = projectorPlugin;
            mFrame = frame;
            mTargetH = frame.Height;

            ProjectorConfig cfg = new ProjectorConfig(frame.Name);
            mOrientation = new Rotation(cfg.ProjectorPitch, cfg.ProjectorYaw);

            //Constants
            mThrowRatio = cfg.ThrowRatio;
            mUpsideDown = cfg.UpsideDown;
            mVOffset = cfg.VOffset;
            mNativeAspectRatio = cfg.NativeAspectRatio;
            SetAspectRatio(cfg.AspectRatio);
            CalculateAngles();

            mLock = cfg.Lock;

            if (mLock == LockedVariable.Position/* || mLock == LockedVariable.Nothing*/) {
                mPosition = cfg.ProjectorPosition;
                mD = cfg.WallDistance;
                mFrame.Orientation.Yaw = mOrientation.Yaw;
            } else {
                mD = mLock == LockedVariable.Width ? CalculateDFromW() :CalculateDFromH();
                mPosition = CalculatePositionFromH();
                mOrientation.Yaw = mFrame.Orientation.Yaw;
            }

            mOldW = mFrame.Width;
            mOldH = mFrame.Height;

            mDraw = cfg.Draw;
            mDrawLabels = cfg.DrawLabels;

            mProjectorPlugin.RoomChanged += new Action(mProjectorPlugin_RoomChanged);
            mOrientation.Changed += new EventHandler(mOrientation_Changed);
            frame.Changed += new Action<Frame,EventArgs>(frame_Changed);
        }
 public static bool HasAspectRatio(AspectRatio aspectRatio) => true;
示例#41
0
        public void VideoFormatTest(byte videoFmtByte, AspectRatio expectedAspectRatio, TVSystem expectedTVSystem)
        {
            byte[] copyTestBytes = (byte[])testBytes.Clone();
            copyTestBytes[0x80] = videoFmtByte;

            MOIFile moiFile = ParseMOIExpectSuccess(copyTestBytes);

            Assert.AreEqual(expectedAspectRatio, moiFile.AspectRatio);
            Assert.AreEqual(expectedTVSystem, moiFile.TVSystem);
        }
 public static extern bool HasAspectRatio(AspectRatio aspectRatio);
示例#43
0
        /// <summary>
        /// Load values from a SettingPreset object including resolution.
        /// </summary>
        public void LoadValues(SettingsPreset preset, bool loadResolution)
        {
            if (loadResolution)
            {
                ResolutionIndex = PlayerPrefs.GetInt("SETTINGSMANAGER_RESOLUTIONINDEX", ResolutionIndex);

                if (ResolutionIndex <= -1)
                {
                    Vector2Int currentResolution = new Vector2Int(Screen.currentResolution.width, Screen.currentResolution.height);

                    bool exit = false;
                    foreach (KeyValuePair <AspectRatio, Vector2Int[]> aspectRatio in m_ResolutionList)
                    {
                        for (int i = 0; i < aspectRatio.Value.Length; i++)
                        {
                            if (currentResolution == aspectRatio.Value[i])
                            {
                                ResolutionIndex = i;
                                AspectRatio     = aspectRatio.Key;
                                exit            = true;
                                break;
                            }
                        }

                        if (exit)
                        {
                            break;
                        }
                    }

                    if (ResolutionIndex == -1)
                    {
                        // Standard 1080p
                        ResolutionIndex = 2;
                        AspectRatio     = AspectRatio.Aspect16by9;
                    }
                }
                else
                {
                    AspectRatio = PlayerPrefsUtil.GetEnum("SETTINGSMANAGER_ASPECTRATIO", AspectRatio);
                }

                Fullscreen  = PlayerPrefsUtil.GetBool("SETTINGSMANAGER_FULLSCREEN", Fullscreen);
                RefreshRate = PlayerPrefs.GetInt("SETTINGSMANAGER_REFRESHRATE", RefreshRate);
            }

            PixelLightCount         = preset.PixelLightCount;
            TextureQuality          = preset.TextureQuality;
            AnisotropicFiltering    = preset.AnisotropicFiltering;
            AntiAliasing            = preset.AntiAliasing;
            SoftParticles           = preset.SoftParticles;
            RealtimeReflectionProbe = preset.RealtimeReflectionProbe;
            VSyncCount = preset.VSyncCount;

            ShadowQualityType     = preset.ShadowQualityType;
            ShadowResolutionType  = preset.ShadowResolutionType;
            ShadowProjectionType  = preset.ShadowProjectionType;
            ShadowDistance        = preset.ShadowDistance;
            ShadowmaskModeType    = preset.ShadowmaskModeType;
            ShadowNearPlaneOffset = preset.ShadowNearPlaneOffset;
            ShadowCascadeType     = preset.ShadowCascadeType;
        }
 /// <summary>
 /// Updates the aspect ratio for the asset for the player control.
 /// </summary>
 /// <param name="selectedAspectRatio">New aspect ratio.</param>
 private void UpdatePlayerAspectRatio(AspectRatio selectedAspectRatio)
 {
     this.View.SetAspectRatio(selectedAspectRatio);
 }
 public void SetAspectRatio(AspectRatio selectedAspectRatio)
 {
     this.SetAspectRatioCalled  = true;
     this.SetCurrentAspectRatio = selectedAspectRatio;
 }
示例#46
0
        private void Update(EvaluationContext context)
        {
            float fov         = MathUtil.DegreesToRadians(Fov.GetValue(context));
            float aspectRatio = AspectRatio.GetValue(context);

            if (aspectRatio < 0.0001f)
            {
                aspectRatio = (float)context.RequestedResolution.Width / context.RequestedResolution.Height;
            }
            System.Numerics.Vector2 clip = NearFarClip.GetValue(context);

            Matrix cameraToClipSpace = Matrix.PerspectiveFovRH(fov, aspectRatio, clip.X, clip.Y);

            // var pos = Position.GetValue(context);
            // Vector3 eye = new Vector3(pos.X, pos.Y, pos.Z);

            Vector3 p                = new Vector3(0, 0, Radius.GetValue(context));
            var     seed             = Seed.GetValue(context);
            var     wobbleSpeed      = WobbleSpeed.GetValue(context);
            var     wobbleComplexity = (int)MathUtils.Clamp(WobbleComplexity.GetValue(context), 1, 8);

            //var offset =
            var rotOffset = RotationOffset.GetValue(context);

            // Orbit rotation
            System.Numerics.Vector3 t = Center.GetValue(context);
            Vector3 target            = new Vector3(t.X, t.Y, t.Z);

            var rot = Matrix.RotationYawPitchRoll(
                ComputeAngle(SpinAngleAndWobble, 1)
                + MathUtil.DegreesToRadians((float)(SpinRate.GetValue(context)
                                                    * (EvaluationContext.BeatTime + SpinOffset.GetValue(context)) * 360
                                                    + MathUtils.PerlinNoise(0, 1, 6, seed) * 360))
                ,
                -ComputeAngle(OrbitAngleAndWobble, 2),
                0);
            var p2  = Vector3.Transform(p, rot);
            var eye = new Vector3(p2.X, p2.Y, p2.Z);

            // View rotation
            var viewDirection = target - eye;

            var rotateAim = Matrix.RotationYawPitchRoll(
                ComputeAngle(AimYawAngleAndWobble, 3) + rotOffset.X * MathUtils.ToRad,
                ComputeAngle(AimPitchAngleAndWobble, 4) + rotOffset.Y * MathUtils.ToRad,
                rotOffset.Z * MathUtils.ToRad);


            var adjustedViewDirection = Vector3.TransformNormal(viewDirection, rotateAim);

            target = eye + adjustedViewDirection;


            // Computing matrix
            var     u  = Up.GetValue(context);
            Vector3 up = new Vector3(u.X, u.Y, u.Z);

            var roll = ComputeAngle(AimRollAngleAndWobble, 5);
            var rotateAroundViewDirection = Matrix.RotationAxis(adjustedViewDirection, roll);

            up = Vector3.TransformNormal(up, rotateAroundViewDirection);

            Matrix worldToCamera = Matrix.LookAtRH(eye, target, up);

            var prevCameraToClipSpace = context.CameraToClipSpace;

            context.CameraToClipSpace = cameraToClipSpace;

            var prevWorldToCamera = context.WorldToCamera;

            context.WorldToCamera = worldToCamera;
            Command.GetValue(context);

            context.CameraToClipSpace = prevCameraToClipSpace;
            context.WorldToCamera     = prevWorldToCamera;


            float ComputeAngle(Slot <Vector2> angleAndWobbleInput, int seedIndex)
            {
                var angleAndWobble = angleAndWobbleInput.GetValue(context);
                var wobble         = Math.Abs(angleAndWobble.Y) < 0.001f
                                 ? 0
                                 : (MathUtils.PerlinNoise((float)EvaluationContext.BeatTime * wobbleSpeed,
                                                          1, wobbleComplexity, seed - 123 * seedIndex) - 0.5f) * 2 * angleAndWobble.Y;

                return(MathUtil.DegreesToRadians(angleAndWobble.X + wobble));
            }
        }
示例#47
0
 public StreamInfo(byte[] data, int index)
 {
     if (null == data)
         throw new ArgumentException("stream data is null");
     if (data.Length + index < 5)
         throw new ArgumentException("stream data too short");
     uint descLength = (uint)((data[3 + index] & 0x0f) << 8) + data[4 + index];
     if (descLength > Constants.TS_SIZE)
         throw new ArgumentException("descriptors data too long");
     if (5 + descLength > data.Length - index)
         throw new ArgumentException("stream data too short");
     mData = new byte[5 + descLength];
     for (int i = 0; i < mData.Length; i++)
     {
         mData[i] = data[i + index];
     }
     mVideoFormat = VideoFormat.Reserved;
     mAspectRatio = AspectRatio.Reserved;
     mFrameRate = FrameRate.Reserved;
     mAudioPresentationType = AudioPresentationType.Reserved;
     mSamplingFrequency = SamplingFrequency.Reserved;
 }
示例#48
0
        public void AspectRatio_Verify()
        {
            var setting = new AspectRatio(Ratio.Create(1, 1));

            Assert.Equal("-aspect 1:1", SettingSerializer.Serialize(setting));
        }
示例#49
0
 private void SetAspectRatio(AspectRatio value)
 {
     switch (mNativeAspectRatio) {
         case AspectRatio.SixteenNine:
             mH = 9f / 16f;
             switch (value) {
                 case AspectRatio.SixteenNine:
                     mW = 1f;
                     break;
                 case AspectRatio.FourThree:
                     mW = 6 / 8f;
                     break;
             }
             break;
         case AspectRatio.FourThree:
             mW = 1f;
             switch (value) {
                 case AspectRatio.SixteenNine:
                     mH = 9f / 16f;
                     break;
                 case AspectRatio.FourThree:
                     mH = 3f / 4f;
                     break;
             }
             break;
     }
     mAspectRatio = value;
 }