Ejemplo n.º 1
0
        public void OutlineClipAudioHover(Graphics g, VidkaClipAudio aclip, ProjectDimensions dimdim, int Height)
        {
            throw new NotImplementedException();
            // TODO: this was never used...
            // TODO: write a generic function to handle both outline of video and audio clips
            int y1 = dimdim.getY_audio1(Height);
            int y2 = dimdim.getY_audio2(Height);
            //var secStart = dimdim.FrameToSec(aclip.FrameStart);
            //var secEnd = dimdim.FrameToSec(aclip.FrameEnd);
            int x1 = dimdim.convert_Frame2ScreenX(aclip.FrameStart);
            int x2 = dimdim.convert_Frame2ScreenX(aclip.FrameEnd);

            g.DrawRectangle(penHover, x1, y1, x2 - x1, y2 - y1);
            // TODO: audio clip trim direction not implemented!!!
        }
Ejemplo n.º 2
0
        public void DrawProjectAudioTimeline(
            Graphics g,
            int Width,
            int Height,
            VidkaProj proj,
            ProjectDimensions dimdim,
            VidkaClipAudio currentAudioClip,
            EditorDraggy draggy)
        {
            // draw video events
            long curFrame = 0;

            int y1    = dimdim.getY_audio1(Height);
            int y2    = dimdim.getY_audio2(Height);
            int cliph = y2 - y1;

            foreach (var aclip in proj.ClipsAudio)
            {
                if (dimdim.isEvenOnTheScreen(curFrame, curFrame + aclip.LengthFrameCalc, Width))
                {
                    int x1    = dimdim.convert_Frame2ScreenX(curFrame);
                    int x2    = dimdim.convert_Frame2ScreenX(curFrame + aclip.LengthFrameCalc);
                    int clipw = x2 - x1;

                    // active video clip deserves a special outline
                    //if (aclip == currentAudioClip)
                    //	g.FillRectangle(brushActive, x1, y1, clipw, clipvh);
                    //else
                    //	g.FillRectangle(brushWhite, x1, y1, clipw, clipvh);

                    throw new NotImplementedException("DrawWaveform that takes Audio clip!!!");
                    //DrawWaveform(g, proj, aclip, x1, y1, clipw, cliph,
                    //	proj.FrameToSec(aclip.FrameStart), proj.FrameToSec(aclip.FrameEnd));


                    // outline rect
                    g.DrawRectangle(penDefault, x1, y1, clipw, cliph);
                }

                curFrame += aclip.LengthFrameCalc;
            }
            if (draggy.Mode == EditorDraggyMode.AudioTimeline)
            {
                var draggyX = draggy.MouseX - draggy.MouseXOffset;
                var draggyW = dimdim.convert_FrameToAbsX(draggy.FrameLength);                 // hacky, i know
                g.DrawRectangle(penBorderDrag, draggyX, y1, draggyW, cliph);
            }
        }
Ejemplo n.º 3
0
        private void drawVideoClip(Graphics g,
                                   VidkaClipVideo vclip,
                                   long curFrame, int y1, int cliph, int clipvh,
                                   Brush brushClip,
                                   VidkaProj proj,
                                   VidkaFileMapping projMapping,
                                   ProjectDimensions dimdim)
        {
            int x1    = dimdim.convert_Frame2ScreenX(curFrame);
            int x2    = dimdim.convert_Frame2ScreenX(curFrame + vclip.LengthFrameCalc);
            int clipw = x2 - x1;

            // active video clip deserves a special outline, fill white otherwise to hide gray background
            g.FillRectangle(brushClip, x1, y1, clipw, clipvh);
            DrawClipBitmaps(
                g: g,
                proj: proj,
                projMapping: projMapping,
                vclip: vclip,
                x1: x1,
                y1: y1,
                clipw: clipw,
                clipvh: clipvh,
                secStart: proj.FrameToSec(vclip.FrameStart),
                len: proj.FrameToSec(vclip.LengthFrameCalc));
            DrawWaveform(g, proj, projMapping, vclip, x1, y1 + clipvh, clipw, cliph - clipvh,
                         proj.FrameToSec(vclip.FrameStart), proj.FrameToSec(vclip.FrameEnd));
            if (vclip.IsMuted)
            {
                g.FillRectangle(brushHazyMute, x1, y1 + clipvh, x2 - x1, cliph - clipvh);
            }
            // waveform separator
            g.DrawLine(penGray, x1, y1 + clipvh, x2, y1 + clipvh);
            // outline rect
            g.DrawRectangle(penDefault, x1, y1, clipw, cliph);
            // still analyzing...
            if (vclip.IsNotYetAnalyzed)
            {
                g.DrawString("Still analyzing...", fontDefault, brushDefault, x1 + 5, y1 + 5);
            }
        }
Ejemplo n.º 4
0
        internal void DrawCurrentFrameMarker(
            Graphics g,
            long markerFrame,
            int h,
            ProjectDimensions dimdim)
        {
            var y2      = h - dimdim.getY_timeAxisHeight(h);
            var markerX = dimdim.convert_Frame2ScreenX(markerFrame);

            g.DrawLine(penMarker, markerX, 0, markerX, y2);
            //g.DrawString("" + markerFrame, fontDefault, brushDefault, markerX, 0);
        }
Ejemplo n.º 5
0
        private void drawDraggyVideo(Graphics g, long curFrame, int y1, int cliph, int clipvh, EditorDraggy draggy, ProjectDimensions dimdim)
        {
            var draggyX = dimdim.convert_Frame2ScreenX(curFrame);
            var draggyW = dimdim.convert_FrameToAbsX(draggy.FrameLength);             // hacky, i know

            if (draggy.VideoClip != null)
            {
                g.FillRectangle(brushWhite, draggyX, y1, draggyW, cliph);
                g.FillRectangle(brushActive, draggyX, y1, draggyW, clipvh);
            }
            g.DrawRectangle(penBorderDrag, draggyX, y1, draggyW, cliph);
            g.DrawString(draggy.Text, fontDefault, brushDefault, draggyX + 5, y1 + 5);

            // debug rect
            //g.DrawRectangle(penDefault, draggy.MouseX-draggy.MouseXOffset, y1-2, draggyW, cliph+5);
        }
Ejemplo n.º 6
0
        public void DrawTimeAxis(Graphics g, ProjectDimensions dimdim, int w, int h, VidkaProj proj)
        {
            // compute how many segments/ticks/etc to draw
            var  frameStart        = dimdim.convert_ScreenX2Frame(0);
            var  frameEnd          = dimdim.convert_ScreenX2Frame(w);
            int  nSegments         = w / Settings.Default.MinnimumTimelineSegmentSizeInPixels;
            long framesPerSegment  = (frameEnd - frameStart) / nSegments;
            int  secondsPerSegment = (int)(framesPerSegment / proj.FrameRate);

            secondsPerSegment = Utils.GetClosestSnapToSecondsForTimeAxis(secondsPerSegment);
            if (secondsPerSegment == 0)             // we are zoomed in so much, but still show seconds
            {
                secondsPerSegment = 1;
            }
            // now that everything is rounded, how many segments do we really have?
            var actualFramesPerSegment = secondsPerSegment * proj.FrameRate;
            var actualNSegments        = (int)((frameEnd - frameStart) / actualFramesPerSegment);
            var startingSecond         = (long)Math.Floor(proj.FrameToSec(frameStart));

            // compute dimensions...
            var y1 = h - dimdim.getY_timeAxisHeight(h);
            var y2 = h;

            g.DrawLine(penGray, 0, y1, w, y1);
            for (var i = 0; i < actualNSegments + 1; i++)
            {
                var curSecond = startingSecond + i * secondsPerSegment;
                var scrX      = dimdim.convert_Sec2ScreenX(curSecond);
                var ts        = TimeSpan.FromSeconds(curSecond);
                g.DrawLine(penGray, scrX, y1, scrX, y2);
                g.DrawString(ts.ToString_MinuteOrHour(), fontDefault, brushDefault, scrX + 2, y1 + 4);
            }
            if (secondsPerSegment == 1 && framesPerSegment <= proj.FrameRate)
            {
                // draw frame ticks as well
                for (var i = frameStart; i < frameEnd; i++)
                {
                    var scrX = dimdim.convert_Frame2ScreenX(i);
                    g.DrawLine(penGray, scrX, y1, scrX, y1 + 3);
                }
            }
        }