OSDN Git Service

123
authorunknown <hskwk@.(none)>
Wed, 11 Aug 2010 15:12:58 +0000 (00:12 +0900)
committerunknown <hskwk@.(none)>
Wed, 11 Aug 2010 15:12:58 +0000 (00:12 +0900)
dev4/psychlops/core/graphic/canvas.cs
dev4/psychlops/core/graphic/module.cs
test4/MainPage.xaml.cs
test4/PsychlopsMain.cs

index 5a1a7c9..fdc3987 100644 (file)
@@ -34,19 +34,22 @@ namespace Psychlops
                        internal int lettersStackN;\r
                        internal Image[] imageStack;\r
                        internal int imageStackN;\r
+                       internal Group[] groupStack;\r
+                       internal int groupStackN;\r
 \r
 \r
                        public StackableDrawable()\r
                        {\r
 //                             stack = new System.Collections.Generic.Queue<Internal.PrimitiveFigure>();\r
-                               stack = new Internal.PrimitiveFigure[40000];\r
-                               lineStack = new Line[10000];\r
-                               rectStack = new Rectangle[10000];\r
-                               ellipseStack = new Ellipse[10000];\r
+                               stack = new Internal.PrimitiveFigure[10000];\r
+                               lineStack = new Line[2000];\r
+                               rectStack = new Rectangle[2000];\r
+                               ellipseStack = new Ellipse[2000];\r
                                polygonStack = new Polygon[1000];\r
                                lettersStack = new Letters[1000];\r
-                               imageStack = new Image[1000];\r
-                               for (int i = 0; i < 10000; i++)\r
+                               imageStack = new Image[100];\r
+                               groupStack = new Group[100];\r
+                               for (int i = 0; i < 2000; i++)\r
                                {\r
                                        lineStack[i] = new Line(0,0,0,0);\r
                                        rectStack[i] = new Rectangle();\r
@@ -56,7 +59,11 @@ namespace Psychlops
                                {\r
                                        polygonStack[i] = new Polygon();\r
                                        lettersStack[i] = new Letters();\r
-                                       imageStack[i] = new Image(1,1);\r
+                               }\r
+                               for (int i = 0; i < 100; i++)\r
+                               {\r
+                                       imageStack[i] = new Image(1, 1);\r
+                                       groupStack[i] = new Group();\r
                                }\r
                        }\r
 \r
@@ -139,11 +146,12 @@ namespace Psychlops
                internal SolidColorBrush[] brushPool;\r
                internal int brushPoolN;\r
 \r
-               internal System.Windows.UIElement[] UIElementPool;\r
+               internal System.Windows.Controls.Canvas[] UIElementPool;\r
                internal int UIElementPoolN;\r
 \r
                internal System.Windows.Shapes.Line[] linePool;\r
                internal int linePoolN;\r
+               internal System.Windows.Shapes.Rectangle[] dummyRectPool;\r
                internal System.Windows.Shapes.Rectangle[] rectPool;\r
                internal int rectPoolN;\r
                internal System.Windows.Shapes.Ellipse[] ellipsePool;\r
@@ -154,6 +162,8 @@ namespace Psychlops
                internal int lettersPoolN;\r
                internal System.Windows.Controls.Image[] imagePool;\r
                internal int imagePoolN;\r
+               internal System.Windows.Controls.Canvas[] groupPool;\r
+               internal int groupPoolN;\r
 \r
                #region initializer\r
 \r
@@ -171,6 +181,7 @@ namespace Psychlops
                System.Windows.Controls.UserControl panel;\r
                Rectangle back_panel;\r
                double width_, height_;\r
+               Clock before;\r
 \r
                public Canvas(int wid, int hei)\r
                {\r
@@ -188,6 +199,8 @@ namespace Psychlops
                protected bool AsyncInitBool;\r
                protected void initialize(int wid, int hei)\r
                {\r
+                       before = new Clock();\r
+                       before.update();\r
                        AsyncInitBool = false;\r
                        width_ = wid;\r
                        height_ = hei;\r
@@ -207,7 +220,7 @@ namespace Psychlops
                protected void initialize__(int wid, int hei)\r
                {\r
                        api_canvas.Width = wid;\r
-                       api_canvas.Height = hei;\r
+                       api_canvas.Height = hei+20;\r
                        api_canvas.MouseMove += Mouse.Canvas_MousePos;\r
                        api_canvas.MouseLeftButtonDown += Mouse.Canvas_LDown;\r
                        api_canvas.MouseLeftButtonUp += Mouse.Canvas_LUp;\r
@@ -221,18 +234,21 @@ namespace Psychlops
                        htmlHost.SetStyleAttribute("height", (20+hei).ToString() + "px");\r
                        htmlHost.SetStyleAttribute("margin", "2em auto auto auto");\r
 \r
-                       UIElementPool = new System.Windows.UIElement[10000];\r
-                       pointPool = new System.Windows.Point[10000];\r
-                       brushPool = new SolidColorBrush[10000];\r
-                       linePool = new System.Windows.Shapes.Line[10000];\r
-                       rectPool = new System.Windows.Shapes.Rectangle[10000];\r
-                       ellipsePool = new System.Windows.Shapes.Ellipse[10000];\r
-                       for (int i = 0; i < 10000; i++)\r
+                       UIElementPool = new System.Windows.Controls.Canvas[2000];\r
+                       pointPool = new System.Windows.Point[2000];\r
+                       brushPool = new SolidColorBrush[2000];\r
+                       linePool = new System.Windows.Shapes.Line[2000];\r
+                       rectPool = new System.Windows.Shapes.Rectangle[2000];\r
+                       dummyRectPool = new System.Windows.Shapes.Rectangle[2000];\r
+                       ellipsePool = new System.Windows.Shapes.Ellipse[2000];\r
+                       for (int i = 0; i < 2000; i++)\r
                        {\r
+                               UIElementPool[i] = new System.Windows.Controls.Canvas();\r
                                pointPool[i] = new System.Windows.Point();\r
                                brushPool[i] = new SolidColorBrush();\r
                                linePool[i] = new System.Windows.Shapes.Line();\r
                                rectPool[i] = new System.Windows.Shapes.Rectangle();\r
+                               dummyRectPool[i] = new System.Windows.Shapes.Rectangle();\r
                                ellipsePool[i] = new System.Windows.Shapes.Ellipse();\r
                        }\r
                        polygonPool = new System.Windows.Shapes.Polygon[1000];\r
@@ -243,9 +259,11 @@ namespace Psychlops
                                lettersPool[i] = new System.Windows.Controls.TextBlock();\r
                        }\r
                        imagePool = new System.Windows.Controls.Image[100];\r
+                       groupPool = new System.Windows.Controls.Canvas[100];\r
                        for (int i = 0; i < 100; i++)\r
                        {\r
                                imagePool[i] = new System.Windows.Controls.Image();\r
+                               groupPool[i] = new System.Windows.Controls.Canvas();\r
                        }\r
 \r
                        masterPool = new System.Windows.Controls.Canvas();\r
@@ -253,12 +271,11 @@ namespace Psychlops
                        api_canvas.Children.Add(masterPool);\r
                        //api_canvas.Children.Remove(Internal.Main.widgetStack);\r
 \r
-                       /*\r
-                       for (int i = 0; i < 10000; i++)\r
+                       for (int i = 0; i < 2000; i++)\r
                        {\r
                                masterPool.Children.Add(UIElementPool[i]);\r
+                               UIElementPool[i].Children.Add(dummyRectPool[i]);\r
                        }\r
-                        * */\r
 \r
 \r
                        AsyncInitBool = true;\r
@@ -305,13 +322,9 @@ namespace Psychlops
                int nextIntervalFrame = 1, chacked = 0;\r
                public void flip(int n)\r
                {\r
-                       flip();\r
-               }\r
-               public void flip()\r
-               {\r
                        lock (this)\r
                        {\r
-                               nextIntervalFrame = 1;\r
+                               nextIntervalFrame = n;\r
                                chacked = 1;\r
                        }\r
                        //pointStackN = 0;\r
@@ -322,7 +335,9 @@ namespace Psychlops
                        ellipseStackN = 0;\r
                        lettersStackN = 0;\r
                        imageStackN = 0;\r
+                       groupStackN = 0;\r
 \r
+                       /*\r
                        pointPoolN = 0;\r
                        brushPoolN = 0;\r
                        linePoolN = 0;\r
@@ -331,10 +346,167 @@ namespace Psychlops
                        polygonPoolN = 0;\r
                        lettersPoolN = 0;\r
                        imagePoolN = 0;\r
+                       groupPoolN = 0;\r
+                        * */\r
 \r
+                       //executeFlip();\r
                        Internal.Main.canvas_flag.WaitOne();\r
                }\r
+               public void flip()\r
+               {\r
+                       flip(1);\r
+               }\r
+\r
+\r
+               #region version modifyNative2\r
+               public void executeFlip()\r
+               {\r
+                       Clock after = new Clock();\r
+                       after.update();\r
+                       AppState.statusBar = ((after - before).at_msec().ToString()) + " msec";\r
+\r
+                       Line lineS;\r
+                       Rectangle rectS;\r
+                       Ellipse ellipseS;\r
+                       Polygon polygonS;\r
+                       Letters lettersS;\r
+                       Image imageS;\r
+                       Group groupS;\r
+                       System.Windows.Shapes.Line lineP;\r
+                       System.Windows.Shapes.Rectangle rectP;\r
+                       System.Windows.Shapes.Ellipse ellipseP;\r
+                       System.Windows.Shapes.Polygon polygonP;\r
+                       System.Windows.Controls.TextBlock lettersP;\r
+                       System.Windows.Controls.Image imageP;\r
+                       System.Windows.Controls.Canvas groupP;\r
+\r
+                       lock (this)\r
+                       {\r
+                               nextIntervalFrame--;\r
+                       }\r
+\r
+\r
+\r
+                       var en = masterPool.Children.GetEnumerator();\r
+                       bool full = en.MoveNext();\r
+                       var cnv = en.Current as System.Windows.Controls.Canvas;\r
+                       if (nextIntervalFrame <= 0)\r
+                       {\r
+                               if (chacked > 0)\r
+                               {\r
+                                       if (stackN > 0)\r
+                                       {\r
+                                               for (int i = 0; i < stackN - 2; i++)\r
+                                               {\r
+                                                       if (full == false)\r
+                                                       {\r
+                                                               break;\r
+                                                       }\r
+                                                       else\r
+                                                       {\r
+                                                               if( null != (rectS = stack[i] as Rectangle) )\r
+                                                               {\r
+                                                                       if (null != (rectP = cnv.Children[0] as System.Windows.Shapes.Rectangle))\r
+                                                                       {\r
+                                                                               rectS.modifyNative(rectP, this);\r
+                                                                       }\r
+                                                                       else\r
+                                                                       {\r
+                                                                               cnv.Children.Clear();\r
+                                                                               cnv.Children.Add(stack[i].poolNative(this));\r
+                                                                       }\r
+                                                               }\r
+                                                               else if (null != (lineS = stack[i] as Line))\r
+                                                               {\r
+                                                                       if (null != (lineP = cnv.Children[0] as System.Windows.Shapes.Line))\r
+                                                                       {\r
+                                                                               lineS.modifyNative(lineP, this);\r
+                                                                       }\r
+                                                                       else\r
+                                                                       {\r
+                                                                               cnv.Children.Clear();\r
+                                                                               cnv.Children.Add(stack[i].poolNative(this));\r
+                                                                       }\r
+                                                               }\r
+                                                               else if (null != (ellipseS = stack[i] as Ellipse))\r
+                                                               {\r
+                                                                       if (null != (ellipseP = cnv.Children[0] as System.Windows.Shapes.Ellipse))\r
+                                                                       {\r
+                                                                               ellipseS.modifyNative(ellipseP, this);\r
+                                                                       }\r
+                                                                       else\r
+                                                                       {\r
+                                                                               cnv.Children.Clear();\r
+                                                                               cnv.Children.Add(stack[i].poolNative(this));\r
+                                                                       }\r
+                                                               }\r
+                                                               else if (null != (polygonS = stack[i] as Polygon))\r
+                                                               {\r
+                                                                       if (null != (polygonP = cnv.Children[0] as System.Windows.Shapes.Polygon))\r
+                                                                       {\r
+                                                                               polygonS.modifyNative(polygonP, this);\r
+                                                                       }\r
+                                                                       else\r
+                                                                       {\r
+                                                                               cnv.Children.Clear();\r
+                                                                               cnv.Children.Add(stack[i].poolNative(this));\r
+                                                                       }\r
+                                                               }\r
+                                                               else if (null != (lettersS = stack[i] as Letters))\r
+                                                               {\r
+                                                                       if (null != (lettersP = cnv.Children[0] as System.Windows.Controls.TextBlock))\r
+                                                                       {\r
+                                                                               lettersS.modifyNative(lettersP, this);\r
+                                                                       }\r
+                                                                       else\r
+                                                                       {\r
+                                                                               cnv.Children.Clear();\r
+                                                                               cnv.Children.Add(stack[i].poolNative(this));\r
+                                                                       }\r
+                                                               }\r
+                                                               else if (null != (imageS = stack[i] as Image))\r
+                                                               {\r
+                                                                       if (null != (imageP = cnv.Children[0] as System.Windows.Controls.Image))\r
+                                                                       {\r
+                                                                               imageS.modifyNative(imageP, this);\r
+                                                                       }\r
+                                                                       else\r
+                                                                       {\r
+                                                                               cnv.Children.Clear();\r
+                                                                               cnv.Children.Add(stack[i].poolNative(this));\r
+                                                                       }\r
+                                                               }\r
+                                                               else if (null != (groupS = stack[i] as Group))\r
+                                                               {\r
+                                                                       if (null != (groupP = cnv.Children[0] as System.Windows.Controls.Canvas))\r
+                                                                       {\r
+                                                                               groupS.modifyNative(groupP, this);\r
+                                                                       }\r
+                                                                       else\r
+                                                                       {\r
+                                                                               cnv.Children.Clear();\r
+                                                                               cnv.Children.Add(stack[i].poolNative(this));\r
+                                                                       }\r
+                                                               }\r
+                                                               full = en.MoveNext();\r
+                                                               cnv = en.Current as System.Windows.Controls.Canvas;\r
+                                                       }\r
+                                               }\r
+                                               stackN = 0;\r
+                                       }\r
+                                       lock (this)\r
+                                       {\r
+                                               chacked = 0;\r
+                                       }\r
+                                       Psychlops.Internal.Main.canvas_flag.Set();\r
+                               }\r
+                       }\r
+                       System.Threading.Thread.Sleep(0);\r
+               }\r
+               #endregion\r
+\r
                #region version modifyNative\r
+               /*\r
                public void executeFlip()\r
                {\r
                        Line lineS;\r
@@ -343,12 +515,14 @@ namespace Psychlops
                        Polygon polygonS;\r
                        Letters lettersS;\r
                        Image imageS;\r
+                       Group groupS;\r
                        System.Windows.Shapes.Line lineP;\r
                        System.Windows.Shapes.Rectangle rectP;\r
                        System.Windows.Shapes.Ellipse ellipseP;\r
                        System.Windows.Shapes.Polygon polygonP;\r
                        System.Windows.Controls.TextBlock lettersP;\r
                        System.Windows.Controls.Image imageP;\r
+                       System.Windows.Controls.Canvas groupP;\r
 \r
                        lock (this)\r
                        {\r
@@ -392,6 +566,10 @@ namespace Psychlops
                                                                        {\r
                                                                                ellipseS.modifyNative(ellipseP, this);\r
                                                                        }\r
+                                                                       else\r
+                                                                       {\r
+                                                                               masterPool.Children.Add(stack[i].poolNative(this));\r
+                                                                       }\r
                                                                }\r
                                                                else if (null != (polygonS = stack[i] as Polygon))\r
                                                                {\r
@@ -414,6 +592,13 @@ namespace Psychlops
                                                                                imageS.modifyNative(imageP, this);\r
                                                                        }\r
                                                                }\r
+                                                               else if (null != (groupS = stack[i] as Group))\r
+                                                               {\r
+                                                                       if (null != (groupP = en.Current as System.Windows.Controls.Canvas))\r
+                                                                       {\r
+                                                                               groupS.modifyNative(groupP, this);\r
+                                                                       }\r
+                                                               }\r
                                                                full = en.MoveNext();\r
                                                        }\r
                                                }\r
@@ -428,10 +613,11 @@ namespace Psychlops
                        }\r
                        System.Threading.Thread.Sleep(0);\r
                }\r
+                * */\r
                #endregion\r
 \r
-               /*\r
                #region version poolNative 2\r
+               /*\r
                public void executeFlip()\r
                {\r
 \r
@@ -471,8 +657,8 @@ namespace Psychlops
                        }\r
                        System.Threading.Thread.Sleep(0);\r
                }\r
-               #endregion\r
                */\r
+               #endregion\r
 \r
 \r
                #region Properties\r
@@ -936,7 +1122,7 @@ namespace Psychlops
                        System.Windows.Controls.Canvas.SetTop(tmp, datum.y);\r
                        tmp.Visibility = Visibility.Visible;\r
                        d.imagePoolN++;\r
-                       return this;\r
+                       return tmp;\r
                }\r
                public void modifyNative(System.Windows.Controls.Image tmp, Canvas d)\r
                {\r
@@ -958,59 +1144,75 @@ namespace Psychlops
                internal void create__()\r
                {\r
                        cnvs = new System.Windows.Controls.Canvas();\r
+                       trans = new System.Windows.Media.TransformGroup();\r
+                       transF = new System.Windows.Media.TransformCollection();\r
+                       rotateF = new System.Windows.Media.RotateTransform();\r
+                       scaleF = new System.Windows.Media.ScaleTransform();\r
+                       translateF = new System.Windows.Media.TranslateTransform();\r
+                       transF.Add(rotateF);\r
+                       transF.Add(scaleF);\r
+                       transF.Add(translateF);\r
+                       trans.Children = transF;\r
+                       cnvs.RenderTransform = trans;\r
                        AsyncBool = true;\r
                }\r
-               delegate void AppendFunc1(System.Func<Internal.PrimitiveFigure> func);\r
-               public void append__(Internal.PrimitiveFigure fig)\r
+               public Group clone()\r
                {\r
-                       cnvs.Children.Add(fig.toNative());\r
+                       return (Group)MemberwiseClone();\r
                }\r
 \r
-               public Group clone()\r
+               delegate void AppendFunc1(Internal.PrimitiveFigure func);\r
+               void append__(Internal.PrimitiveFigure fig)\r
                {\r
-                       return (Group)MemberwiseClone();\r
+                       fig.centering(0, 0);\r
+                       UIElement e = fig.toNative();\r
+                       cnvs.Children.Add(e);\r
+                       System.Windows.Controls.Canvas.SetLeft(e, fig.datum.x);\r
+                       System.Windows.Controls.Canvas.SetTop(e, fig.datum.y);\r
                }\r
+               delegate void SimpleProcedure();\r
+               void getRotation__() { rotation_ = rotateF.Angle; }\r
+               void setRotation__() { rotateF.Angle = rotation_; }\r
+               //void getTranslation__() { rotation_ = rotateF.Angle; }\r
+               void setTranslation__() { translateF.X = datum.x; translateF.Y = datum.y; }\r
+               void setScaling__() { scaleF.ScaleX = scaling_.x; scaleF.ScaleY = scaling_.y; }\r
 \r
                public static implicit operator System.Windows.Controls.Canvas(Group d)\r
                {\r
-                       var tmp = new System.Windows.Controls.Canvas();\r
-/*                     foreach (var item in list)\r
-                       {\r
-                               tmp.Children.Add(d.);\r
-                       }\r
-                       System.Windows.Controls.Canvas.SetLeft(tmp, d.datum.x);\r
-                       System.Windows.Controls.Canvas.SetTop(tmp, d.datum.y);\r
-*/                     return tmp;\r
+                       var tmp = d.cnvs;//new System.Windows.Controls.Canvas();\r
+                       System.Windows.Controls.Canvas.SetLeft(d.cnvs, d.datum.x);\r
+                       System.Windows.Controls.Canvas.SetTop(d.cnvs, d.datum.y);\r
+                       return tmp;\r
                }\r
                public UIElement toNative() { return this; }\r
 \r
                public void copyToStack(Templates.StackableDrawable d)\r
                {\r
-/*                     var tmp = d.imageStack[d.imageStackN];\r
+                       var tmp = d.groupStack[d.groupStackN];\r
                        tmp.datum = datum;\r
-                       tmp.buffer = buffer;\r
-                       tmp.self_rect = self_rect;\r
+                       tmp.cnvs = cnvs;\r
                        d.stack[d.stackN] = tmp;\r
-                       d.imageStackN++;\r
+                       d.groupStackN++;\r
                        d.stackN++;\r
-*/             }\r
+               }\r
                public UIElement poolNative(Canvas d)\r
                {\r
-/*                     var tmp = d.imagePool[d.imagePoolN];\r
-                       tmp.Source = buffer;\r
+                       //d.groupPool[d.groupPoolN] = cnvs;\r
+                       //var tmp = d.groupPool[d.groupPoolN];\r
+                       var tmp = cnvs;\r
                        System.Windows.Controls.Canvas.SetLeft(tmp, datum.x);\r
                        System.Windows.Controls.Canvas.SetTop(tmp, datum.y);\r
                        tmp.Visibility = Visibility.Visible;\r
-                       d.imagePoolN++;\r
-*/                     return this;\r
+                       //d.groupPoolN++;\r
+                       return tmp;\r
                }\r
                public void modifyNative(System.Windows.Controls.Canvas tmp, Canvas d)\r
                {\r
-/*                     tmp.Source = buffer;\r
-                       System.Windows.Controls.Canvas.SetLeft(tmp, datum.x);\r
-                       System.Windows.Controls.Canvas.SetTop(tmp, datum.y);\r
+                       d.groupPool[d.groupPoolN] = cnvs;\r
+                       System.Windows.Controls.Canvas.SetLeft(cnvs, datum.x);\r
+                       System.Windows.Controls.Canvas.SetTop(cnvs, datum.y);\r
                        tmp.Visibility = Visibility.Visible;\r
-*/             }\r
+               }\r
 \r
        }\r
        \r
index b899cae..db366c1 100644 (file)
@@ -147,23 +147,50 @@ namespace Psychlops
        {\r
                System.Collections.Generic.List<Figure> list;\r
                System.Windows.Controls.Canvas cnvs;\r
-               AppendFunc1 append_;\r
+               System.Windows.Media.TransformGroup trans;\r
+               System.Windows.Media.TransformCollection transF;\r
+               System.Windows.Media.RotateTransform rotateF;\r
+               SimpleProcedure setRotation_;\r
+               System.Windows.Media.ScaleTransform scaleF;\r
+               SimpleProcedure setScaling_;\r
+               System.Windows.Media.TranslateTransform translateF;\r
+\r
                bool AsyncBool;\r
-               public double rotation;\r
-               Point axis, scaling;\r
+               double rotation_;\r
+               public double rotation\r
+               {\r
+                       get { return rotation_; }\r
+                       set { rotation_ = value; rotateF.Dispatcher.BeginInvoke(setRotation_); }\r
+               }               \r
+               public Point axis\r
+               {\r
+                       get;\r
+                       set;\r
+               }\r
+               Point scaling_;\r
+               public Point scaling\r
+               {\r
+                       get { return scaling_; }\r
+                       set { scaling_ = value; scaleF.Dispatcher.BeginInvoke(setScaling_); }\r
+               }\r
+\r
+               AppendFunc1 append_;\r
 \r
                public Group()\r
                {\r
+                       setRotation_ = new SimpleProcedure(setRotation__);\r
+                       setScaling_ = new SimpleProcedure(setScaling__);\r
                        append_ = new AppendFunc1(append__);\r
                        list = new System.Collections.Generic.List<Figure>();\r
                        AsyncBool = false;\r
                        initialize__();\r
                        while (!AsyncBool) { }\r
                }\r
+\r
                public Group append(Internal.PrimitiveFigure fig)\r
                {\r
                        list.Add(fig);\r
-                       append_(fig);\r
+                       cnvs.Dispatcher.BeginInvoke(append_, fig);\r
                        return this;\r
                }\r
 \r
index a53999f..685c460 100644 (file)
@@ -23,6 +23,7 @@ namespace PsychlopsSilverlight4test
                        System.Windows.Application.Current.Host.Settings.MaxFrameRate = 60;\r
                        System.Windows.Application.Current.Host.Settings.EnableFrameRateCounter = true;\r
                        System.Windows.Application.Current.Host.Settings.EnableCacheVisualization = false;\r
+                       //System.Windows.Application.Current.Host.Settings.EnableGPUAcceleration = false;\r
                        //<param name="enableGPUAcceleration" value="true"/>\r
                        System.Windows.Media.CompositionTarget.Rendering += new System.EventHandler(CompositionTarget_Rendering);\r
                        //main_routine =  new System.ComponentModel.BackgroundWorker();\r
index d33eb14..e7b6754 100644 (file)
@@ -1,4 +1,4 @@
-using Psychlops;\r
+/*using Psychlops;\r
 \r
 namespace PsychlopsSilverlight4test\r
 {\r
@@ -108,9 +108,9 @@ namespace PsychlopsSilverlight4test
        }\r
 \r
 }\r
+*/\r
 \r
-/*\r
-using Psychlops;\r
+/*using Psychlops;\r
 \r
 namespace PsychlopsSilverlight4test\r
 {\r
@@ -159,7 +159,7 @@ namespace PsychlopsSilverlight4test
 */\r
 \r
 \r
-/*\r
+\r
 using Psychlops;\r
 \r
 namespace Psychlops\r
@@ -195,19 +195,24 @@ namespace PsychlopsSilverlight4test
        {\r
                Canvas cnvs;\r
                Image img;\r
-               Rectangle fixation;\r
+               Ellipse fixation;\r
                Shape shape;\r
                Color col;\r
                int isize = 100;\r
                double tfreq = 1;\r
                int frames;\r
                RandomDots dots;\r
+               Group g;\r
 \r
                public void psychlops_main()\r
                {\r
                        cnvs = new Canvas(500, 500);\r
+                       g = new Group();\r
                        img = new Image(isize * 2, isize * 2);\r
-                       fixation = new Rectangle(10, 10);\r
+                       Figures.drawGrating(ref img, 200, 200, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60);\r
+                       g.append(img);\r
+                       g.rotation = 50;\r
+                       fixation = new Ellipse(10, 10);\r
                        fixation.fill = Color.red;\r
                        //var poly = new Rectangle(100, 100);\r
                        var poly = new Letters("日本語");\r
@@ -228,17 +233,26 @@ namespace PsychlopsSilverlight4test
                        {\r
                                frames++;\r
 \r
+\r
                                cnvs.clear(new Color(Mouse.left.pressed() ? 0.75 : 0.5));\r
                                col.set(Math.random(1.0));\r
 \r
+                               /*if (frames % 2 == 0)\r
+                               {\r
+                                       fixation.centering().shift(100, 100);\r
+                                       fixation.draw(new Stroke(Color.blue, 3));\r
+                               }*/\r
+\r
                                fixation.centering();\r
                                fixation.draw(Color.red);\r
 \r
                                //Figures.drawGabor(ref img, 20, 100, 1, 0, frames * 2.0 * Math.PI / tfreq / 60);\r
                                //Figures.drawGaussian(ref img, 20, 1);\r
-                               Figures.drawGrating(ref img, 200, 200, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60);\r
+                               //Figures.drawGrating(ref img, 200, 200, 20, 1, 2, frames * 2.0 * Math.PI / tfreq / 60);\r
                                img.centering(Mouse.position);\r
                                img.draw();\r
+                               //g.centering(Mouse.position).draw();\r
+                               //g.rotation += 1;\r
 \r
                                shape.centering(Mouse.position).shift(100, 0);\r
                                shape.draw();\r
@@ -247,8 +261,11 @@ namespace PsychlopsSilverlight4test
                                cnvs.var(frames, 0, 20);\r
                                slider.value = frames / 100.0;\r
 \r
-                               fixation.shift(100, 100);\r
-                               fixation.draw(new Stroke(Color.blue, 3));\r
+                               /*if (frames % 2 != 0)\r
+                               {\r
+                                       fixation.shift(100, 100);\r
+                                       fixation.draw(new Stroke(Color.green, 3));\r
+                               }*/\r
 \r
                                for (int i = 0; i < dots.cood.Length; i++)\r
                                {\r
@@ -260,6 +277,5 @@ namespace PsychlopsSilverlight4test
                        }\r
                }\r
        }\r
-\r
 }\r
-*/\r
+\r