Beispiel #1
0
 public static Drawable ChangeDefStyles(Drawable d, GraphicsStyle s)
 {
     return((p, g, sty) =>
     {
         sty = sty ?? s;
         d(p, g, sty);
     });
 }
Beispiel #2
0
 public static Drawable MakeCenteredRectangle(Particle whr, GraphicsStyle def)
 {
     return((Particle p, Graphics g, GraphicsStyle sty) =>
     {
         sty = sty ?? def;
         whr.Time = p.Time;
         Vector <double> ul = p.CurrentPosition - whr.CurrentPosition;
         Vector <double> lw = 2 * whr.CurrentPosition;
         Vector <int> uli = ul.Map(x => (int)x);
         Vector <int> lwi = lw.Map(x => (int)x);
         Rectangle r = new Rectangle(uli[0], uli[1], lwi[0], lwi[1]);
         if (sty.Brush != null)
         {
             g.FillRectangle(sty.Brush, r);
         }
         if (sty.Pen != null)
         {
             g.DrawRectangle(sty.Pen, r);
         }
     });
 }
Beispiel #3
0
 public static Drawable MakeEllipse(Particle rad, GraphicsStyle def = null)
 {
     def = def ?? GraphicsStyle.DEFAULT;
     return((Particle p, Graphics g, GraphicsStyle sty) =>
     {
         sty = sty ?? def;
         rad.Time = p.Time;
         Vector <double> ul = p.CurrentPosition - rad.CurrentPosition;
         Vector <double> lw = 2 * rad.CurrentPosition;
         Vector <int> uli = ul.Map(x => (int)x);
         Vector <int> lwi = lw.Map(x => (int)x);
         Rectangle r = new Rectangle(uli[0], uli[1], lwi[0], lwi[1]);
         if (sty.Brush != null)
         {
             g.FillEllipse(sty.Brush, r);
         }
         if (sty.Pen != null)
         {
             g.DrawEllipse(sty.Pen, r);
         }
     });
 }
Beispiel #4
0
 public static Drawable MakeCircle(double rad, GraphicsStyle def = null)
 {
     return(MakeEllipse(new Particle(x => rad, y => rad), def));
 }