/// <summary>
        /// Raises the requested resolution dropdown value changed event.
        /// </summary>
        public void OnRequestedResolutionDropdownValueChanged(int result)
        {
            if ((int)requestedResolution != result)
            {
                requestedResolution = (ResolutionPreset)result;

                int width, height;
                Dimensions(requestedResolution, out width, out height);

                webCamTextureToMatHelper.Initialize(width, height);
            }
        }
            public static void Dimensions(this ResolutionPreset preset, out int width, out int height)
            {
                switch (preset)
                {
                case ResolutionPreset.FullHD: width = 1920; height = 1080; break;

                case ResolutionPreset.HD: width = 1280; height = 720; break;

                case ResolutionPreset.MediumResolution: width = 640; height = 480; break;

                case ResolutionPreset.HighestResolution: width = 9999; height = 9999; break; //NatCam will pick the resolution closest to this, hence the highest

                case ResolutionPreset.LowestResolution: width = 50; height = 50; break;      //NatCam will pick the resolution closest to this, hence the lowest

                default: width = height = 0; break;
                }
            }
Example #3
0
        private void Dimensions(ResolutionPreset preset, out int width, out int height)
        {
            switch (preset)
            {
            case ResolutionPreset._50x50: width = 50; height = 50; break;

            case ResolutionPreset._640x480: width = 640; height = 480; break;

            case ResolutionPreset._1280x720: width = 1280; height = 720; break;

            case ResolutionPreset._1920x1080: width = 1920; height = 1080; break;

            case ResolutionPreset._9999x9999: width = 9999; height = 9999; break;

            default: width = height = 0; break;
            }
        }
            private static void ApplyResolutionMarkers(Node rootNode, ResolutionPreset resolutionPreset, bool isPortrait)
            {
                var markers = resolutionPreset.GetMarkers(isPortrait);

                void ApplyResolutionMarkerToNode(Node node)
                {
                    foreach (var animation in node.Animations)
                    {
                        foreach (var marker in markers)
                        {
                            if (animation.TryRun(marker))
                            {
                                break;
                            }
                        }
                    }
                }

                ApplyResolutionMarkerToNode(rootNode);
                foreach (var descendant in rootNode.Descendants)
                {
                    ApplyResolutionMarkerToNode(descendant);
                }
            }
 public void OnCameraResolutionDropdownValueChanged(int result)
 {
     cameraResolution = (ResolutionPreset)result;
 }