Example #1
0
        /// <summary>
        /// add Transition on IAMTimelineComp
        /// 设置推出进入效果
        /// </summary>
        public static int SetTransition(ref IAMTimeline m_pTimeline, IAMTimelineComp pComp, Guid EffectGUID, string Direction, long StartTime, long EndTime, Property[] parArr)
        {
            int                  hr;
            IAMTimelineObj       pTransObj;
            IAMTimelineTransable pTransable = (IAMTimelineTransable)pComp;

            hr = m_pTimeline.CreateEmptyNode(out pTransObj, TimelineMajorType.Transition);
            hr = pTransable.TransAdd(pTransObj);
            pTransObj.SetStartStop(StartTime, EndTime);
            hr = pTransObj.SetSubObjectGUID(EffectGUID);

            IPropertySetter ipro = (IPropertySetter) new PropertySetter();

            if (parArr != null && parArr.Length > 0)
            {
                foreach (Property pro in parArr)
                {
                    DESHelper.AddParameter(ipro, pro.Name, pro.Value);
                }
            }
            DESHelper.AddParameter(ipro, "Duration", EndTime / DESConsts.UNITS - StartTime / DESConsts.UNITS);
            hr = pTransObj.SetPropertySetter(ipro);

            //Set transition Direction
            if (Direction.ToLower() == "true")
            {
                IAMTimelineTrans pTrans = (IAMTimelineTrans)pTransObj;
                pTrans.SetSwapInputs(true);
            }

            return(hr);
        }
Example #2
0
        /// <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("{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);

            IAMTimelineTrans trans1 = transitionObj as IAMTimelineTrans;

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

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

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

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

            return(transitionObj);
        }
        private void TestSwapInputs()
        {
            int  hr;
            bool b;

            hr = m_itt.SetSwapInputs(true);
            DESError.ThrowExceptionForHR(hr);

            hr = m_itt.GetSwapInputs(out b);
            DESError.ThrowExceptionForHR(hr);

            Debug.Assert(b == true, "SwapInputs");
        }
Example #4
0
        /// <summary>
        /// Set Transition Direction on IAMTimelineTrack
        /// </summary>
        public static int SetTransDirection(ref IAMTimeline m_pTimeline, IAMTimelineTrack pTrac, bool Direction, long StartTime, long EndTime)
        {
            int                  hr;
            IAMTimelineObj       pTransObj;
            IAMTimelineTransable pTransable = (IAMTimelineTransable)pTrac;

            hr = m_pTimeline.CreateEmptyNode(out pTransObj, TimelineMajorType.Transition);
            hr = pTransable.TransAdd(pTransObj);
            pTransObj.SetStartStop(StartTime, EndTime);
            IAMTimelineTrans pTrans = (IAMTimelineTrans)pTransObj;

            pTrans.SetSwapInputs(true);
            return(hr);
        }