private void FlipOut(Gdi mem, Rectangle canvas, IntPtr dc, IntPtr stretchDC, double transitionPct) { int margin = (int)((double)_CanvasMiddle * transitionPct); using (Gdi stretch = Gdi.FromHdc(stretchDC, Rectangle.Empty)) { stretch.FillRect(canvas, Color.Gainsboro); stretch.StretchBlt(0, 0, canvas.Width - margin*2, canvas.Height, dc, 0, 0, canvas.Width, canvas.Height, TernaryRasterOperations.SRCCOPY); } var currLine = BuildPath(_FlipOutLeftPath[margin].X, _FlipOutLeftPath[margin].Y, _FlipOutTopPath[margin].X, _FlipOutTopPath[margin].Y); for (int i = 0; i < currLine.Count - 1; i++) { mem.StretchBlt(currLine[i].X, currLine[i].Y, 1, canvas.Height - currLine[i].Y*2, stretchDC, i, 0, 1, canvas.Height, TernaryRasterOperations.SRCCOPY); } }