X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=dev4%2Fpsychlops%2Fcore%2Fgraphic%2Fmodule.cs;h=6adecfd3314ac29ae0fc8b3b7e99eab5cc8b2c85;hb=97a97a46267462940a24f18ad5bbd0f77006dfd9;hp=6fc1f15e1da3583a4fa9e4215c1d1cbeedc3b0ce;hpb=2d16c7bc232e1d8e0f57404c4b37e3a8db6ab207;p=psychlops%2Fsilverlight.git diff --git a/dev4/psychlops/core/graphic/module.cs b/dev4/psychlops/core/graphic/module.cs index 6fc1f15..6adecfd 100644 --- a/dev4/psychlops/core/graphic/module.cs +++ b/dev4/psychlops/core/graphic/module.cs @@ -4,6 +4,48 @@ using System.Windows; namespace Psychlops { + public static class StaticFunctions + { + public static T[] NewArray(int x) + where T : new() + { + T[] t = new T[x]; + for (int i = 0; i < x; i++) + { + t[i] = new T(); + } + return t; + } + public static T[,] NewArray(int x, int y) + where T : new() + { + T[,] t = new T[x,y]; + for (int i = 0; i < x; i++) + { + for (int j = 0; j < x; j++) + { + t[i,j] = new T(); + } + } + return t; + } + public static T[,,] NewArray(int x, int y, int z) + where T : new() + { + T[,,] t = new T[x, y, z]; + for (int i = 0; i < x; i++) + { + for (int j = 0; j < y; j++) + { + for (int k = 0; k < z; k++) + { + t[i, j, k] = new T(); + } + } + } + return t; + } + } public partial struct Point { @@ -96,6 +138,7 @@ namespace Psychlops void polygon(Polygon drawee); void letters(Letters drawee); void image(Image drawee); + void group(Group drawee); void msg(string s, double x, double y, Color c); } @@ -138,6 +181,76 @@ namespace Psychlops public interface PrimitiveFigure : Figure { UIElement toNative(); + UIElement poolNative(Canvas c); } } + + public partial class Group : Internal.PrimitiveFigure + { + System.Collections.Generic.List
list; + System.Windows.Controls.Canvas cnvs; + System.Windows.Media.TransformGroup trans; + System.Windows.Media.TransformCollection transF; + System.Windows.Media.RotateTransform rotateF; + SimpleProcedure setRotation_; + System.Windows.Media.ScaleTransform scaleF; + SimpleProcedure setScaling_; + System.Windows.Media.TranslateTransform translateF; + + bool AsyncBool; + double rotation_; + public double rotation + { + get { return rotation_; } + set { rotation_ = value; rotateF.Dispatcher.BeginInvoke(setRotation_); } + } + public Point axis + { + get; + set; + } + Point scaling_; + public Point scaling + { + get { return scaling_; } + set { scaling_ = value; scaleF.Dispatcher.BeginInvoke(setScaling_); } + } + + AppendFunc1 append_; + + public Group() + { + setRotation_ = new SimpleProcedure(setRotation__); + setScaling_ = new SimpleProcedure(setScaling__); + append_ = new AppendFunc1(append__); + list = new System.Collections.Generic.List
(); + AsyncBool = false; + initialize__(); + while (!AsyncBool) { } + } + + public Group append(Internal.PrimitiveFigure fig) + { + list.Add(fig); + cnvs.Dispatcher.BeginInvoke(append_, fig); + return this; + } + + public Point datum { get; set; } + public Figure shift(Point p) + { + datum = datum + p; + return this; + } + public Figure centering(Point p) + { + datum = p; + return this; + } + public void draw() + { + Main.drawable.group(this); + } + } + } \ No newline at end of file