public void Clip(IGradientMask mask, TContext context) { switch (mask) { case IEllipseMask ellipseMask: EllipsePainter.Clip(ellipseMask, context); break; case IRectangleMask rectangleMask: RectanglePainter.Clip(rectangleMask, context); break; case ITextMask textMask: TextPainter.Clip(textMask, context); break; case IPathMask pathMask: PathPainter.Clip(pathMask, context); break; case IMaskCollection maskCollection: ClipCollection(maskCollection, context); break; } }
public static void RenderEntrails(RenderContext context, RectanglePainter rectangle, RectangleSide side) { rectangle.BackgroundColor = Colors.Green; if (side == RectangleSide.Left) { double x1 = rectangle.Left + 4; double y1 = rectangle.Top + 4; double x2 = rectangle.Right - 4; double y2 = rectangle.Top + rectangle.Height / 2; double x3 = x1; double y3 = rectangle.BottomRight.Y - 4; context.DrawFillTriangle(x2, y2, x1, y1, x3, y3, Colors.Orange); context.DrawLine(x1, y1, x2, y2, Colors.Black); context.DrawLine(x3, y3, x2, y2, Colors.Black); context.DrawLine(x3, y3, x1, y1, Colors.Black); } else if (side == RectangleSide.Right) { double x1 = rectangle.Right - 4; double y1 = rectangle.Top + 4; double x2 = rectangle.Left + 4; double y2 = rectangle.Top + rectangle.Height / 2; double x3 = x1; double y3 = rectangle.BottomRight.Y - 4; context.DrawFillTriangle(x2, y2, x1, y1, x3, y3, Colors.Orange); context.DrawLine(x1, y1, x2, y2, Colors.Black); context.DrawLine(x3, y3, x2, y2, Colors.Black); context.DrawLine(x3, y3, x1, y1, Colors.Black); } else if (side == RectangleSide.Top) { double x1 = rectangle.Left + 4; double y1 = rectangle.Top + 4; double x2 = rectangle.Right - 4; double y2 = y1; double x3 = (x1 + x2) / 2.0; double y3 = rectangle.BottomRight.Y - 4; context.DrawFillTriangle(x2, y2, x1, y1, x3, y3, Colors.Orange); context.DrawLine(x1, y1, x2, y2, Colors.Black); context.DrawLine(x3, y3, x2, y2, Colors.Black); context.DrawLine(x3, y3, x1, y1, Colors.Black); } else if (side == RectangleSide.Bottom) { double x1 = rectangle.Left + 4; double y1 = rectangle.Bottom - 4; double x2 = rectangle.Right - 4; double y2 = y1; double x3 = (x1 + x2) / 2.0; double y3 = rectangle.Top + 4; context.DrawFillTriangle(x2, y2, x1, y1, x3, y3, Colors.Orange); context.DrawLine(x1, y1, x2, y2, Colors.Black); context.DrawLine(x3, y3, x2, y2, Colors.Black); context.DrawLine(x3, y3, x1, y1, Colors.Black); } }
public void TearDown() { if (TestContext.CurrentContext.Result.Outcome.Status != TestStatus.Failed) { return; } var path = Directory.GetCurrentDirectory() + $"\\{TestContext.CurrentContext.Test.Name}.bmp"; RectanglePainter.DrawRectanglesInFile(cloud.GetAllRectangles(), path); Console.WriteLine("Tag cloud visualization saved to file " + path); }
public void TearDown() { if (TestContext.CurrentContext.Result.Outcome != ResultState.Failure) { return; } var name = TestContext.CurrentContext.Test.MethodName; if (TestContext.CurrentContext.Test.MethodName != TestContext.CurrentContext.Test.Name) { name += $" {TestContext.CurrentContext.Test.Name}"; } var fullPath = Path.Combine(failTestsImagesPath, $"{name}.png"); var savingResult = RectanglePainter.TryDrawAndSaveToFile(layouter.GetRectangles(), Color.Red, fullPath); TestContext.Out.WriteLine(savingResult ? $"Tag cloud visualization saved to file {fullPath}" : "Error while saving file"); }
public static void RenderEntrails(RenderContext context, RectanglePainter rectangle, RectangleSide side) { if (side == RectangleSide.Right) { context.DrawEllipseCentered(rectangle.Left + 4, rectangle.Top + 4, rectangle.Right - 4, rectangle.Bottom - 4, Colors.Blue, 2); context.DrawFillRectangle((rectangle.Left + rectangle.Right) / 2, rectangle.Top + 1, rectangle.Right - 1, rectangle.Bottom - 1, Colors.White); } else if (side == RectangleSide.Left) { context.DrawEllipseCentered(rectangle.Left + 4, rectangle.Top + 4, rectangle.Right - 4, rectangle.Bottom - 4, Colors.Blue, 2); context.DrawFillRectangle(rectangle.Left + 1, rectangle.Bottom - 1, (rectangle.Left + rectangle.Right) / 2, rectangle.Top + 1, Colors.White); } else if (side == RectangleSide.Bottom) { context.DrawEllipseCentered(rectangle.Left + 4, rectangle.Top + 4, rectangle.Right - 4, rectangle.Bottom - 4, Colors.Blue, 2); context.DrawFillRectangle(rectangle.Left + 1, rectangle.Bottom - 1, rectangle.Right - 1, (rectangle.Top + rectangle.Bottom) / 2, Colors.White); } else if (side == RectangleSide.Top) { context.DrawEllipseCentered(rectangle.Left + 4, rectangle.Top + 4, rectangle.Right - 4, rectangle.Bottom - 4, Colors.Blue, 2); context.DrawFillRectangle(rectangle.Left + 1, rectangle.Top + 1, rectangle.Right - 1, (rectangle.Top + rectangle.Bottom) / 2, Colors.White); } }
public static void RenderEntrails(RenderContext context, RectanglePainter rectangle) { context.DrawFillRectangle(rectangle.TopLeft.X + 3, rectangle.TopLeft.Y + 3, rectangle.BottomRight.X - 3, rectangle.BottomRight.Y - 3, Colors.Red); context.DrawFillRectangle(rectangle.TopLeft.X + 4, rectangle.TopLeft.Y + 4, rectangle.BottomRight.X - 4, rectangle.BottomRight.Y - 4, Colors.Red); }
public static void RenderEntrails(RenderContext context, RectanglePainter rectangle) { context.DrawEllipseCentered(rectangle.TopLeft.X + 4, rectangle.TopLeft.Y + 4, rectangle.BottomRight.X - 4, rectangle.BottomRight.Y - 4, Colors.Red, 2); }