private void DrawScene (ContextWrapper cw, double alpha) { var R = 60.0; var dR = R - 10.0; cw.Translate(cw.Center); var scale = Math.Min (cw.Width, cw.Height) / 250.0; cw.Context.Scale (scale, scale); cw.Context.Rotate(alpha); cw.Circle(0, -dR, R); cw.Color = color1; cw.Context.Fill(); cw.Context.Rotate(Angle.PI(2,3)); cw.Circle(0, -dR, R); cw.Color = color2; cw.Context.Fill(); cw.Context.Rotate (Angle.PI(2,3)); cw.Circle(0, -dR, R); cw.Color = color3; cw.Context.Fill(); }
protected void OnDrawingarea1ExposeEvent (object o, ExposeEventArgs args) { var cw = new ContextWrapper (o); cw.Translate (cw.Center); cw.Context.LineWidth = 1; cw.Circle (0, 0, 50); cw.Context.StrokePreserve (); cw.PushColor (); cw.Color = new Color2 ("#FFC0CB"); cw.Context.Fill (); cw.Circle (-50, -50, 100); cw.PopColor (); cw.Context.StrokePreserve (); cw.Color = new Color2 ("yellow", 0.5); cw.Context.Fill (); cw.Color = new Color2 ("black"); cw.RoundedRectangle (new Rectangle(50, 50, 100, 50), 15); cw.Context.Stroke (); cw.Context.IdentityMatrix (); cw.Translate (cw.Center); var rnd = new Random (); var points = new PointD[15]; for (var i = 0; i < points.Length; i++) { var p = new PointD (rnd.Next (200) - 100, rnd.Next (200) - 100); points[i] = p; } cw.Polygon (points); cw.Context.StrokePreserve (); cw.Context.Fill (); cw.Close (); }
/// <summary> /// Draw the bubble. /// </summary> /// <param name="cw">Cairo context wrapper.</param> public void Draw (ContextWrapper cw) { if (!IsEaten) { cw.Color = Color; cw.Circle (Center.X, Center.Y, R); cw.Context.Fill (); } }
private void DrawScene (ContextWrapper cw) { foreach (var b in bubbles) b.Draw(cw); }
protected virtual void OnDrawingarea1ExposeEvent (object o, Gtk.ExposeEventArgs args) { var cw = new ContextWrapper (o); // draw scene DrawScene (cw); // modify scene params ModifyScene (cw.Width, cw.Height); cw.Close (); }
protected virtual void OnDrawingarea1ExposeEvent (object o, Gtk.ExposeEventArgs args) { var cw = new ContextWrapper (o); DrawScene (cw, alpha); ModifyScene(); cw.Close (); }