Exemple #1
0
        public void TrackAddEffectBubblesToComposition()
        {
            int beforeCount = 0;
            int afterCount  = 0;

            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup       group       = timeline.AddVideoGroup(24, 100, 100);
                IComposition composition = group.AddComposition();

                composition.BeforeEffectAdded += new EventHandler(delegate
                {
                    beforeCount++;
                });

                composition.AfterEffectAdded += new EventHandler <AfterEffectAddedEventArgs>(delegate
                {
                    afterCount++;
                });

                ITrack track = composition.AddTrack();
                track.AddEffect("test", -1, 1, 2, StandardEffects.CreateBlurEffect(2, 2, 10));

                Assert.AreEqual(1, beforeCount);
                Assert.AreEqual(1, afterCount);
            }
        }
Exemple #2
0
        public void AddEffect()
        {
            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup       group       = timeline.AddVideoGroup(24, 100, 100);
                IComposition composition = group.AddComposition();

                bool firedBefore = false;
                bool firedAfter  = false;

                composition.BeforeEffectAdded += new EventHandler(delegate
                {
                    firedBefore = true;
                });

                composition.AfterEffectAdded += new EventHandler <AfterEffectAddedEventArgs>(delegate
                {
                    firedAfter = true;
                });

                IEffect effect = composition.AddEffect("test", -1, 1, 2, StandardEffects.CreateBlurEffect(2, 2, 10));
                Assert.AreEqual("test", effect.Name);
                Assert.AreEqual(1, effect.Offset);
                Assert.AreEqual(2, effect.Duration);
                Assert.AreEqual(1, composition.Effects.Count);
                Assert.IsTrue(firedBefore);
                Assert.IsTrue(firedAfter);
            }
        }
Exemple #3
0
        public void AddEffectToClip()
        {
            bool beforeFired = false;
            bool afterFired  = false;

            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup group = timeline.AddVideoGroup(24, 64, 64);
                ITrack track = group.AddTrack();
                IClip  clip  = track.AddClip("transitions.wmv", GroupMediaType.Video, InsertPosition.Absoloute, 0, 0, -1);

                clip.BeforeEffectAdded += new EventHandler(delegate
                {
                    beforeFired = true;
                });

                clip.AfterEffectAdded += new EventHandler <AfterEffectAddedEventArgs>(delegate
                {
                    afterFired = true;
                });

                EffectDefinition defintion = StandardEffects.CreateBlurEffect(2, clip.Duration, 20);

                IEffect effect =
                    clip.AddEffect("blur", -1, 0, clip.Duration, defintion);

                Assert.IsTrue(beforeFired);
                Assert.IsTrue(afterFired);
                Assert.AreEqual("blur", effect.Name);
                Assert.AreEqual(0, effect.Priority);
                Assert.AreEqual(clip.Duration, effect.Duration);
                Assert.AreEqual(0, clip.Offset);
                Assert.AreSame(defintion, effect.EffectDefinition);

                PrepareToExecute(timeline,
                                 @"<timeline framerate=""30.0000000"">
	<group type=""video"" bitdepth=""24"" width=""64"" height=""64"" framerate=""30.0000000"" previewmode=""0"">
		<track>
			<clip start=""0"" stop=""7.9990000"" src=""transitions.wmv"" mstart=""0"">
				<effect start=""0"" stop=""7.9990000"" clsid=""{7312498D-E87A-11D1-81E0-0000F87557DB}"" username=""blur"">
					<param name=""PixelRadius"" value=""2"">
						<linear time=""7.9990000"" value=""20"" />
					</param>
				</effect>
			</clip>
		</track>
	</group>
</timeline>");
            }
        }
Exemple #4
0
        public void EffectPrioirities()
        {
            using (ITimeline timeline = new DefaultTimeline())
            {
                EffectDefinition definition = StandardEffects.CreateBlurEffect(2, 10, 2);

                IGroup  group  = timeline.AddAudioGroup();
                IEffect first  = group.AddEffect("first", -1, 0, 10, definition);
                IEffect second = group.AddEffect("second", 0, 0, 10, definition);
                IEffect third  = group.AddEffect("third", 1, 0, 10, definition);
                IEffect fourth = group.AddEffect("fourth", -1, 0, 10, definition);
                IEffect fifth  = group.AddEffect("fifth", 2, 0, 10, definition);
                Assert.AreEqual(3, first.Priority);
                Assert.AreEqual(0, second.Priority);
                Assert.AreEqual(1, third.Priority);
                Assert.AreEqual(4, fourth.Priority);
                Assert.AreEqual(2, fifth.Priority);
            }
        }
Exemple #5
0
        public void AddEffectsToTrack()
        {
            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup  group  = timeline.AddVideoGroup(24, 320, 200);
                ITrack  track  = group.AddTrack();
                IEffect effect = track.AddEffect("test", -1, 1, 3, StandardEffects.CreateBlurEffect(2, 2, 15));
                Assert.AreEqual(1, track.Effects.Count);
                Assert.AreSame(effect, track.Effects[0]);

                PrepareToExecute(timeline,
                                 @"<timeline framerate=""30.0000000"">
	<group type=""video"" bitdepth=""24"" height=""200"" framerate=""30.0000000"" previewmode=""0"">
		<track>
			<effect clsid=""{7312498D-E87A-11D1-81E0-0000F87557DB}"" username=""test"">
				<param name=""PixelRadius"" value=""2"">
					<linear time=""2"" value=""15"" />
				</param>
			</effect>
		</track>
	</group>
</timeline>");
            }
        }