protected override void Redraw(ImageManager imgManager) { if (!ValueManager.IsChanged(ID.Top) && !ValueManager.IsChanged(ID.Bot) && !ForceUpdate) { return; } ImageRenderer render = new ImageRenderer(imgManager.GetImageObject(DefaultImage, DeckType)); string top = ValueManager[ID.Top]; string bot = ValueManager[ID.Bot]; if (((top == KorrySettings.TopState && !KorrySettings.ShowTopNonZero) || (KorrySettings.ShowTopNonZero && ValueNonZero(top))) && !string.IsNullOrEmpty(KorrySettings.TopImage)) { render.DrawImage(imgManager.GetImageObject(KorrySettings.TopImage, DeckType), KorrySettings.GetRectangleTop()); } string testValue = bot; if (KorrySettings.UseOnlyTopAddr) { testValue = top; } if (((testValue == KorrySettings.BotState && !KorrySettings.ShowBotNonZero) || (KorrySettings.ShowBotNonZero && ValueNonZero(testValue))) && !string.IsNullOrEmpty(KorrySettings.BotImage)) { render.DrawImage(imgManager.GetImageObject(KorrySettings.BotImage, DeckType), KorrySettings.GetRectangleBot()); } DrawImage = render.RenderImage64(); IsRawImage = true; NeedRedraw = true; render.Dispose(); }
protected virtual void RenderImages(ImageManager imgManager) { if (TextSettings.DrawBox) { ImageRenderer render = new ImageRenderer(imgManager.GetImageObject(TextSettings.DefaultImage, DeckType)); render.DrawBox(ColorTranslator.FromHtml(TextSettings.BoxColor), ModelDisplayText.GetNumValue(TextSettings.BoxSize, 2), TextSettings.GetRectangleBox()); DefaultImageRender = render.RenderImage64(); render.Dispose(); render = new ImageRenderer(imgManager.GetImageObject(TextSettings.ErrorImage, DeckType)); render.DrawBox(ColorTranslator.FromHtml("#d70000"), ModelDisplayText.GetNumValue(TextSettings.BoxSize, 2), TextSettings.GetRectangleBox()); ErrorImageRender = render.RenderImage64(); render.Dispose(); } }
protected virtual void RenderDefaultImage(ImageManager imgManager) { ImageRenderer render = new ImageRenderer(imgManager.GetImageObject(KorrySettings.DefaultImage, DeckType)); if (!string.IsNullOrEmpty(KorrySettings.TopImage)) { render.DrawImage(imgManager.GetImageObject(KorrySettings.TopImage, DeckType), KorrySettings.GetRectangleTop()); } if (!string.IsNullOrEmpty(KorrySettings.BotImage)) { render.DrawImage(imgManager.GetImageObject(KorrySettings.BotImage, DeckType), KorrySettings.GetRectangleBot()); } DefaultImageRender = render.RenderImage64(); render.Dispose(); }
protected virtual void RenderDefaultImage(ImageManager imgManager) { ImageRenderer render = new ImageRenderer(imgManager.GetImageObject(GaugeSettings.DefaultImage, DeckType)); if (GaugeSettings.DrawArc) { render.DrawArc(GaugeSettings.GetArc(), ColorTranslator.FromHtml(GaugeSettings.GaugeColor)); } else { render.Rotate(GaugeSettings.BarOrientation, new PointF(0, 0)); render.DrawBar(ColorTranslator.FromHtml(GaugeSettings.GaugeColor), GaugeSettings.GetBar()); } DefaultImageRender = render.RenderImage64(); render.Dispose(); }
protected override void Redraw(ImageManager imgManager) { if (!ValueManager.IsChanged(ID.ControlState) && !ForceUpdate) { return; } //Stopwatch sw = new Stopwatch(); //sw.Start(); string value = ValueManager[ID.ControlState]; if (GaugeSettings.DecodeBCD) { value = ModelDisplay.ConvertFromBCD(value); } value = GaugeSettings.ScaleValue(value); ImageRenderer render = new ImageRenderer(imgManager.GetImageObject(GaugeSettings.DefaultImage, DeckType)); if (GaugeSettings.DrawArc) { DrawText(value, render); DrawArc(value, render); } else { DrawBar(value, render); DrawText(value, render); } DrawImage = render.RenderImage64(); render.Dispose(); IsRawImage = true; NeedRedraw = true; //sw.Stop(); //Log.Logger.Debug($"Time for Gauge-Frame: {sw.Elapsed.TotalMilliseconds}ms [{ActionID}]"); }
protected override void Redraw(ImageManager imgManager) { if (!ValueManager.IsChanged(ID.Active) && !ValueManager.IsChanged(ID.Standby) && !ForceUpdate && !wasPushed) { return; } string valueAct = ValueManager[ID.Active]; if (Settings.DecodeBCD) { valueAct = ModelDisplay.ConvertFromBCD(valueAct); } valueAct = Settings.ScaleValue(valueAct); valueAct = Settings.RoundValue(valueAct); valueAct = Settings.FormatValue(valueAct); string valueStb = ValueManager[ID.Standby]; if (Settings.DecodeBCD && !Settings.StbyHasDiffFormat || Settings.StbyHasDiffFormat && Settings.DecodeBCDStby) { valueStb = ModelDisplay.ConvertFromBCD(valueStb); } valueStb = ModelDisplay.ScaleValue(valueStb, Settings.StbyHasDiffFormat ? Settings.ScalarStby : Settings.Scalar); valueStb = ModelDisplay.RoundValue(valueStb, Settings.StbyHasDiffFormat ? Settings.FormatStby : Settings.Format); valueStb = ModelDisplay.FormatValue(valueStb, Settings.StbyHasDiffFormat ? Settings.FormatStby : Settings.Format); string background = Settings.DefaultImage; if (wasPushed) { ticksIndication++; if (ticksIndication < ticksActive) { background = Settings.IndicationImage; } else { wasPushed = false; ticksIndication = 0; } } if (lastText != valueAct + valueStb || ForceUpdate || wasPushed && ticksIndication < ticksActive) { Font fontAct = GetFont(FontStyle.Bold); Font fontStb = GetFont(FontStyle.Regular); Color colorAct; if (Settings.FontInherit && TitleParameters != null) { colorAct = ColorTranslator.FromHtml(TitleParameters.FontColor); } else { colorAct = ColorTranslator.FromHtml(Settings.FontColor); } Color colorStb; if (Settings.FontInherit && TitleParameters != null) { colorStb = GetDarkenedColor(TitleParameters.FontColor); } else { colorStb = ColorTranslator.FromHtml(Settings.FontColorStby); } ImageRenderer render = new ImageRenderer(imgManager.GetImageObject(background, DeckType)); render.DrawText(valueAct, fontAct, colorAct, Settings.GetRectangleText()); render.DrawText(valueStb, fontStb, colorStb, ModelDisplayText.GetRectangleF(Settings.RectCoordStby)); DrawImage = render.RenderImage64(); IsRawImage = true; NeedRedraw = true; if (!wasPushed) { lastText = valueAct + valueStb; } else { lastText = ""; } render.Dispose(); } }
protected override void Redraw(ImageManager imgManager) { if (!ValueManager.IsChanged(ID.ControlState) && !ForceUpdate) { return; } string value = ValueManager[ID.ControlState]; if (Settings.DecodeBCD) { value = ModelDisplay.ConvertFromBCD(value); } value = TextSettings.ScaleValue(value); value = TextSettings.RoundValue(value); //evaluate value and set indication string background = DefaultImage; TextSettings.GetFontParameters(TitleParameters, out Font drawFont, out Color drawColor); Color boxColor = ColorTranslator.FromHtml(TextSettings.BoxColor); string text = ""; if (TextSettings.HasIndication && TextSettings.IndicationValue == value) { background = TextSettings.IndicationImage; if (!TextSettings.IndicationHideValue) { text = TextSettings.FormatValue(value); if (TextSettings.IndicationUseColor) { drawColor = ColorTranslator.FromHtml(TextSettings.IndicationColor); } } if (TextSettings.IndicationUseColor) { boxColor = ColorTranslator.FromHtml(TextSettings.IndicationColor); } } else { text = TextSettings.FormatValue(value); } text = TextSettings.GetValueMapped(text); if (text != lastText || ForceUpdate) { ImageRenderer render = new ImageRenderer(imgManager.GetImageObject(background, DeckType)); if (TextSettings.DrawBox) { render.DrawBox(boxColor, ModelDisplayText.GetNumValue(TextSettings.BoxSize, 2), TextSettings.GetRectangleBox()); } if (text != "") { render.DrawText(text, drawFont, drawColor, TextSettings.GetRectangleText()); } DrawImage = render.RenderImage64(); IsRawImage = true; NeedRedraw = true; lastText = text; render.Dispose(); } }