Esempio n. 1
0
        internal void DrawCurrentClipVideo(
            Graphics g,
            VidkaClipVideo vclip,
            ProjectDimensions dimdim,
            VidkaProj proj,
            VidkaFileMapping projMapping,
            int w, int h,
            OutlineClipType type,
            bool isOriginalPlaybackMode,
            TrimDirection trimDirection,
            int trimBracketLength,
            long markerFrame,
            long selectedClipFrameOffset,
            long framesActiveMouseTrim)
        {
            int yMainTop   = dimdim.getY_main1(h);
            int xMain1     = dimdim.getScreenX1(vclip);
            int xMain2     = xMain1 + dimdim.convert_FrameToAbsX(vclip.LengthFrameCalc);    //hacky, I know
            int xMainDelta = dimdim.convert_FrameToAbsX(framesActiveMouseTrim);             //hacky, I know
            int xOrig1     = dimdim.convert_Frame2ScreenX_OriginalTimeline(vclip.FrameStart, vclip.FileLengthFrames, w);
            int xOrig2     = dimdim.convert_Frame2ScreenX_OriginalTimeline(vclip.FrameEnd, vclip.FileLengthFrames, w);
            int xOrigDelta = dimdim.convert_Frame2ScreenX_OriginalTimeline(framesActiveMouseTrim, vclip.FileLengthFrames, w);             // hacky, I know
            int y1         = dimdim.getY_original1(h);
            int y2         = dimdim.getY_original2(h);
            int yaudio     = dimdim.getY_original_half(h);

            // draw entire original clip (0 .. vclip.FileLength)
            g.FillRectangle(brushWhite, 0, y1, w, y2 - y1);
            g.FillRectangle(brushActive, xOrig1, y1, xOrig2 - xOrig1, y2 - y1);
            DrawClipBitmaps(g, proj, projMapping, vclip, 0, y1, w, yaudio - y1, 0, vclip.FileLengthSec ?? 0);
            DrawWaveform(g, proj, projMapping, vclip, 0, yaudio, w, y2 - yaudio, 0, vclip.FileLengthSec ?? 0);
            if (vclip.IsMuted)
            {
                g.FillRectangle(brushHazyMute, xOrig1, yaudio, xOrig2 - xOrig1, y2 - yaudio);
            }
            g.DrawLine(penGray, 0, yaudio, w, yaudio);
            g.DrawRectangle(penDefault, 0, y1, w, y2 - y1);

            //draw clip bounds
            g.DrawLine((type == OutlineClipType.Hover) ? penHover : penGray, xMain1, yMainTop, xOrig1, y2);
            g.DrawLine((type == OutlineClipType.Hover) ? penHover : penGray, xMain2, yMainTop, xOrig2, y2);
            g.DrawLine((type == OutlineClipType.Hover) ? penHover : penGray, xOrig1, y1, xOrig1, y2);
            g.DrawLine((type == OutlineClipType.Hover) ? penHover : penGray, xOrig2, y1, xOrig2, y2);
            if (type == OutlineClipType.Hover)
            {
                if (trimDirection == TrimDirection.Left)
                {
                    g.DrawLine(penActiveBoundary, xMain1 + xMainDelta, yMainTop, xOrig1 + xOrigDelta, y2);
                    drawTrimBracket(g, xOrig1, y1, y2, TrimDirection.Left, trimBracketLength, xOrigDelta, dimdim);
                }
                if (trimDirection == TrimDirection.Right)
                {
                    g.DrawLine(penActiveBoundary, xMain2 + xMainDelta, yMainTop, xOrig2 + xOrigDelta, y2);
                    drawTrimBracket(g, xOrig2, y1, y2, TrimDirection.Right, trimBracketLength, xOrigDelta, dimdim);
                }
            }

            // draw marker on
            var frameOffset = isOriginalPlaybackMode
                                ? markerFrame
                                : markerFrame - selectedClipFrameOffset + vclip.FrameStart;
            int xMarker = dimdim.convert_Frame2ScreenX_OriginalTimeline(frameOffset, vclip.FileLengthFrames, w);

            g.DrawLine(penMarker, xMarker, y1, xMarker, y2);
        }