void HandleExposeEvent(object o, ExposeEventArgs args) { using (Cairo.Context cr = Gdk.CairoHelper.Create(window.GdkWindow)) { cr.Scale((double)size / 128, (double)size / 128); cr.AlphaPaint(); int offset; switch ((int)Math.Floor(5 * AnimationState)) { case 0: offset = 0; break; case 1: offset = 128; break; case 2: offset = 128 * 2; break; case 3: offset = 128 * 3; break; default: offset = 128 * 4; break; } Gdk.CairoHelper.SetSourcePixbuf(cr, poof, 0, -(offset)); cr.Paint(); (cr.Target as IDisposable).Dispose(); } }