X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=dev4%2Fpsychlops%2Fcore%2Fgraphic%2Fcanvas.cs;h=5b58b031df218d887f167a1c38330e60a548d251;hb=c778254ba66748949fba1e807aec154cdf5dadf1;hp=be3cbae9566ffeeb6c3ee5d7a1109946b071199f;hpb=9f47dcd91507b95984913358b5b313f1e304a091;p=psychlops%2Fsilverlight.git diff --git a/dev4/psychlops/core/graphic/canvas.cs b/dev4/psychlops/core/graphic/canvas.cs index be3cbae..5b58b03 100644 --- a/dev4/psychlops/core/graphic/canvas.cs +++ b/dev4/psychlops/core/graphic/canvas.cs @@ -10,7 +10,7 @@ using System.Windows.Shapes; using System.Windows.Browser; using System.Collections.Generic; - + namespace Psychlops @@ -47,7 +47,6 @@ namespace Psychlops internal Group[] groupStack; internal int groupStackN = 0; - public StackableDrawable() { stack = new Internal.PrimitiveFigure[CONST.MAX_OBJ_N]; @@ -71,8 +70,8 @@ namespace Psychlops } for (int i = 0; i < CONST.HOBJ_N; i++) { - imageStack[i] = new Image(1, 1); - groupStack[i] = new Group(); + imageStack[i] = new Image(); +// groupStack[i] = new Group(); } } @@ -82,6 +81,7 @@ namespace Psychlops public virtual void line(Line drawee) { drawee.copyToStack(this); } public virtual void rect(Rectangle drawee) { drawee.copyToStack(this); } public virtual void ellipse(Ellipse drawee) { drawee.copyToStack(this); } + public virtual void oval(Ellipse drawee) { drawee.copyToStack(this); } public virtual void polygon(Polygon drawee) { drawee.copyToStack(this); } public virtual void letters(Letters drawee) { drawee.copyToStack(this); } public virtual void image(Image drawee) { drawee.copyToStack(this); } @@ -165,12 +165,15 @@ namespace Psychlops { before = new Clock(); before.update(); + var after = new Clock(); AsyncInitBool = false; width_ = wid; height_ = hei; api_canvas.Dispatcher.BeginInvoke(new TwoIntProcedure(initialize__), wid, hei); - while(!AsyncInitBool) + while (!AsyncInitBool) { + after.update(); + if ((after - before).at_msec() > 1000) break; } Mouse._prime = api_canvas; Main.drawable = this; @@ -179,7 +182,6 @@ namespace Psychlops back_panel = new Rectangle(wid, hei); flipexec = new SimpleProcedure(executeFlip); - AppState.statusBar = ""; } protected void initialize__(int wid, int hei) { @@ -195,7 +197,7 @@ namespace Psychlops HtmlElement htmlHost = HtmlPage.Document.GetElementById("silverlightControlHost"); //if (htmlHost != null) HtmlPage.Window.Alert("silverlightControlHost is null"); htmlHost.SetStyleAttribute("width", (wid).ToString()+"px"); - htmlHost.SetStyleAttribute("height", (20+hei).ToString() + "px"); + htmlHost.SetStyleAttribute("height", (hei).ToString() + "px"); htmlHost.SetStyleAttribute("margin", "2em auto auto auto"); pointPool = new System.Windows.Point[CONST.MOBJ_N]; @@ -237,7 +239,7 @@ namespace Psychlops Psychlops.Internal.Main.widgetStack.Orientation = Orientation.Vertical; Psychlops.Internal.Main.widgetStack.Height = hei; api_canvas.Children.Add(Psychlops.Internal.Main.widgetStack); - + Internal.Main.statusBar.Visibility = Visibility.Collapsed; UIElementPool = new System.Windows.Controls.Canvas[CONST.MAX_OBJ_N]; @@ -251,7 +253,6 @@ namespace Psychlops dummyRectPool[i].Visibility = Visibility.Collapsed; } - AsyncInitBool = true; } @@ -326,9 +327,9 @@ namespace Psychlops #region version modifyNative2 public void executeFlip() { - Clock after = new Clock(); - after.update(); - AppState.statusBar = ((after - before).at_msec().ToString()) + " msec"; +// Clock after = new Clock(); +// after.update(); +// AppState.statusBar = ((after - before).at_msec().ToString()) + " msec"; Line lineS; Rectangle rectS; @@ -466,6 +467,8 @@ namespace Psychlops } #endregion + + #region version modifyNative /* public void executeFlip() @@ -1116,16 +1119,16 @@ namespace Psychlops var bitmap = new BitmapImage(); bitmap.CreateOptions = BitmapCreateOptions.None; bitmap.UriSource = uri; - try - { + //try + //{ var wbm = new System.Windows.Media.Imaging.WriteableBitmap(bitmap); buffer = wbm; - } - catch (Exception e) - { - buffer = new WriteableBitmap(64, 64); - buffer.ForEach(bitmap_drawChecker); - } + //} + //catch (Exception e) + //{ + // buffer = new WriteableBitmap(64, 64); + // buffer.ForEach(bitmap_drawChecker); + //} self_rect.set(buffer.PixelWidth, buffer.PixelHeight); AsyncBool = true; }