protected override bool OnExposeEvent(Gdk.EventExpose evnt) { Context g = Gdk.CairoHelper.Create(evnt.Window); g.Antialias = Antialias.None; int winh; int winw; evnt.Window.GetSize(out winw, out winh); Cairo.Distance d = new Cairo.Distance(winw, winh); //this.BasicDrawTest (g); this.DrawUnits(g, d); this.DrawMapGrid(g, d); this.DrawMouse(g, d); ((IDisposable)g).Dispose(); return(true); }
protected void DrawUnits(Cairo.Context g, Cairo.Distance dimensions) { g.Save(); g.MoveTo(105, 105); g.LineTo(105, 205); g.LineTo(205, 205); g.LineTo(205, 105); g.LineTo(105, 105); g.Restore(); g.Color = MapWidget.convert_color(this.blue); g.FillPreserve(); g.Color = MapWidget.convert_color(this.black); g.LineWidth = 1; g.Stroke(); }
protected void DrawMouse(Cairo.Context g, Cairo.Distance dimensions) { if (this.drawmouse) { g.Save(); g.MoveTo((double)this.mouse_loc.X, 0); g.LineTo((double)this.mouse_loc.X, dimensions.Dy); g.MoveTo(0, (double)this.mouse_loc.Y); g.LineTo(dimensions.Dx, (double)this.mouse_loc.Y); g.Restore(); g.Color = MapWidget.convert_color(this.red); g.LineWidth = 1; g.Stroke(); } }
protected void DrawMapGrid(Cairo.Context g, Cairo.Distance dimensions) { g.Save(); double xspan = dimensions.Dx / MapWidget.xgridlines; double yspan = dimensions.Dy / MapWidget.ygridlines; xspan = yspan = 10.0; //Console.WriteLine ("dimensions={0}:{1} span={2}:{3}", dimensions.Dx, dimensions.Dy, xspan, yspan); /* * dimensions=1000:1000 span=1000:10 * dimensions=1000:1000 span=1000:10 * dimensions=1428:1000 span=1000:14.28 */ Cairo.PointD location = new Cairo.PointD(0.0, 0.0); // move along x axis for (int i = 0; i < MapWidget.xgridlines; i++) { location.X += xspan; Cairo.PointD p = new Cairo.PointD(location.X, 0); g.MoveTo(p); g.LineTo(location.X, ysize); } // move along y axis for (int i = 0; i < MapWidget.ygridlines; i++) { location.Y += yspan; Cairo.PointD p = new Cairo.PointD(0, location.Y); g.MoveTo(p); g.LineTo(xsize, location.Y); } g.Restore(); //g.Color = new Cairo.Color (86.0, 86.0, 86.0); g.Color = MapWidget.convert_color(this.gray); g.LineWidth = 1; g.Stroke(); }
public void RelMoveTo(Distance d) { RelMoveTo (d.Dx, d.Dy); }
public void RelLineTo(Distance d) { RelLineTo (d.Dx, d.Dy); }
public void RelCurveTo(Distance d1, Distance d2, Distance d3) { RelCurveTo (d1.Dx, d1.Dy, d2.Dx, d2.Dy, d3.Dx, d3.Dy); }
public void RelCurveTo(Distance d1, Distance d2, Distance d3) { RelCurveTo(d1.Dx, d1.Dy, d2.Dx, d2.Dy, d3.Dx, d3.Dy); }
public void RelLineTo(Distance d) { RelLineTo(d.Dx, d.Dy); }
public void RelMoveTo(Distance d) { RelMoveTo(d.Dx, d.Dy); }
public void RelCurveTo(Distance d1, Distance d2, Distance d3) { ThrowIfDisposed(); RelCurveTo(d1.Dx, d1.Dy, d2.Dx, d2.Dy, d3.Dx, d3.Dy); }
public void RelLineTo(Distance d) { ThrowIfDisposed(); RelLineTo(d.Dx, d.Dy); }
protected override bool OnExposeEvent(Gdk.EventExpose evnt) { Context g = Gdk.CairoHelper.Create (evnt.Window); g.Antialias = Antialias.None; int winh; int winw; evnt.Window.GetSize(out winw, out winh); Cairo.Distance d = new Cairo.Distance (winw, winh); //this.BasicDrawTest (g); this.DrawUnits (g, d); this.DrawMapGrid (g, d); this.DrawMouse (g, d); ((IDisposable)g).Dispose (); return true; }