Use static ants border instead of blinking border for non active regions

This commit is contained in:
Jaex 2017-04-28 07:23:20 +03:00
parent a819b2cdd9
commit c58b96e088

View file

@ -83,13 +83,12 @@ public Color CurrentColor
private TextureBrush backgroundBrush, backgroundHighlightBrush; private TextureBrush backgroundBrush, backgroundHighlightBrush;
private GraphicsPath regionFillPath, regionDrawPath; private GraphicsPath regionFillPath, regionDrawPath;
private Pen borderPen, borderDotPen, textOuterBorderPen, textInnerBorderPen, markerPen; private Pen borderPen, borderDotPen, borderDotStaticPen, textOuterBorderPen, textInnerBorderPen, markerPen;
private Brush nodeBackgroundBrush, textBackgroundBrush; private Brush nodeBackgroundBrush, textBackgroundBrush;
private Font infoFont, infoFontMedium, infoFontBig; private Font infoFont, infoFontMedium, infoFontBig;
private Stopwatch timerStart, timerFPS; private Stopwatch timerStart, timerFPS;
private int frameCount; private int frameCount;
private bool pause, isKeyAllowed; private bool pause, isKeyAllowed;
private ColorBlinkAnimation borderColorAnimation;
private RectangleAnimation regionAnimation; private RectangleAnimation regionAnimation;
private Bitmap bmpBackgroundImage; private Bitmap bmpBackgroundImage;
@ -107,13 +106,6 @@ public RegionCaptureForm(RegionCaptureMode mode)
DrawableObjects = new List<DrawableObject>(); DrawableObjects = new List<DrawableObject>();
timerStart = new Stopwatch(); timerStart = new Stopwatch();
timerFPS = new Stopwatch(); timerFPS = new Stopwatch();
borderColorAnimation = new ColorBlinkAnimation()
{
FromColor = Color.FromArgb(30, 30, 30),
ToColor = Color.FromArgb(100, 100, 100),
Duration = TimeSpan.FromMilliseconds(1500)
};
borderColorAnimation.Start();
regionAnimation = new RectangleAnimation() regionAnimation = new RectangleAnimation()
{ {
Duration = TimeSpan.FromMilliseconds(250) Duration = TimeSpan.FromMilliseconds(250)
@ -121,6 +113,7 @@ public RegionCaptureForm(RegionCaptureMode mode)
borderPen = new Pen(Color.Black); borderPen = new Pen(Color.Black);
borderDotPen = new Pen(Color.White) { DashPattern = new float[] { 5, 5 } }; borderDotPen = new Pen(Color.White) { DashPattern = new float[] { 5, 5 } };
borderDotStaticPen = new Pen(Color.White) { DashPattern = new float[] { 5, 5 } };
nodeBackgroundBrush = new SolidBrush(Color.White); nodeBackgroundBrush = new SolidBrush(Color.White);
infoFont = new Font("Verdana", 9); infoFont = new Font("Verdana", 9);
infoFontMedium = new Font("Verdana", 12); infoFontMedium = new Font("Verdana", 12);
@ -474,13 +467,8 @@ private void Draw(Graphics g)
} }
} }
// Blink borders of all regions slightly to make non active regions to be visible in both dark and light backgrounds g.DrawPath(borderPen, regionDrawPath);
borderColorAnimation.Update(); g.DrawPath(borderDotStaticPen, regionDrawPath);
using (Pen blinkBorderPen = new Pen(borderColorAnimation.CurrentColor))
{
g.DrawPath(blinkBorderPen, regionDrawPath);
}
} }
// Draw effect shapes // Draw effect shapes
@ -1195,6 +1183,7 @@ protected override void Dispose(bool disposing)
if (backgroundHighlightBrush != null) backgroundHighlightBrush.Dispose(); if (backgroundHighlightBrush != null) backgroundHighlightBrush.Dispose();
if (borderPen != null) borderPen.Dispose(); if (borderPen != null) borderPen.Dispose();
if (borderDotPen != null) borderDotPen.Dispose(); if (borderDotPen != null) borderDotPen.Dispose();
if (borderDotStaticPen != null) borderDotStaticPen.Dispose();
if (nodeBackgroundBrush != null) nodeBackgroundBrush.Dispose(); if (nodeBackgroundBrush != null) nodeBackgroundBrush.Dispose();
if (infoFont != null) infoFont.Dispose(); if (infoFont != null) infoFont.Dispose();
if (infoFontMedium != null) infoFontMedium.Dispose(); if (infoFontMedium != null) infoFontMedium.Dispose();