/// <summary>
        /// Insert a transition into a transitionable object
        /// </summary>
        /// <param name="timeline"></param>
        /// <param name="transable"></param>
        /// <param name="offset"></param>
        /// <param name="duration"></param>
        /// <param name="transitionDefinition"></param>
        /// <param name="swapInputs"></param>
        /// <returns></returns>
        internal static IAMTimelineObj InsertTransition(IAMTimeline timeline, IAMTimelineTransable transable,
                                                        string name, double offset, double duration,
                                                        TransitionDefinition transitionDefinition, bool swapInputs)
        {
            int hr = 0;

            IAMTimelineObj transitionObj;
            long           unitsStart = ToUnits(offset);
            long           unitsEnd   = ToUnits(offset + duration);

            hr = timeline.CreateEmptyNode(out transitionObj, TimelineMajorType.Transition);
            DESError.ThrowExceptionForHR(hr);

            name = string.IsNullOrEmpty(name) ? "transition" : name;

            if (swapInputs)
            {
                hr =
                    transitionObj.SetUserName(string.Format(CultureInfo.InvariantCulture, "{0} (swapped inputs)", name));
                DESError.ThrowExceptionForHR(hr);
            }
            else
            {
                hr = transitionObj.SetUserName(name);
                DESError.ThrowExceptionForHR(hr);
            }

            hr = transitionObj.SetSubObjectGUID(transitionDefinition.TransitionId);
            DESError.ThrowExceptionForHR(hr);

            hr = transitionObj.SetStartStop(unitsStart, unitsEnd);
            DESError.ThrowExceptionForHR(hr);

            var trans1 = transitionObj as IAMTimelineTrans;

            if (swapInputs)
            {
                hr = trans1.SetSwapInputs(true);
                DESError.ThrowExceptionForHR(hr);
            }

            if (transitionDefinition.Parameters.Count > 0)
            {
                var setter1 = (IPropertySetter) new PropertySetter();
                PopulatePropertySetter(setter1, transitionDefinition.Parameters);

                hr = transitionObj.SetPropertySetter(setter1);
                DESError.ThrowExceptionForHR(hr);
            }

            hr = transable.TransAdd(transitionObj);
            DESError.ThrowExceptionForHR(hr);

            return(transitionObj);
        }
 public Transition(ITransitionContainer container, IAMTimelineObj timelineObj, string name, double offset,
                   double duration, bool swapInputs,
                   TransitionDefinition transitionDefinition)
 {
     _container            = container;
     _timelineObj          = timelineObj;
     _name                 = name;
     _offset               = offset;
     _duration             = duration;
     _swapInputs           = swapInputs;
     _transitionDefinition = transitionDefinition;
 }
Exemple #3
0
 public Transition(ITransitionContainer container, IAMTimelineObj timelineObj, string name, double offset,
                   double duration, bool swapInputs,
                   TransitionDefinition transitionDefinition)
 {
     _container = container;
     _timelineObj = timelineObj;
     _name = name;
     _offset = offset;
     _duration = duration;
     _swapInputs = swapInputs;
     _transitionDefinition = transitionDefinition;
 }
Exemple #4
0
        public ITransition AddTransition(string name, double offset, double duration,
                                         TransitionDefinition transitionDefinition, bool swapInputs)
        {
            OnBeforeTransitionAdded();

            ITransition transition =
                TimelineUtils.AddTransitionToCollection(this, _desTimeline, (IAMTimelineTransable)_timelineComposition,
                                                        _transitions, name, offset, duration, transitionDefinition,
                                                        swapInputs);

            OnAfterTransitionAdded(transition);

            return(transition);
        }
Exemple #5
0
        public ITransition AddTransition(string name, double offset, double duration,
                                         TransitionDefinition transitionDefinition, bool swapInputs)
        {
            OnAddingTransition();

            ITransition transition =
                TimelineBuilder.AddTransitionToCollection(this, _timeline, (IAMTimelineTransable)_track, _transitions,
                                                          name,
                                                          offset, duration, transitionDefinition, swapInputs);

            OnAddedTransition(transition);

            return(transition);
        }
Exemple #6
0
        /// <summary>
        /// Creates a des transition, wraps it into an ITransition, adds it to a collection
        /// and returns a new ITransition wrapper.
        /// </summary>
        /// <param name="desTimeline"></param>
        /// <param name="transable"></param>
        /// <param name="transitions"></param>
        /// <param name="name"></param>
        /// <param name="offset"></param>
        /// <param name="duration"></param>
        /// <param name="transitionDefinition"></param>
        /// <param name="swapInputs"></param>
        /// <returns></returns>
        internal static ITransition AddTransitionToCollection(ITransitionContainer container, IAMTimeline desTimeline,
                                                              IAMTimelineTransable transable,
                                                              AddOnlyList <ITransition> transitions, string name,
                                                              double offset, double duration,
                                                              TransitionDefinition transitionDefinition, bool swapInputs)
        {
            CheckForTransitionOveralp(container, offset, duration);

            IAMTimelineObj desTransition =
                InsertTransition(desTimeline, transable, name, offset, duration, transitionDefinition, swapInputs);

            ITransition transition =
                new Transition(container, desTransition, name, offset, duration, swapInputs, transitionDefinition);

            transitions.Add(transition);

            return(transition);
        }
Exemple #7
0
 public ITransition AddTransition(double offset, double duration,
                                  TransitionDefinition transitionDefinition)
 {
     return(AddTransition(null, offset, duration, transitionDefinition, false));
 }
Exemple #8
0
        public ITransition AddTransition(string name, double offset, double duration,
                                         TransitionDefinition transitionDefinition, bool swapInputs)
        {
            OnAddingTransition();

            ITransition transition =
                TimelineBuilder.AddTransitionToCollection(this, _timeline, (IAMTimelineTransable) _track, _transitions,
                                                          name,
                                                          offset, duration, transitionDefinition, swapInputs);

            OnAddedTransition(transition);

            return transition;
        }
Exemple #9
0
 public ITransition AddTransition(double offset, double duration,
                                  TransitionDefinition transitionDefinition, bool swapInputs)
 {
     return AddTransition(null, offset, duration, transitionDefinition, swapInputs);
 }
Exemple #10
0
 public ITransition AddTransition(double offset, double duration,
                                  TransitionDefinition transitionDefinition)
 {
     return AddTransition(null, offset, duration, transitionDefinition, false);
 }
        public static TransitionDefinition CreateKey(KeyTransitionType transitionType, int? hue, bool? invert,
                                                     int? luminance,
                                                     UInt32? rgb, int? similarity)
        {
            var transitionDefinition = new TransitionDefinition(KeyTransition);
            transitionDefinition.Parameters.Add(new Parameter(KeyTransitionParameter.KeyType, (long) transitionType));

            if (hue.HasValue)
            {
                if ((hue < 0) || (hue > 360))
                {
                    throw new ArgumentOutOfRangeException("hue", "hue must be between 0 and 360");
                }
                else if (transitionType != KeyTransitionType.Hue)
                {
                    throw new ArgumentException("hue specified but selected key transitionType is not \"Hue\"", "hue");
                }
                else
                {
                    transitionDefinition.Parameters.Add(new Parameter(KeyTransitionParameter.Hue, hue.Value));
                }
            }

            if (luminance.HasValue)
            {
                if ((luminance < 0) || (luminance > 100))
                {
                    throw new ArgumentOutOfRangeException("luminance", "luminance must be between 0 and 100");
                }
                else if (transitionType != KeyTransitionType.Hue)
                {
                    throw new ArgumentException("hue specified but selected key transitionType is not \"Hue\"", "hue");
                }
                else
                {
                    transitionDefinition.Parameters.Add(
                        new Parameter(KeyTransitionParameter.Luminance, luminance.Value));
                }
            }

            if (rgb.HasValue)
            {
                if ((rgb < 0) || (rgb > 0xFFFFFF))
                {
                    throw new ArgumentOutOfRangeException("rgb", "rgb must be between 0x000000 and 0xFFFFFF");
                }
                else if (transitionType != KeyTransitionType.Rgb)
                {
                    throw new ArgumentException("rgb specified but selected key transitionType is not \"Rgb\"", "rgb");
                }
                else
                {
                    transitionDefinition.Parameters.Add(new Parameter(KeyTransitionParameter.Rgb, rgb.Value));
                }
            }

            if (similarity.HasValue)
            {
                if ((similarity < 0) || (similarity > 100))
                {
                    throw new ArgumentOutOfRangeException("similarity", "similarity must be between 0 and 100");
                }
                else if ((transitionType != KeyTransitionType.Rgb) && (transitionType != KeyTransitionType.NoRed))
                {
                    throw new ArgumentException(
                        "similarity specified but selected key transitionType does not support it",
                        "similarity");
                }
                else
                {
                    transitionDefinition.Parameters.Add(
                        new Parameter(KeyTransitionParameter.Similarity, similarity.Value));
                }
            }

            if (invert.HasValue)
            {
                if ((transitionType != KeyTransitionType.Rgb) && (transitionType != KeyTransitionType.Hue) &&
                    (transitionType != KeyTransitionType.Luminance) &&
                    (transitionType != KeyTransitionType.NoRed))
                {
                    throw new ArgumentException("invert specified but selected key transitionType does not support it",
                                                "invert");
                }
                else
                {
                    transitionDefinition.Parameters.Add(new Parameter(KeyTransitionParameter.Invert, invert.Value));
                }
            }

            return transitionDefinition;
        }
        public static TransitionDefinition CreatePixelate()
        {
            TransitionDefinition transitionDefinition = new TransitionDefinition(DxtSubObjects.PixelateTransition);

            return(transitionDefinition);
        }
 public static TransitionDefinition CreatePixelate()
 {
     var transitionDefinition = new TransitionDefinition(PixelateTransition);
     return transitionDefinition;
 }
        public static TransitionDefinition CreateIris()
        {
            TransitionDefinition transitionDefinition = new TransitionDefinition(DxtSubObjects.IrisTransition);

            return(transitionDefinition);
        }
        public static TransitionDefinition CreateKey(KeyTransitionType transitionType, int?hue, bool?invert,
                                                     int?luminance,
                                                     UInt32?rgb, int?similarity)
        {
            var transitionDefinition = new TransitionDefinition(KeyTransition);

            transitionDefinition.Parameters.Add(new Parameter(KeyTransitionParameter.KeyType, (long)transitionType));

            if (hue.HasValue)
            {
                if ((hue < 0) || (hue > 360))
                {
                    throw new ArgumentOutOfRangeException("hue", "hue must be between 0 and 360");
                }
                else if (transitionType != KeyTransitionType.Hue)
                {
                    throw new ArgumentException("hue specified but selected key transitionType is not \"Hue\"", "hue");
                }
                else
                {
                    transitionDefinition.Parameters.Add(new Parameter(KeyTransitionParameter.Hue, hue.Value));
                }
            }

            if (luminance.HasValue)
            {
                if ((luminance < 0) || (luminance > 100))
                {
                    throw new ArgumentOutOfRangeException("luminance", "luminance must be between 0 and 100");
                }
                else if (transitionType != KeyTransitionType.Hue)
                {
                    throw new ArgumentException("hue specified but selected key transitionType is not \"Hue\"", "hue");
                }
                else
                {
                    transitionDefinition.Parameters.Add(
                        new Parameter(KeyTransitionParameter.Luminance, luminance.Value));
                }
            }

            if (rgb.HasValue)
            {
                if ((rgb < 0) || (rgb > 0xFFFFFF))
                {
                    throw new ArgumentOutOfRangeException("rgb", "rgb must be between 0x000000 and 0xFFFFFF");
                }
                else if (transitionType != KeyTransitionType.Rgb)
                {
                    throw new ArgumentException("rgb specified but selected key transitionType is not \"Rgb\"", "rgb");
                }
                else
                {
                    transitionDefinition.Parameters.Add(new Parameter(KeyTransitionParameter.Rgb, rgb.Value));
                }
            }

            if (similarity.HasValue)
            {
                if ((similarity < 0) || (similarity > 100))
                {
                    throw new ArgumentOutOfRangeException("similarity", "similarity must be between 0 and 100");
                }
                else if ((transitionType != KeyTransitionType.Rgb) && (transitionType != KeyTransitionType.NoRed))
                {
                    throw new ArgumentException(
                              "similarity specified but selected key transitionType does not support it",
                              "similarity");
                }
                else
                {
                    transitionDefinition.Parameters.Add(
                        new Parameter(KeyTransitionParameter.Similarity, similarity.Value));
                }
            }

            if (invert.HasValue)
            {
                if ((transitionType != KeyTransitionType.Rgb) && (transitionType != KeyTransitionType.Hue) &&
                    (transitionType != KeyTransitionType.Luminance) &&
                    (transitionType != KeyTransitionType.NoRed))
                {
                    throw new ArgumentException("invert specified but selected key transitionType does not support it",
                                                "invert");
                }
                else
                {
                    transitionDefinition.Parameters.Add(new Parameter(KeyTransitionParameter.Invert, invert.Value));
                }
            }

            return(transitionDefinition);
        }
        public static TransitionDefinition CreateFade()
        {
            var transitionDefinition = new TransitionDefinition(FadeTransition);

            return(transitionDefinition);
        }
        public static TransitionDefinition CreatePixelate()
        {
            var transitionDefinition = new TransitionDefinition(PixelateTransition);

            return(transitionDefinition);
        }
        public static TransitionDefinition CreateIris()
        {
            var transitionDefinition = new TransitionDefinition(IrisTransition);

            return(transitionDefinition);
        }
Exemple #19
0
 public ITransition AddTransition(double offset, double duration,
                                  TransitionDefinition transitionDefinition, bool swapInputs)
 {
     return(AddTransition(null, offset, duration, transitionDefinition, swapInputs));
 }
 public static TransitionDefinition CreateFade()
 {
     var transitionDefinition = new TransitionDefinition(FadeTransition);
     return transitionDefinition;
 }
 public static TransitionDefinition CreateIris()
 {
     var transitionDefinition = new TransitionDefinition(IrisTransition);
     return transitionDefinition;
 }
        public static TransitionDefinition CreateFade()
        {
            TransitionDefinition transitionDefinition = new TransitionDefinition(DxtSubObjects.FadeTransition);

            return(transitionDefinition);
        }