protected sealed override void PaintSurface(DockySurface surface) { surface.Clear(); lock (buffers) { if (slideCounter > 0 && slideCounter < slideSteps) { double offset = Allocation.Width * Math.Log(slideCounter) / Math.Log(slideSteps); if (MovedLeft) { ShowBuffer(surface, Page, offset - Allocation.Width); ShowBuffer(surface, LastPage, offset); } else { ShowBuffer(surface, Page, Allocation.Width - offset); ShowBuffer(surface, LastPage, -offset); } // fade out the edges during a slide Gradient linpat = new LinearGradient(0, surface.Height / 2, surface.Width, surface.Height / 2); linpat.AddColorStop(0, new Color(1, 1, 1, 1)); linpat.AddColorStop(2 * (double)BUTTON_SIZE / surface.Width, new Color(1, 1, 1, 0)); linpat.AddColorStop(1 - 2 * (double)BUTTON_SIZE / surface.Width, new Color(1, 1, 1, 0)); linpat.AddColorStop(1, new Color(1, 1, 1, 1)); surface.Context.Save(); surface.Context.Operator = Operator.Source; surface.Context.Color = new Cairo.Color(0, 0, 0, 0); surface.Context.Mask(linpat); surface.Context.PaintWithAlpha(0); surface.Context.Restore(); linpat.Destroy(); } else { ShowBuffer(surface, Page, 0); } } // overlay the prev/next arrow buttons if (buttonBuffer != null && (buttonBuffer.Width != surface.Width || buttonBuffer.Height != surface.Height)) { ResetButtons(); } if (buttonBuffer == null) { buttonBuffer = new DockySurface(surface.Width, surface.Height, surface); DrawButtonsBuffer(); } buttonBuffer.Internal.Show(surface.Context, 0, 0); }