Use bed theme colors
This commit is contained in:
parent
d9ffa62372
commit
3e7adc6b8b
2 changed files with 27 additions and 22 deletions
|
|
@ -47,12 +47,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
private ThemeConfig theme;
|
||||
private Color opaqueMinimumAccent;
|
||||
private Color opaqueAccent;
|
||||
private Color bedText;
|
||||
private Color circleText;
|
||||
private Color lightText;
|
||||
private Color bedTextColor;
|
||||
private Color bedCircleColor;
|
||||
private Color simpleBedCircleColor;
|
||||
private RectangleDouble bedBounds;
|
||||
|
||||
private bool circularBed;
|
||||
private Color extraLightColor;
|
||||
private Color lightColor;
|
||||
private double scalingFactor;
|
||||
private LevelingFunctions currentLevelingFunctions = null;
|
||||
|
|
@ -63,13 +65,17 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
this.printer = printer;
|
||||
this.VAnchor = VAnchor.Absolute;
|
||||
this.theme = theme;
|
||||
this.BackgroundColor = theme.BedBackgroundColor;
|
||||
|
||||
extraLightColor = theme.BackgroundColor.Blend(theme.TextColor, 0.1);
|
||||
lightColor = theme.BackgroundColor.Blend(theme.TextColor, 0.2);
|
||||
opaqueMinimumAccent = theme.ResolveColor(theme.BackgroundColor, theme.AccentMimimalOverlay);
|
||||
opaqueAccent = theme.ResolveColor(theme.BackgroundColor, theme.AccentMimimalOverlay.WithAlpha(140));
|
||||
bedText = theme.TextColor;
|
||||
lightText = bedText.WithAlpha(100);
|
||||
|
||||
circleText = theme.TextColor;
|
||||
lightText = circleText.WithAlpha(100);
|
||||
|
||||
bedTextColor = theme.PrinterBedTextColor;
|
||||
bedCircleColor = theme.ResolveColor(theme.BedColor, bedTextColor.WithAlpha(50));
|
||||
simpleBedCircleColor = theme.ResolveColor(theme.BedColor, bedTextColor.WithAlpha(180));
|
||||
|
||||
bedBounds = printer.Settings.BedBounds;
|
||||
circularBed = printer.Settings.GetValue<BedShape>(SettingsKey.bed_shape) == BedShape.Circular;
|
||||
|
|
@ -100,7 +106,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
var inverseScale = 1 / scalingFactor;
|
||||
|
||||
var offset = Vector2.Zero;
|
||||
|
||||
// Reset to zero
|
||||
|
|
@ -165,26 +170,26 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
var center = new Vector2(position.X, position.Y);
|
||||
|
||||
var circleColor = lightColor;
|
||||
var textColor = lightText;
|
||||
var circleColor = bedCircleColor;
|
||||
|
||||
if (this.SimplePoints)
|
||||
{
|
||||
graphics2D.Render(
|
||||
new Ellipse(center, 4 * inverseScale),
|
||||
opaqueMinimumAccent);
|
||||
simpleBedCircleColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i < this.ActiveProbeIndex)
|
||||
{
|
||||
circleColor = opaqueMinimumAccent;
|
||||
textColor = bedText;
|
||||
textColor = circleText;
|
||||
}
|
||||
else if (i == this.ActiveProbeIndex)
|
||||
{
|
||||
circleColor = opaqueAccent;
|
||||
textColor = bedText;
|
||||
textColor = circleText;
|
||||
}
|
||||
|
||||
if (i >= this.ActiveProbeIndex)
|
||||
|
|
@ -192,7 +197,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
graphics2D.Circle(
|
||||
center,
|
||||
9 * inverseScale,
|
||||
i == this.ActiveProbeIndex ? bedText : lightText);
|
||||
i == this.ActiveProbeIndex ? circleText : lightText);
|
||||
|
||||
graphics2D.Circle(
|
||||
center,
|
||||
|
|
@ -238,11 +243,13 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
// Render total path before probe points
|
||||
graphics2D.Render(
|
||||
new Stroke(path),
|
||||
theme.AccentMimimalOverlay);
|
||||
opaqueMinimumAccent);
|
||||
}
|
||||
|
||||
private void RenderBed(Graphics2D graphics2D)
|
||||
{
|
||||
var lineColor = theme.BedGridColors.Line;
|
||||
|
||||
if (circularBed)
|
||||
{
|
||||
var radius = bedBounds.Width / 2;
|
||||
|
|
@ -251,23 +258,21 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
var steps = radius / lineCount;
|
||||
|
||||
var bedShape = new Ellipse(Vector2.Zero, radius);
|
||||
graphics2D.Render(bedShape, theme.SlightShade);
|
||||
graphics2D.Render(bedShape, theme.BedColor);
|
||||
graphics2D.Render(new Stroke(bedShape), lightColor);
|
||||
|
||||
var moreAlpha = extraLightColor.WithAlpha(150);
|
||||
|
||||
for (var i = 0; i < lineCount; i++)
|
||||
{
|
||||
graphics2D.Render(
|
||||
new Stroke(
|
||||
new Ellipse(Vector2.Zero, radius - (i * steps))),
|
||||
moreAlpha);
|
||||
lineColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics2D.FillRectangle(bedBounds, theme.SlightShade);
|
||||
graphics2D.Rectangle(bedBounds, lightColor);
|
||||
graphics2D.FillRectangle(bedBounds, theme.BedColor);
|
||||
graphics2D.Rectangle(bedBounds, lineColor);
|
||||
|
||||
var x = bedBounds.Left;
|
||||
var y = bedBounds.Bottom;
|
||||
|
|
@ -276,14 +281,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
for (var j = 1; j < steps; j++)
|
||||
{
|
||||
var step = j * 20;
|
||||
graphics2D.Line(x + step, y, x + step, y + bedBounds.Height, extraLightColor); // X
|
||||
graphics2D.Line(x + step, y, x + step, y + bedBounds.Height, lineColor); // X
|
||||
}
|
||||
|
||||
steps = bedBounds.Height / 20;
|
||||
for (var j = 1; j < steps; j++)
|
||||
{
|
||||
var step = j * 20;
|
||||
graphics2D.Line(x, y + step, x + bedBounds.Width, y + step, extraLightColor); // Y
|
||||
graphics2D.Line(x, y + step, x + bedBounds.Width, y + step, lineColor); // Y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue