2 using System.Windows;
\r
3 using System.Windows.Controls;
\r
4 using System.Windows.Documents;
\r
5 using System.Windows.Input;
\r
6 using System.Windows.Media;
\r
7 using System.Windows.Media.Animation;
\r
8 using System.Windows.Media.Imaging;
\r
9 using System.Windows.Shapes;
\r
10 using System.Windows.Browser;
\r
20 public class StackableDrawable : Drawable
\r
22 // protected System.Collections.Generic.Queue<Internal.PrimitiveFigure> stack;
\r
23 internal Internal.PrimitiveFigure[] stack;
\r
24 internal int stackN;
\r
25 internal Line[] lineStack;
\r
26 internal int lineStackN;
\r
27 internal Rectangle[] rectStack;
\r
28 internal int rectStackN;
\r
29 internal Ellipse[] ellipseStack;
\r
30 internal int ellipseStackN;
\r
31 internal Polygon[] polygonStack;
\r
32 internal int polygonStackN;
\r
33 internal Letters[] lettersStack;
\r
34 internal int lettersStackN;
\r
35 internal Image[] imageStack;
\r
36 internal int imageStackN;
\r
39 public StackableDrawable()
\r
41 // stack = new System.Collections.Generic.Queue<Internal.PrimitiveFigure>();
\r
42 stack = new Internal.PrimitiveFigure[40000];
\r
43 lineStack = new Line[10000];
\r
44 rectStack = new Rectangle[10000];
\r
45 ellipseStack = new Ellipse[10000];
\r
46 polygonStack = new Polygon[1000];
\r
47 lettersStack = new Letters[1000];
\r
48 imageStack = new Image[1000];
\r
49 for (int i = 0; i < 10000; i++)
\r
51 lineStack[i] = new Line(0,0,0,0);
\r
52 rectStack[i] = new Rectangle();
\r
53 ellipseStack[i] = new Ellipse();
\r
55 for (int i = 0; i < 1000; i++)
\r
57 polygonStack[i] = new Polygon();
\r
58 lettersStack[i] = new Letters();
\r
59 imageStack[i] = new Image(1,1);
\r
67 public virtual void clear(Color col)
\r
69 //rect(back_panel, col);
\r
72 public virtual void pix(int x, int y, Color col)
\r
76 public virtual void line(Line drawee)
\r
78 // stack.Enqueue(drawee.clone());
\r
79 drawee.copyToStack(this);
\r
82 public virtual void rect(Rectangle drawee)
\r
84 //stack.Enqueue(drawee.clone());
\r
85 // stack.Enqueue(drawee.copyToStack(this));
\r
86 drawee.copyToStack(this);
\r
89 public virtual void ellipse(Ellipse drawee)
\r
91 // stack.Enqueue(drawee.clone());
\r
92 drawee.copyToStack(this);
\r
95 public virtual void polygon(Polygon drawee)
\r
97 // stack.Enqueue(drawee.clone());
\r
98 drawee.copyToStack(this);
\r
101 public virtual void letters(Letters drawee)
\r
103 // stack.Enqueue(drawee.clone());
\r
104 drawee.copyToStack(this);
\r
107 public virtual void image(Image drawee)
\r
109 // stack.Enqueue(drawee.clone());
\r
110 drawee.copyToStack(this);
\r
113 public void msg(string str, double x, double y) { msg(str, x, y, Color.white); }
\r
114 public virtual void msg(string dstr, double x, double y, Color col)
\r
116 var let = new Letters(dstr);
\r
121 public void var<Type>(Type val, double x, double y) { msg(val.ToString(), x, y, Color.white); }
\r
122 public void var<Type>(Type val, double x, double y, Color col) { msg(val.ToString(), x, y, col); }
\r
124 public virtual Point getCenter() { return new Point(0, 0, 0); }
\r
129 public class Canvas : Templates.StackableDrawable
\r
132 internal System.Windows.Controls.Canvas masterPool, prevPool;
\r
133 internal System.Windows.Point[] pointPool;
\r
134 internal int pointPoolN;
\r
135 internal SolidColorBrush[] brushPool;
\r
136 internal int brushPoolN;
\r
137 internal System.Windows.Shapes.Line[] linePool;
\r
138 internal int linePoolN;
\r
139 internal System.Windows.Shapes.Rectangle[] rectPool;
\r
140 internal int rectPoolN;
\r
141 internal System.Windows.Shapes.Ellipse[] ellipsePool;
\r
142 internal int ellipsePoolN;
\r
143 internal System.Windows.Shapes.Polygon[] polygonPool;
\r
144 internal int polygonPoolN;
\r
145 internal System.Windows.Controls.TextBlock[] lettersPool;
\r
146 internal int lettersPoolN;
\r
147 internal System.Windows.Controls.Image[] imagePool;
\r
148 internal int imagePoolN;
\r
150 #region initializer
\r
152 internal delegate void TwoIntProcedure(int x, int y);
\r
153 internal delegate void SimpleProcedure();
\r
154 SimpleProcedure flipexec;
\r
156 //public static System.Windows.Controls.Image default_buffer_frame;
\r
157 public static System.Windows.Controls.UserControl default_panel;
\r
158 public static System.Windows.Controls.Canvas default_api_canvas;
\r
159 public static WriteableBitmap default_buffer;
\r
160 //WriteableBitmap buffer;
\r
161 //System.Windows.Controls.Image instance;
\r
162 System.Windows.Controls.Canvas api_canvas;
\r
163 System.Windows.Controls.UserControl panel;
\r
164 Rectangle back_panel;
\r
165 double width_, height_;
\r
167 public Canvas(int wid, int hei)
\r
169 panel = default_panel;
\r
170 api_canvas = default_api_canvas;
\r
171 initialize(wid, hei);
\r
173 public Canvas(int wid, int hei, System.Windows.Controls.Canvas apicnvs, System.Windows.Controls.UserControl system)
\r
176 api_canvas = apicnvs;
\r
177 initialize(wid, hei);
\r
180 protected bool AsyncInitBool;
\r
181 protected void initialize(int wid, int hei)
\r
183 AsyncInitBool = false;
\r
186 api_canvas.Dispatcher.BeginInvoke(new TwoIntProcedure(initialize__), wid, hei);
\r
187 while(!AsyncInitBool)
\r
190 Mouse._prime = api_canvas;
\r
191 Main.drawable = this;
\r
192 Main.canvas = this;
\r
194 back_panel = new Rectangle(wid, hei);
\r
196 flipexec = new SimpleProcedure(executeFlip);
\r
198 protected void initialize__(int wid, int hei)
\r
200 api_canvas.Width = wid;
\r
201 api_canvas.Height = hei;
\r
202 api_canvas.MouseMove += Mouse.Canvas_MousePos;
\r
203 api_canvas.MouseLeftButtonDown += Mouse.Canvas_LDown;
\r
204 api_canvas.MouseLeftButtonUp += Mouse.Canvas_LUp;
\r
205 api_canvas.MouseWheel += Mouse.Canvas_MouseWheel;
\r
206 panel.KeyDown += Keyboard.Canvas_KeyDown;
\r
207 panel.KeyUp += Keyboard.Canvas_KeyUp;
\r
209 HtmlElement htmlHost = HtmlPage.Document.GetElementById("silverlightControlHost");
\r
210 //if (htmlHost != null) HtmlPage.Window.Alert("silverlightControlHost is null");
\r
211 htmlHost.SetStyleAttribute("width", (wid).ToString()+"px");
\r
212 htmlHost.SetStyleAttribute("height", (20+hei).ToString() + "px");
\r
213 htmlHost.SetStyleAttribute("margin", "2em auto auto auto");
\r
216 pointPool = new System.Windows.Point[10000];
\r
217 brushPool = new SolidColorBrush[10000];
\r
218 linePool = new System.Windows.Shapes.Line[10000];
\r
219 rectPool = new System.Windows.Shapes.Rectangle[10000];
\r
220 ellipsePool = new System.Windows.Shapes.Ellipse[10000];
\r
221 for (int i = 0; i < 10000; i++)
\r
223 pointPool[i] = new System.Windows.Point();
\r
224 brushPool[i] = new SolidColorBrush();
\r
225 linePool[i] = new System.Windows.Shapes.Line();
\r
226 rectPool[i] = new System.Windows.Shapes.Rectangle();
\r
227 ellipsePool[i] = new System.Windows.Shapes.Ellipse();
\r
229 polygonPool = new System.Windows.Shapes.Polygon[1000];
\r
230 lettersPool = new System.Windows.Controls.TextBlock[1000];
\r
231 for (int i = 0; i < 1000; i++)
\r
233 polygonPool[i] = new System.Windows.Shapes.Polygon();
\r
234 lettersPool[i] = new System.Windows.Controls.TextBlock();
\r
237 masterPool = new System.Windows.Controls.Canvas();
\r
238 prevPool = new System.Windows.Controls.Canvas();
\r
239 api_canvas.Children.Add(masterPool);
\r
240 //api_canvas.Children.Remove(Internal.Main.widgetStack);
\r
242 AsyncInitBool = true;
\r
247 #region static initializer
\r
249 static System.Windows.Shapes.Line api_line;
\r
250 static System.Windows.Shapes.Path api_curve;
\r
251 static System.Windows.Shapes.Rectangle api_rect;
\r
252 static System.Windows.Shapes.Ellipse api_ellipse;
\r
253 static System.Windows.Shapes.Polygon api_polygon;
\r
254 static System.Windows.Shapes.Polyline api_polyline;
\r
255 static System.Windows.Media.Color api_color;
\r
256 static System.Windows.Media.SolidColorBrush api_fill;
\r
257 static System.Windows.Media.SolidColorBrush api_stroke;
\r
258 static System.Windows.Media.TranslateTransform api_translation;
\r
261 api_line = new System.Windows.Shapes.Line();
\r
262 api_curve = new System.Windows.Shapes.Path();
\r
263 api_rect = new System.Windows.Shapes.Rectangle();
\r
264 api_ellipse = new System.Windows.Shapes.Ellipse();
\r
265 api_polygon = new System.Windows.Shapes.Polygon();
\r
266 api_polyline = new System.Windows.Shapes.Polyline();
\r
267 api_color = new System.Windows.Media.Color();
\r
268 api_fill = new System.Windows.Media.SolidColorBrush();
\r
269 api_stroke = new System.Windows.Media.SolidColorBrush();
\r
270 api_translation = new System.Windows.Media.TranslateTransform();
\r
276 public override void clear(Color col)
\r
278 back_panel.fill = col;
\r
283 int nextIntervalFrame = 1, chacked = 0;
\r
284 public void flip(int n)
\r
292 nextIntervalFrame = 1;
\r
315 Internal.Main.canvas_flag.WaitOne();
\r
317 public void executeFlip()
\r
321 nextIntervalFrame--;
\r
323 if (nextIntervalFrame <= 0)
\r
327 masterPool.Children.Clear();
\r
330 for (int i = 0; i < stackN - 2; i++)
\r
332 masterPool.Children.Add(stack[i].poolNative(this));
\r
340 Psychlops.Internal.Main.canvas_flag.Set();
\r
343 System.Threading.Thread.Sleep(0);
\r
350 public double width { get { return width_; } }
\r
351 public double height { get { return height_; } }
\r
352 public Point center { get { return new Point(width / 2.0, height / 2.0, 0); } }
\r
353 public double getWidth() { return width; }
\r
354 public double getHeight() { return height; }
\r
355 public override Point getCenter() { return center; }
\r
356 public double getHCenter() { return width / 2; }
\r
357 public double getVCenter() { return height / 2; }
\r
358 public double getRefreshRate() { return 60; }
\r
367 #region primitive tokenizer
\r
369 partial struct Point
\r
371 public static implicit operator System.Windows.Point(Point d)
\r
373 return new System.Windows.Point(d.x, d.y);
\r
377 partial struct Color
\r
379 public static implicit operator System.Windows.Media.Color(Color d)
\r
381 return System.Windows.Media.Color.FromArgb((byte)(d.a * 255), (byte)(d.r * 255), (byte)(d.g * 255), (byte)(d.b * 255));
\r
383 public static implicit operator System.Windows.Media.SolidColorBrush(Color d)
\r
385 return new SolidColorBrush { Color = d };
\r
389 partial struct Stroke
\r
391 public void apply(System.Windows.Shapes.Shape target)
\r
393 target.Stroke = this;
\r
394 //target.StrokeDashArray
\r
395 target.StrokeThickness = thick;
\r
397 public static implicit operator SolidColorBrush(Stroke d)
\r
399 return new SolidColorBrush { Color = d.color };
\r
407 return (Line)MemberwiseClone();
\r
409 public Line clone()
\r
411 return (Line)MemberwiseClone();
\r
413 public static implicit operator System.Windows.Shapes.Line(Line d)
\r
415 var tmp = new System.Windows.Shapes.Line() { X1 = d.begin.x, Y1 = d.begin.y, X2 = d.end.x, Y2 = d.end.y };
\r
416 if (d.stroke.thick == 0.0) tmp.Stroke = d.fill;
\r
417 else d.stroke.apply(tmp);
\r
420 public UIElement toNative() { return this; }
\r
422 public void copyToStack(Templates.StackableDrawable d)
\r
424 var tmp = d.lineStack[d.lineStackN];
\r
425 tmp.begin.x = begin.x;
\r
426 tmp.begin.y = begin.y;
\r
430 tmp.stroke = stroke;
\r
431 d.stack[d.stackN] = tmp;
\r
435 public UIElement poolNative(Canvas d)
\r
437 var tmp = d.linePool[d.linePoolN];
\r
442 if (stroke.thick == 0.0) tmp.Stroke = fill;
\r
443 else stroke.apply(tmp);
\r
444 System.Windows.Controls.Canvas.SetLeft(tmp, left);
\r
445 System.Windows.Controls.Canvas.SetTop(tmp, top);
\r
446 tmp.Visibility = Visibility.Visible;
\r
452 partial class Rectangle
\r
454 public Rectangle dup()
\r
456 return (Rectangle)MemberwiseClone();
\r
458 public Rectangle clone()
\r
460 return (Rectangle)MemberwiseClone();
\r
462 public static implicit operator System.Windows.Rect(Rectangle d)
\r
464 return new System.Windows.Rect(d.v1.x, d.v1.y, d.v2.x, d.v2.y);
\r
466 public static implicit operator System.Windows.Shapes.Rectangle(Rectangle d)
\r
468 var tmp = new System.Windows.Shapes.Rectangle { Width = d.width, Height = d.height, Fill = d.fill };
\r
469 d.stroke.apply(tmp);
\r
470 System.Windows.Controls.Canvas.SetLeft(tmp, d.left);
\r
471 System.Windows.Controls.Canvas.SetTop(tmp, d.top);
\r
475 public UIElement toNative() { return this; }
\r
476 public void copyToStack(Templates.StackableDrawable d)
\r
478 var tmp = d.rectStack[d.rectStackN];
\r
482 d.stack[d.stackN] = tmp;
\r
486 public UIElement poolNative(Canvas d)
\r
488 var tmp = d.rectPool[d.rectPoolN];
\r
490 tmp.Height = height;
\r
492 System.Windows.Controls.Canvas.SetLeft(tmp, left);
\r
493 System.Windows.Controls.Canvas.SetTop(tmp, top);
\r
494 tmp.Visibility = Visibility.Visible;
\r
500 partial class Ellipse
\r
502 public Ellipse dup()
\r
504 return (Ellipse)MemberwiseClone();
\r
506 public Ellipse clone()
\r
508 return (Ellipse)MemberwiseClone();
\r
510 public static implicit operator System.Windows.Shapes.Ellipse(Ellipse d)
\r
512 var tmp = new System.Windows.Shapes.Ellipse { Width = d.width, Height = d.height, Fill = d.fill };
\r
513 d.stroke.apply(tmp);
\r
514 System.Windows.Controls.Canvas.SetLeft(tmp, d.left);
\r
515 System.Windows.Controls.Canvas.SetTop(tmp, d.top);
\r
519 public UIElement toNative() { return this; }
\r
521 public void copyToStack(Templates.StackableDrawable d)
\r
523 var tmp = d.ellipseStack[d.ellipseStackN];
\r
525 tmp.xdiameter = xdiameter;
\r
526 tmp.ydiameter = ydiameter;
\r
528 d.stack[d.stackN] = tmp;
\r
532 public UIElement poolNative(Canvas d)
\r
534 var tmp = d.ellipsePool[d.ellipsePoolN];
\r
536 tmp.Height = height;
\r
538 System.Windows.Controls.Canvas.SetLeft(tmp, left);
\r
539 System.Windows.Controls.Canvas.SetTop(d.rectPool[d.rectPoolN], top);
\r
540 tmp.Visibility = Visibility.Visible;
\r
546 partial class Polygon
\r
548 public Polygon dup()
\r
550 return (Polygon)MemberwiseClone();
\r
552 public Polygon clone()
\r
554 return (Polygon)MemberwiseClone();
\r
556 public static implicit operator System.Windows.Shapes.Polygon(Polygon d)
\r
558 var tmp = new System.Windows.Shapes.Polygon { Fill = d.fill };
\r
559 d.stroke.apply(tmp);
\r
560 foreach (Point p in d.vertices)
\r
564 System.Windows.Controls.Canvas.SetLeft(tmp, d.datum.x);
\r
565 System.Windows.Controls.Canvas.SetTop(tmp, d.datum.y);
\r
568 public UIElement toNative() { return this; }
\r
570 public void copyToStack(Templates.StackableDrawable d)
\r
572 var tmp = d.polygonStack[d.polygonStackN];
\r
574 tmp.vertices.Clear();
\r
575 foreach (var v in vertices)
\r
577 tmp.vertices.Add(v);
\r
580 d.stack[d.stackN] = tmp;
\r
584 public UIElement poolNative(Canvas d)
\r
586 var tmp = d.polygonPool[d.polygonPoolN];
\r
588 tmp.Points.Clear();
\r
589 foreach (var v in vertices)
\r
593 System.Windows.Controls.Canvas.SetLeft(tmp, datum.x);
\r
594 System.Windows.Controls.Canvas.SetTop(d.rectPool[d.rectPoolN], datum.y);
\r
595 tmp.Visibility = Visibility.Visible;
\r
602 partial class Letters
\r
604 #region static initializer
\r
605 internal static System.Collections.Generic.Dictionary<int, System.Windows.FontWeight> FONT_WEIGHT_BRIDGE;
\r
606 internal static System.Collections.Generic.Dictionary<Font.Style, System.Windows.FontStyle> FONT_STYLE_BRIDGE;
\r
607 internal static System.Collections.Generic.Dictionary<Letters.HorizontalAlign, TextAlignment> LETTERS_H_ALIGN_BRIDGE;
\r
610 FONT_WEIGHT_BRIDGE = new System.Collections.Generic.Dictionary<int, System.Windows.FontWeight>();
\r
611 FONT_WEIGHT_BRIDGE.Add((int)Font.Weight.normal, System.Windows.FontWeights.Normal);
\r
612 FONT_WEIGHT_BRIDGE.Add((int)Font.Weight.bold, System.Windows.FontWeights.Bold);
\r
613 FONT_STYLE_BRIDGE = new System.Collections.Generic.Dictionary<Font.Style, System.Windows.FontStyle>();
\r
614 FONT_STYLE_BRIDGE.Add(Font.Style.normal, System.Windows.FontStyles.Normal);
\r
615 FONT_STYLE_BRIDGE.Add(Font.Style.italic, System.Windows.FontStyles.Italic);
\r
616 FONT_STYLE_BRIDGE.Add(Font.Style.oblique, System.Windows.FontStyles.Italic);
\r
617 LETTERS_H_ALIGN_BRIDGE = new System.Collections.Generic.Dictionary<Letters.HorizontalAlign, TextAlignment>();
\r
618 LETTERS_H_ALIGN_BRIDGE.Add(Letters.HorizontalAlign.left, TextAlignment.Left);
\r
619 LETTERS_H_ALIGN_BRIDGE.Add(Letters.HorizontalAlign.center, TextAlignment.Center);
\r
620 LETTERS_H_ALIGN_BRIDGE.Add(Letters.HorizontalAlign.right, TextAlignment.Right);
\r
621 LETTERS_H_ALIGN_BRIDGE.Add(Letters.HorizontalAlign.not_specified, TextAlignment.Left);
\r
624 public Letters dup()
\r
626 return (Letters)MemberwiseClone();
\r
628 public Letters clone()
\r
630 return (Letters)MemberwiseClone();
\r
632 public static implicit operator System.Windows.Controls.TextBlock(Letters d)
\r
634 //var zapi_shape = new System.Windows.Documents.Glyphs();
\r
635 var tmp = new System.Windows.Controls.TextBlock {
\r
636 Text = d.str, Width = 500, Height = 500,
\r
637 FontSize = d.font.size,
\r
638 //tmp.FontFamily = ,
\r
639 FontStyle = FONT_STYLE_BRIDGE[d.font.style],
\r
640 FontWeight = FONT_WEIGHT_BRIDGE[d.font.weight],
\r
641 TextAlignment = LETTERS_H_ALIGN_BRIDGE[d.align],
\r
642 Foreground = d.fill
\r
647 case Letters.HorizontalAlign.left: break;
\r
648 case Letters.HorizontalAlign.center: left = tmp.Width / 2; break;
\r
649 case Letters.HorizontalAlign.right: left = tmp.Width; break;
\r
651 System.Windows.Controls.Canvas.SetLeft(tmp, d.datum.x - left);
\r
652 System.Windows.Controls.Canvas.SetTop(tmp, d.datum.y - d.font.size);
\r
655 public UIElement toNative() { return this; }
\r
657 public void copyToStack(Templates.StackableDrawable d)
\r
659 var tmp = d.lettersStack[d.lettersStackN];
\r
663 d.stack[d.stackN] = tmp;
\r
667 public UIElement poolNative(Canvas d)
\r
669 var tmp = d.lettersPool[d.lettersPoolN];
\r
673 tmp.FontSize = font.size;
\r
674 //tmp.FontFamily = ,
\r
675 tmp.FontStyle = FONT_STYLE_BRIDGE[font.style];
\r
676 tmp.FontWeight = FONT_WEIGHT_BRIDGE[font.weight];
\r
677 tmp.TextAlignment = LETTERS_H_ALIGN_BRIDGE[align];
\r
678 tmp.Foreground = fill;
\r
679 System.Windows.Controls.Canvas.SetLeft(tmp, datum.x);
\r
680 System.Windows.Controls.Canvas.SetTop(d.rectPool[d.rectPoolN], datum.y);
\r
681 tmp.Visibility = Visibility.Visible;
\r
687 partial class Image
\r
689 internal void initialize__(int wid, int hei)
\r
691 Canvas.default_api_canvas.Dispatcher.BeginInvoke(new Canvas.TwoIntProcedure(create__), wid, hei);
\r
692 //buffer = new WriteableBitmap(wid, hei);
\r
694 internal void create__(int wid, int hei)
\r
696 buffer = new WriteableBitmap(wid, hei);
\r
699 delegate void FieldFunc1(System.Func<int, int, System.Windows.Media.Color> func);
\r
700 delegate void FieldFunc2(System.Func<int, int, System.Windows.Media.Color, System.Windows.Media.Color> func);
\r
701 public void field__(System.Func<int, int, System.Windows.Media.Color> func)
\r
703 Canvas.default_api_canvas.Dispatcher.BeginInvoke(new FieldFunc1(field___), func);
\r
704 //buffer.ForEach(func);
\r
706 public void field__(System.Func<int, int, System.Windows.Media.Color, System.Windows.Media.Color> func)
\r
708 Canvas.default_api_canvas.Dispatcher.BeginInvoke(new FieldFunc2(field___), func);
\r
709 //buffer.ForEach(func);
\r
711 public void field___(System.Func<int, int, System.Windows.Media.Color> func)
\r
713 buffer.ForEach(func);
\r
715 public void field___(System.Func<int, int, System.Windows.Media.Color, System.Windows.Media.Color> func)
\r
717 buffer.ForEach(func);
\r
720 public Image clone()
\r
722 return (Image)MemberwiseClone();
\r
724 public static implicit operator System.Windows.Controls.Image(Image d)
\r
726 var tmp = new System.Windows.Controls.Image();
\r
727 tmp.Source = d.buffer;
\r
728 System.Windows.Controls.Canvas.SetLeft(tmp, d.datum.x);
\r
729 System.Windows.Controls.Canvas.SetTop(tmp, d.datum.y);
\r
732 public UIElement toNative() { return this; }
\r
734 public void copyToStack(Templates.StackableDrawable d)
\r
736 var tmp = d.imageStack[d.imageStackN];
\r
738 tmp.buffer = buffer;
\r
739 tmp.self_rect = self_rect;
\r
740 d.stack[d.stackN] = tmp;
\r
744 public UIElement poolNative(Canvas d)
\r
746 var tmp = d.imagePool[d.imagePoolN];
\r
747 tmp.Source = buffer;
\r
748 System.Windows.Controls.Canvas.SetLeft(tmp, datum.x);
\r
749 System.Windows.Controls.Canvas.SetTop(d.rectPool[d.rectPoolN], datum.y);
\r
750 tmp.Visibility = Visibility.Visible;
\r