상속: SourceReaderSample, IDisposable
예제 #1
0
파일: Overlay.cs 프로젝트: vipoo/SuperMFLib
        public static ProcessSample Overlay(Action<SourceReaderSampleWithBitmap> applyImage, ProcessSample processSample)
        {
            return SeperateAudioVideo(processSample, sample => {

                if( sample.Sample != null)
                    using (var sampleWithBitmap = new SourceReaderSampleWithBitmap(sample))
                        applyImage(sampleWithBitmap);

                return processSample(sample);
            });
        }
예제 #2
0
파일: FadeIn.cs 프로젝트: vipoo/SuperMFLib
        static ProcessSample _VideoFadeIn(ProcessSample next)
        {
            return (sample) =>
            {
                var fadeIn = Math.Min(255, 255 - ((sample.SegmentTimeStamp).FromNanoToSeconds() * 255));
                fadeIn = Math.Max(0, fadeIn);

                using (var videoSample = new SourceReaderSampleWithBitmap(sample))
                    videoSample.Graphic.FillRectangle(new SolidBrush(Color.FromArgb((int)fadeIn, Color.Black)), 0, 0, videoSample.ImageWidth, videoSample.ImageHeight);

                return next(sample);
            };
        }
예제 #3
0
파일: FadeOut.cs 프로젝트: vipoo/SuperMFLib
        private static ProcessSample _VideoFadeOut(long duration, ProcessSample next)
        {
            return sample =>
            {
                var fadingOutFrom = sample.SegmentDuration - duration;
                var fadeOut = Math.Min(255, (sample.SegmentTimeStamp - fadingOutFrom).FromNanoToSeconds() * 255.0 / duration.FromNanoToSeconds());
                fadeOut = Math.Max(0, fadeOut);

                using (var videoSample = new SourceReaderSampleWithBitmap(sample))
                    videoSample.Graphic.FillRectangle(new SolidBrush(Color.FromArgb((int)fadeOut, Color.Black)), 0, 0, videoSample.ImageWidth, videoSample.ImageHeight);

                return next(sample);
            };
        }
 void applyIntroOverlay(SourceReaderSampleWithBitmap sample)
 {
     leaderBoard.Intro(sample.Graphic, sample.Duration, sample.Timestamp);
 }
        void applyRaceDataOverlay(SourceReaderSampleWithBitmap sample)
        {
            if (showClosingFlashCard(sample))
            {
                if (sample.Timestamp.FromNanoToSeconds() - leaderBoard.OverlayData.TimeForOutroOverlay.Value > 30)
                    return;

                var duration = sample.Duration - leaderBoard.OverlayData.TimeForOutroOverlay.Value.FromSecondsToNano();
                duration = Math.Min(duration, 30.FromSecondsToNano());
                var period = sample.Timestamp - leaderBoard.OverlayData.TimeForOutroOverlay.Value.FromSecondsToNano();

                leaderBoard.Outro(sample.Graphic, duration, sample.Timestamp, period);
                return;
            }

            leaderBoard.Overlay(sample.Graphic, sample.Timestamp);
        }
        void applyIntroOverlay(SourceReaderSampleWithBitmap sample)
        {
            var pagePeriod = (float)sample.Timestamp / sample.Duration;

            int page = FlashCardPaging.GetPageNumber(leaderBoard.OverlayData.SessionData.DriverInfo, pagePeriod);

            leaderBoard.Intro(sample.Graphic, sample.Timestamp, page);
        }
        void applyRaceDataOverlay(SourceReaderSampleWithBitmap sample)
        {
            if (showClosingFlashCard(sample))
            {
                if (sample.Timestamp.FromNanoToSeconds() - leaderBoard.OverlayData.TimeForOutroOverlay.Value > 30)
                    return;

                var duration = sample.Duration - leaderBoard.OverlayData.TimeForOutroOverlay.Value.FromSecondsToNano();
                duration = Math.Min(duration, 30.FromSecondsToNano());
                var period = sample.Timestamp - leaderBoard.OverlayData.TimeForOutroOverlay.Value.FromSecondsToNano();
                var page = FlashCardPaging.GetPageNumber(leaderBoard.OverlayData.SessionData.DriverInfo, (float)period / duration);

                leaderBoard.Outro(sample.Graphic, sample.Timestamp, page);
                return;
            }

            leaderBoard.Overlay(sample.Graphic, sample.Timestamp);
        }
예제 #8
0
 void applyOverlay(SourceReaderSampleWithBitmap sample)
 {
     var f = new Font("Artial", 15, FontStyle.Bold);
     sample.Graphic.DrawString("TEST", f, new SolidBrush(Color.Black), new PointF(500, 500));
 }