diff --git a/ApplicationView/ApplicationController.cs b/ApplicationView/ApplicationController.cs index f47d83285..a614d8255 100644 --- a/ApplicationView/ApplicationController.cs +++ b/ApplicationView/ApplicationController.cs @@ -56,6 +56,7 @@ namespace MatterHackers.MatterControl using Agg.Image; using CustomWidgets; using MatterHackers.Agg.Platform; + using MatterHackers.Agg.VertexSource; using MatterHackers.DataConverters3D; using MatterHackers.DataConverters3D.UndoCommands; using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling; @@ -595,6 +596,27 @@ namespace MatterHackers.MatterControl } + public ImageSequence GetProcessingSequence(Color color) + { + int size = (int)Math.Round(80 * GuiWidget.DeviceScale); + double radius = size / 8.0; + var workingAnimation = new ImageSequence(); + var frameCount = 30.0; + var strokeWidth = 4 * GuiWidget.DeviceScale; + for(int i=0; i < frameCount; i++) + { + var frame = new ImageBuffer(size, size); + var graphics = frame.NewGraphics2D(); + graphics.Render(new Stroke(new Arc(frame.Width / 2, frame.Height / 2, + size / 4 - strokeWidth / 2, size / 4 - strokeWidth / 2, + MathHelper.Tau / frameCount * i, + MathHelper.Tau / 4 + MathHelper.Tau / frameCount * i), strokeWidth), color); + workingAnimation.AddImage(frame); + } + + return workingAnimation; + } + static int applicationInstanceCount = 0; public static int ApplicationInstanceCount { @@ -1475,13 +1497,22 @@ namespace MatterHackers.MatterControl { try // if we get a bad result we can get a target invocation exception. In that case just don't show anything { - // scale the loaded image to the size of the target image - byte[] raw = e.Result; - Stream stream = new MemoryStream(raw); - ImageBuffer unScaledImage = new ImageBuffer(10, 10); - AggContext.StaticData.LoadImageSequenceData(stream, imageSequenceToLoadInto); + Task.Run(() => + { + // scale the loaded image to the size of the target image + byte[] raw = e.Result; + Stream stream = new MemoryStream(raw); - imageSequenceToLoadInto.Invalidate(); + var asyncImageSequence = new ImageSequence(); + + AggContext.StaticData.LoadImageSequenceData(stream, asyncImageSequence); + + UiThread.RunOnIdle(() => + { + imageSequenceToLoadInto.Copy(asyncImageSequence); + imageSequenceToLoadInto.Invalidate(); + }); + }); } catch { diff --git a/SetupWizard/DesignSpaceHelp.cs b/SetupWizard/DesignSpaceHelp.cs index d72cb5937..8b56682cc 100644 --- a/SetupWizard/DesignSpaceHelp.cs +++ b/SetupWizard/DesignSpaceHelp.cs @@ -349,7 +349,7 @@ namespace MatterHackers.MatterControl { var sequence = new ImageSequence() { - FramePerSecond = 3, + FramesPerSecond = 3, }; sequence.AddImage(new ImageBuffer(1, 1)); @@ -399,7 +399,7 @@ namespace MatterHackers.MatterControl { title.Text = guide.Title; description.Text = guide.Description; - imageSequenceWidget.ImageSequence = AggContext.StaticData.LoadSequence(Path.Combine("Icons", "provider_loading.gif")); + imageSequenceWidget.ImageSequence = ApplicationController.Instance.GetProcessingSequence(Color.Black); ApplicationController.Instance.DownloadToImageSequenceAsync(imageSequenceWidget.ImageSequence, guide.AnimationUri); }; diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index f19919b29..d3a38bc2b 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit f19919b29f82e37f788267f458fdcc5e08309642 +Subproject commit d3a38bc2b23964d7c30468a603ea28b230df4a4c