protected virtual void DrawText(string value, ImageRenderer render) { if (GaugeSettings.ShowText) { value = GaugeSettings.RoundValue(value); if (GaugeSettings.BarOrientation == (int)GaugeOrientation.LEFT && !GaugeSettings.DrawArc) { render.Rotate(180, new PointF(0, 0)); } GaugeSettings.GetFontParameters(TitleParameters, value, out Font drawFont, out Color drawColor); string text = ModelDisplay.FormatValue(value, GaugeSettings.Format); text = GaugeSettings.GetValueMapped(text); render.DrawText(text, drawFont, drawColor, ModelDisplayText.GetRectangleF(GaugeSettings.RectCoord)); } }
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 virtual void DrawBar(string value, ImageRenderer render) { Bar drawBar = GaugeSettings.GetBar(); float min = ModelDisplayText.GetNumValue(GaugeSettings.MinimumValue, 0); float max = ModelDisplayText.GetNumValue(GaugeSettings.MaximumValue, 100); render.Rotate(GaugeSettings.BarOrientation, new PointF(0, 0)); render.DrawBar(ColorTranslator.FromHtml(GaugeSettings.GaugeColor), drawBar); if (GaugeSettings.DrawWarnRange) { render.DrawBarRanges(drawBar, GaugeSettings.GetColorRange(), GaugeSettings.GetWarnRange(), min, max, GaugeSettings.SymmRange); } if (GaugeSettings.CenterLine) { render.DrawBarCenterLine(drawBar, ColorTranslator.FromHtml(GaugeSettings.CenterLineColor), ModelDisplayText.GetNumValue(GaugeSettings.CenterLineThickness, 2)); } render.DrawBarIndicator(drawBar, ColorTranslator.FromHtml(GaugeSettings.IndicatorColor), ModelDisplayText.GetNumValue(GaugeSettings.IndicatorSize, 10), ModelDisplayText.GetNumValue(value, 0), min, max, GaugeSettings.IndicatorFlip); }