public void RenderDynamicShadows(GaugeGraphics g) { using (GraphicsPath graphicsPath = new GraphicsPath()) { foreach (Knob knob in this.Knobs) { GraphicsPath shadowPath = knob.GetShadowPath(g); if (shadowPath != null) { graphicsPath.AddPath(shadowPath, false); } } foreach (CircularPointer pointer in this.Pointers) { GraphicsPath shadowPath2 = pointer.GetShadowPath(g); if (shadowPath2 != null) { graphicsPath.AddPath(shadowPath2, false); } } graphicsPath.FillMode = FillMode.Winding; using (Brush brush = g.GetShadowBrush()) { g.FillPath(brush, graphicsPath); } } }
void ISelectable.DrawSelection(GaugeGraphics g, bool designTimeSelection) { if (GetGauge() == null || GetScale() == null) { return; } Stack stack = new Stack(); for (NamedElement namedElement = GetGauge().ParentObject; namedElement != null; namedElement = (NamedElement)((IRenderable)namedElement).GetParentRenderable()) { stack.Push(namedElement); } foreach (IRenderable item in stack) { g.CreateDrawRegion(item.GetBoundRect(g)); } g.CreateDrawRegion(((IRenderable)GetGauge()).GetBoundRect(g)); using (GraphicsPath graphicsPath = GetPointerPath(g)) { if (graphicsPath != null) { RectangleF bounds = graphicsPath.GetBounds(); g.DrawSelection(bounds, designTimeSelection, Common.GaugeCore.SelectionBorderColor, Common.GaugeCore.SelectionMarkerColor); } } g.RestoreDrawRegion(); foreach (IRenderable item2 in stack) { _ = item2; g.RestoreDrawRegion(); } }
public void RenderTopImage(GaugeGraphics g) { if (base.TopImage != "") { ImageAttributes imageAttributes = new ImageAttributes(); if (base.TopImageTransColor != Color.Empty) { imageAttributes.SetColorKey(base.TopImageTransColor, base.TopImageTransColor, ColorAdjustType.Default); } Image image = this.Common.ImageLoader.LoadImage(base.TopImage); Rectangle destRect = Rectangle.Round(g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f))); if (!base.TopImageHueColor.IsEmpty) { Color color = g.TransformHueColor(base.TopImageHueColor); ColorMatrix colorMatrix = new ColorMatrix(); colorMatrix.Matrix00 = (float)((float)(int)color.R / 255.0); colorMatrix.Matrix11 = (float)((float)(int)color.G / 255.0); colorMatrix.Matrix22 = (float)((float)(int)color.B / 255.0); imageAttributes.SetColorMatrix(colorMatrix); } ImageSmoothingState imageSmoothingState = new ImageSmoothingState(g); imageSmoothingState.Set(); g.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imageAttributes); imageSmoothingState.Restore(); } }
public GraphicsPath GetCompoundPath(GaugeGraphics g) { GraphicsPath graphicsPath = new GraphicsPath(); PointF location = new PointF(this.GetPivotPoint().X - this.GetRadius(), this.GetPivotPoint().Y - this.GetRadius()); RectangleF relative = new RectangleF(location, new SizeF((float)(this.GetRadius() * 2.0), (float)(this.GetRadius() * 2.0))); float num = 0f; if (this.MajorTickMark.Visible) { num = (float)Math.Atan(this.MajorTickMark.Width / 2.0 / this.GetRadius()); } if (this.MinorTickMark.Visible) { num = (float)Math.Max((double)num, Math.Atan(this.MinorTickMark.Width / 2.0 / this.GetRadius())); } num = Utils.Rad2Deg(num); float startAngle = Utils.ToGDIAngle(base.StartPosition - num); float startAngle2 = Utils.ToGDIAngle(base.EndPosition + num); float num2 = (float)(base.EndPosition - base.StartPosition + num * 2.0); graphicsPath.StartFigure(); graphicsPath.AddArc(g.GetAbsoluteRectangle(relative), startAngle, num2); relative.Inflate((float)((0.0 - relative.Width) / 2.0), (float)((0.0 - relative.Height) / 2.0)); RectangleF absoluteRectangle = g.GetAbsoluteRectangle(relative); absoluteRectangle.Inflate(15f, 15f); graphicsPath.AddArc(absoluteRectangle, startAngle2, (float)(360.0 - num2)); graphicsPath.CloseAllFigures(); return(graphicsPath); }
private void RenderBar(GaugeGraphics g) { using (GraphicsPath path = GetBarPath(Width / 2f, Width / 2f)) { g.DrawPathAbs(path, base.FillColor, base.FillHatchStyle, "", GaugeImageWrapMode.Unscaled, Color.Empty, GaugeImageAlign.Center, base.FillGradientType, base.FillGradientEndColor, base.BorderColor, base.BorderWidth, base.BorderStyle, PenAlignment.Outset); } }
public void RenderStaticShadows(GaugeGraphics g) { using (GraphicsPath graphicsPath = new GraphicsPath()) { foreach (LinearRange range in this.Ranges) { GraphicsPath path = range.GetPath(g, true); if (path != null) { graphicsPath.AddPath(path, false); } } foreach (LinearScale scale in this.Scales) { GraphicsPath shadowPath = scale.GetShadowPath(); if (shadowPath != null) { graphicsPath.AddPath(shadowPath, false); } } graphicsPath.FillMode = FillMode.Winding; using (Brush brush = g.GetShadowBrush()) { g.FillPath(brush, graphicsPath); } } }
public void Render(GaugeGraphics g) { if (InnerLayers != null) { for (int i = 0; i < InnerLayers.Length; i++) { InnerLayers[i].Render(g); } } if (Paths == null) { return; } for (int j = 0; j < Paths.Length; j++) { if (Brushes[j] != null) { g.FillPath(Brushes[j], Paths[j]); } if (Pens[j] != null) { g.DrawPath(Pens[j], Paths[j]); } } }
private GraphicsPath GetBarPath(float barOffsetInside, float barOffsetOutside, float angularMargin) { GaugeGraphics graph = Common.Graph; GraphicsPath graphicsPath = new GraphicsPath(); PointF location = new PointF(GetPivotPoint().X - GetRadius(), GetPivotPoint().Y - GetRadius()); RectangleF relative = new RectangleF(location, new SizeF(GetRadius() * 2f, GetRadius() * 2f)); float num = 0f; if (MajorTickMark.Visible) { num = (float)Math.Atan(MajorTickMark.Width / 2f / GetRadius()); } if (MinorTickMark.Visible) { num = (float)Math.Max(num, Math.Atan(MinorTickMark.Width / 2f / GetRadius())); } num = Utils.Rad2Deg(num); num += angularMargin; float startAngle = Utils.ToGDIAngle(base.StartPosition - num); float startAngle2 = Utils.ToGDIAngle(base.EndPosition + num); float num2 = base.EndPosition - base.StartPosition + num * 2f; graphicsPath.StartFigure(); relative.Inflate(barOffsetOutside, barOffsetOutside); graphicsPath.AddArc(graph.GetAbsoluteRectangle(relative), startAngle, num2); relative.Inflate(0f - (barOffsetInside + barOffsetOutside), 0f - (barOffsetInside + barOffsetOutside)); RectangleF absoluteRectangle = graph.GetAbsoluteRectangle(relative); if (absoluteRectangle.Width > 0f && absoluteRectangle.Height > 0f) { graphicsPath.AddArc(absoluteRectangle, startAngle2, 0f - num2); } graphicsPath.CloseAllFigures(); return(graphicsPath); }
internal GraphicsPath GetCompoundPath(GaugeGraphics g) { GraphicsPath graphicsPath = new GraphicsPath(); PointF location = new PointF(GetPivotPoint().X - GetRadius(), GetPivotPoint().Y - GetRadius()); RectangleF relative = new RectangleF(location, new SizeF(GetRadius() * 2f, GetRadius() * 2f)); float num = 0f; if (MajorTickMark.Visible) { num = (float)Math.Atan(MajorTickMark.Width / 2f / GetRadius()); } if (MinorTickMark.Visible) { num = (float)Math.Max(num, Math.Atan(MinorTickMark.Width / 2f / GetRadius())); } num = Utils.Rad2Deg(num); float startAngle = Utils.ToGDIAngle(base.StartPosition - num); float startAngle2 = Utils.ToGDIAngle(base.EndPosition + num); float num2 = base.EndPosition - base.StartPosition + num * 2f; graphicsPath.StartFigure(); graphicsPath.AddArc(g.GetAbsoluteRectangle(relative), startAngle, num2); relative.Inflate((0f - relative.Width) / 2f, (0f - relative.Height) / 2f); RectangleF absoluteRectangle = g.GetAbsoluteRectangle(relative); absoluteRectangle.Inflate(15f, 15f); graphicsPath.AddArc(absoluteRectangle, startAngle2, 360f - num2); graphicsPath.CloseAllFigures(); return(graphicsPath); }
internal GraphicsPath GetShadowPath(GaugeGraphics g) { if (base.Visible && base.ShadowOffset != 0f && Width > 0f) { SetDrawRegion(g); GraphicsPath graphicsPath = new GraphicsPath(); using (GraphicsPath addingPath = GetBarPath(Width / 2f, Width / 2f, 0f)) { graphicsPath.AddPath(addingPath, connect: false); } using (Matrix matrix = new Matrix()) { matrix.Translate(base.ShadowOffset, base.ShadowOffset); graphicsPath.Transform(matrix); } PointF pointF = new PointF(g.Graphics.Transform.OffsetX, g.Graphics.Transform.OffsetY); g.RestoreDrawRegion(); PointF pointF2 = new PointF(g.Graphics.Transform.OffsetX, g.Graphics.Transform.OffsetY); using (Matrix matrix2 = new Matrix()) { matrix2.Translate(pointF.X - pointF2.X, pointF.Y - pointF2.Y); graphicsPath.Transform(matrix2); return(graphicsPath); } } return(null); }
internal void RenderStaticShadows(GaugeGraphics g) { using (GraphicsPath graphicsPath = new GraphicsPath()) { foreach (CircularRange range in Ranges) { GraphicsPath path = range.GetPath(g, getShadowPath: true); if (path != null) { graphicsPath.AddPath(path, connect: false); } } foreach (CircularScale scale in Scales) { GraphicsPath shadowPath = scale.GetShadowPath(g); if (shadowPath != null) { graphicsPath.AddPath(shadowPath, connect: false); } } graphicsPath.FillMode = FillMode.Winding; using (Brush brush = g.GetShadowBrush()) { g.FillPath(brush, graphicsPath); } } }
internal void SetDrawRegion(GaugeGraphics g) { RectangleF rect = new RectangleF(GetGauge().PivotPoint.ToPoint(), new SizeF(0f, 0f)); rect.Inflate(radius / 2f, radius / 2f); g.CreateDrawRegion(rect); }
public void SetDrawRegion(GaugeGraphics g) { RectangleF rect = new RectangleF(this.GetGauge().PivotPoint.ToPoint(), new SizeF(0f, 0f)); rect.Inflate((float)(this.radius / 2.0), (float)(this.radius / 2.0)); g.CreateDrawRegion(rect); }
public GraphicsPath GetShadowPath(GaugeGraphics g) { if (base.Visible && base.ShadowOffset != 0.0 && this.Width > 0.0) { this.SetDrawRegion(g); GraphicsPath graphicsPath = new GraphicsPath(); using (GraphicsPath addingPath = this.GetBarPath((float)(this.Width / 2.0), (float)(this.Width / 2.0), 0f)) { graphicsPath.AddPath(addingPath, false); } using (Matrix matrix = new Matrix()) { matrix.Translate(base.ShadowOffset, base.ShadowOffset); graphicsPath.Transform(matrix); } PointF pointF = new PointF(g.Graphics.Transform.OffsetX, g.Graphics.Transform.OffsetY); g.RestoreDrawRegion(); PointF pointF2 = new PointF(g.Graphics.Transform.OffsetX, g.Graphics.Transform.OffsetY); using (Matrix matrix2 = new Matrix()) { matrix2.Translate(pointF.X - pointF2.X, pointF.Y - pointF2.Y); graphicsPath.Transform(matrix2); return(graphicsPath); } } return(null); }
private PathGradientBrush GetSpecialCapBrush(GaugeGraphics g, GraphicsPath path, PointF pointOrigin, float angle, Color fillColor, GradientType fillGradientType, Color fillGradientEndColor, GaugeHatchStyle fillHatchStyle) { using (GraphicsPath graphicsPath = (GraphicsPath)path.Clone()) { graphicsPath.Flatten(null, 0.3f); graphicsPath.Reset(); RectangleF bounds = path.GetBounds(); bounds.Inflate(-20f, -20f); PointF[] points = new PointF[4] { new PointF(bounds.Left, bounds.Top), new PointF(bounds.Right, bounds.Top), new PointF(bounds.Right, bounds.Bottom), new PointF(bounds.Left, bounds.Bottom) }; graphicsPath.AddLines(points); PathGradientBrush pathGradientBrush = new PathGradientBrush(graphicsPath); pathGradientBrush.SurroundColors = new Color[4] { Color.Red, Color.Green, Color.Blue, Color.Green }; pathGradientBrush.CenterColor = Color.Transparent; pathGradientBrush.CenterPoint = new PointF(bounds.Left, bounds.Top); pathGradientBrush.RotateTransform(angle, MatrixOrder.Append); pathGradientBrush.TranslateTransform(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append); return(pathGradientBrush); } }
public GraphicsPath GetTextPath(GaugeGraphics g) { if (!this.Visible) { return(null); } RectangleF absoluteRectangle = g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f)); GraphicsPath graphicsPath = new GraphicsPath(); string noImageString = SR.NoImageString; Font font = new Font("Microsoft Sans Serif", 8.25f); SizeF sizeF = g.MeasureString(noImageString, font); SizeF absoluteSize = g.GetAbsoluteSize(new SizeF(100f, 100f)); float num = absoluteSize.Width / sizeF.Width; float num2 = absoluteSize.Height / sizeF.Height; float emSize = (float)((!(num < num2)) ? (font.SizeInPoints * num2 * 1.2999999523162842) : (font.SizeInPoints * num * 1.2999999523162842)); StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; graphicsPath.AddString(noImageString, font.FontFamily, (int)font.Style, emSize, absoluteRectangle, stringFormat); if (this.Angle != 0.0) { PointF point = new PointF((float)(absoluteRectangle.X + absoluteRectangle.Width / 2.0), (float)(absoluteRectangle.Y + absoluteRectangle.Height / 2.0)); using (Matrix matrix = new Matrix()) { matrix.RotateAt(this.Angle, point); graphicsPath.Transform(matrix); return(graphicsPath); } } return(graphicsPath); }
internal Brush GetBrush(GaugeGraphics g, RectangleF rect, GaugeHatchStyle hatchStyle, GradientType gradientType, Color fillColor, Color gradientEndColor, bool frame, float frameWidth) { Brush brush = null; if (hatchStyle != 0) { brush = GaugeGraphics.GetHatchBrush(hatchStyle, fillColor, gradientEndColor); } else if (gradientType != 0) { if (FrameShape == BackFrameShape.Circular && gradientType == GradientType.DiagonalLeft) { brush = g.GetGradientBrush(rect, fillColor, gradientEndColor, GradientType.LeftRight); Matrix matrix = new Matrix(); matrix.RotateAt(45f, new PointF(rect.X + rect.Width / 2f, rect.Y + rect.Height / 2f)); ((LinearGradientBrush)brush).Transform = matrix; } else if (FrameShape == BackFrameShape.Circular && gradientType == GradientType.DiagonalRight) { brush = g.GetGradientBrush(rect, fillColor, gradientEndColor, GradientType.TopBottom); Matrix matrix2 = new Matrix(); matrix2.RotateAt(135f, new PointF(rect.X + rect.Width / 2f, rect.Y + rect.Height / 2f)); ((LinearGradientBrush)brush).Transform = matrix2; } else if (gradientType == GradientType.Center) { GraphicsPath graphicsPath = new GraphicsPath(); if (FrameShape == BackFrameShape.Circular) { graphicsPath.AddArc(rect.X, rect.Y, rect.Width, rect.Height, 0f, 360f); } else { graphicsPath.AddRectangle(rect); } PathGradientBrush pathGradientBrush = new PathGradientBrush(graphicsPath); pathGradientBrush.CenterColor = fillColor; pathGradientBrush.CenterPoint = new PointF(rect.X + rect.Width / 2f, rect.Y + rect.Height / 2f); pathGradientBrush.SurroundColors = new Color[1] { gradientEndColor }; if (frame) { pathGradientBrush.FocusScales = new PointF((rect.Width - frameWidth * 2f) / rect.Width, (rect.Height - frameWidth * 2f) / rect.Height); } brush = pathGradientBrush; } else { brush = g.GetGradientBrush(rect, fillColor, gradientEndColor, gradientType); } } else { brush = new SolidBrush(fillColor); } return(brush); }
private void RenderLabels(GaugeGraphics g) { if (!LabelStyle.Visible) { return; } double interval = GetInterval(IntervalTypes.Labels); float offsetLabelPos = GetOffsetLabelPos(LabelStyle.Placement, LabelStyle.DistanceFromScale, Position); double minimumLog = base.MinimumLog; double intervalOffset = GetIntervalOffset(IntervalTypes.Labels); Color textColor = LabelStyle.TextColor; CustomTickMark endLabelTickMark = GetEndLabelTickMark(); if (LabelStyle.ShowEndLabels && intervalOffset > 0.0) { textColor = GetRangeLabelsColor(minimumLog, LabelStyle.TextColor); DrawLabel(labelStr: (Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : Common.GaugeContainer.FormatNumberHandler(Common.GaugeContainer, minimumLog * base.Multiplier, LabelStyle.FormatString), placement: LabelStyle.Placement, value: minimumLog, labelPos: offsetLabelPos, rotateLabelAngle: LabelStyle.FontAngle, font: LabelStyle.Font, color: textColor, fontUnit: LabelStyle.FontUnit); if (endLabelTickMark != null) { DrawTickMark(g, endLabelTickMark, minimumLog, GetTickMarkOffset(endLabelTickMark)); } } minimumLog += intervalOffset; double num = 0.0; while (minimumLog <= base.Maximum) { bool flag = true; foreach (CustomLabel customLabel in base.CustomLabels) { if (Math.Abs(customLabel.Value - minimumLog) < 1E-07 && customLabel.Placement == LabelStyle.Placement && Math.Abs(customLabel.DistanceFromScale - LabelStyle.DistanceFromScale) < 1f) { flag = false; } } if (!LabelStyle.ShowEndLabels && (minimumLog == base.MinimumLog || minimumLog == base.Maximum)) { flag = false; } if (flag) { textColor = GetRangeLabelsColor(minimumLog, LabelStyle.TextColor); DrawLabel(labelStr: (Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : Common.GaugeContainer.FormatNumberHandler(Common.GaugeContainer, minimumLog * base.Multiplier, LabelStyle.FormatString), placement: LabelStyle.Placement, value: minimumLog, labelPos: offsetLabelPos, rotateLabelAngle: LabelStyle.FontAngle, font: LabelStyle.Font, color: textColor, fontUnit: LabelStyle.FontUnit); } num = minimumLog; minimumLog = GetNextPosition(minimumLog, interval, forceLinear: false); } if (LabelStyle.ShowEndLabels && num < base.Maximum) { minimumLog = base.Maximum; textColor = GetRangeLabelsColor(minimumLog, LabelStyle.TextColor); DrawLabel(labelStr: (Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : Common.GaugeContainer.FormatNumberHandler(Common.GaugeContainer, minimumLog * base.Multiplier, LabelStyle.FormatString), placement: LabelStyle.Placement, value: minimumLog, labelPos: offsetLabelPos, rotateLabelAngle: LabelStyle.FontAngle, font: LabelStyle.Font, color: textColor, fontUnit: LabelStyle.FontUnit); if (endLabelTickMark != null) { DrawTickMark(g, endLabelTickMark, minimumLog, GetTickMarkOffset(endLabelTickMark)); } } }
private void RenderLabels(GaugeGraphics g) { if (this.LabelStyle.Visible) { double interval = base.GetInterval(IntervalTypes.Labels); float offsetLabelPos = base.GetOffsetLabelPos(this.LabelStyle.Placement, this.LabelStyle.DistanceFromScale, this.Position); double minimumLog = base.MinimumLog; double intervalOffset = base.GetIntervalOffset(IntervalTypes.Labels); Color textColor = this.LabelStyle.TextColor; CustomTickMark endLabelTickMark = base.GetEndLabelTickMark(); if (this.LabelStyle.ShowEndLabels && intervalOffset > 0.0) { textColor = base.GetRangeLabelsColor(minimumLog, this.LabelStyle.TextColor); string labelStr = (this.Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, this.LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : this.Common.GaugeContainer.FormatNumberHandler(this.Common.GaugeContainer, minimumLog * base.Multiplier, this.LabelStyle.FormatString); this.DrawLabel(this.LabelStyle.Placement, labelStr, minimumLog, offsetLabelPos, this.LabelStyle.FontAngle, this.LabelStyle.Font, textColor, this.LabelStyle.FontUnit); if (endLabelTickMark != null) { this.DrawTickMark(g, endLabelTickMark, minimumLog, base.GetTickMarkOffset(endLabelTickMark)); } } minimumLog += intervalOffset; double num = 0.0; while (minimumLog <= base.Maximum) { bool flag = true; foreach (CustomLabel customLabel in base.CustomLabels) { if (Math.Abs(customLabel.Value - minimumLog) < 1E-07 && customLabel.Placement == this.LabelStyle.Placement && Math.Abs(customLabel.DistanceFromScale - this.LabelStyle.DistanceFromScale) < 1.0) { flag = false; } } if (!this.LabelStyle.ShowEndLabels && (minimumLog == base.MinimumLog || minimumLog == base.Maximum)) { flag = false; } if (flag) { textColor = base.GetRangeLabelsColor(minimumLog, this.LabelStyle.TextColor); string labelStr2 = (this.Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, this.LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : this.Common.GaugeContainer.FormatNumberHandler(this.Common.GaugeContainer, minimumLog * base.Multiplier, this.LabelStyle.FormatString); this.DrawLabel(this.LabelStyle.Placement, labelStr2, minimumLog, offsetLabelPos, this.LabelStyle.FontAngle, this.LabelStyle.Font, textColor, this.LabelStyle.FontUnit); } num = minimumLog; minimumLog = base.GetNextPosition(minimumLog, interval, false); } if (this.LabelStyle.ShowEndLabels && num < base.Maximum) { minimumLog = base.Maximum; textColor = base.GetRangeLabelsColor(minimumLog, this.LabelStyle.TextColor); string labelStr3 = (this.Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, this.LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : this.Common.GaugeContainer.FormatNumberHandler(this.Common.GaugeContainer, minimumLog * base.Multiplier, this.LabelStyle.FormatString); this.DrawLabel(this.LabelStyle.Placement, labelStr3, minimumLog, offsetLabelPos, this.LabelStyle.FontAngle, this.LabelStyle.Font, textColor, this.LabelStyle.FontUnit); if (endLabelTickMark != null) { this.DrawTickMark(g, endLabelTickMark, minimumLog, base.GetTickMarkOffset(endLabelTickMark)); } } } }
public float GetCustomLabelOffset(GaugeGraphics g, CustomLabel customLabel) { float num = (float)((customLabel.FontUnit != 0) ? (g.GetRelativeSize(new SizeF((float)(customLabel.Font.Size * 1.2999999523162842), 0f)).Width *(100.0 / this.Radius)) : customLabel.Font.Size); float num2 = 0f; num2 = (float)((customLabel.Placement != 0) ? ((customLabel.Placement != Placement.Cross) ? (customLabel.DistanceFromScale + num) : (0.0 - customLabel.DistanceFromScale + num / 2.0)) : (0.0 - this.Width / 2.0 - customLabel.DistanceFromScale)); float val = (float)((customLabel.TickMarkStyle.Placement != 0) ? ((customLabel.TickMarkStyle.Placement != Placement.Cross) ? (customLabel.TickMarkStyle.DistanceFromScale + customLabel.TickMarkStyle.Length) : (0.0 - customLabel.TickMarkStyle.DistanceFromScale + customLabel.TickMarkStyle.Length / 2.0)) : (0.0 - this.Width / 2.0 - customLabel.TickMarkStyle.DistanceFromScale)); return(Math.Max(num2, val)); }
internal float GetCustomLabelOffset(GaugeGraphics g, CustomLabel customLabel) { float num = (customLabel.FontUnit != 0) ? (g.GetRelativeSize(new SizeF(customLabel.Font.Size * 1.3f, 0f)).Width *(100f / Radius)) : customLabel.Font.Size; float num2 = 0f; num2 = ((customLabel.Placement == Placement.Inside) ? (0f - Width / 2f - customLabel.DistanceFromScale) : ((customLabel.Placement != Placement.Cross) ? (customLabel.DistanceFromScale + num) : (0f - customLabel.DistanceFromScale + num / 2f))); float val = (customLabel.TickMarkStyle.Placement == Placement.Inside) ? (0f - Width / 2f - customLabel.TickMarkStyle.DistanceFromScale) : ((customLabel.TickMarkStyle.Placement != Placement.Cross) ? (customLabel.TickMarkStyle.DistanceFromScale + customLabel.TickMarkStyle.Length) : (0f - customLabel.TickMarkStyle.DistanceFromScale + customLabel.TickMarkStyle.Length / 2f)); return(Math.Max(num2, val)); }
internal GraphicsPath GetShadowPath(GaugeGraphics g) { GraphicsPath framePath = GetFramePath(g, 0f); using (Matrix matrix = new Matrix()) { matrix.Translate(ShadowOffset, ShadowOffset); framePath.Transform(matrix); return(framePath); } }
public GraphicsPath GetShadowPath(GaugeGraphics g) { GraphicsPath framePath = this.GetFramePath(g, 0f); using (Matrix matrix = new Matrix()) { matrix.Translate(this.ShadowOffset, this.ShadowOffset); framePath.Transform(matrix); return(framePath); } }
internal float GetTickMarkOffset(GaugeGraphics g, TickMark tickMark) { if (tickMark.Placement == Placement.Inside) { return(0f - Width / 2f - tickMark.DistanceFromScale); } if (tickMark.Placement == Placement.Cross) { return(0f - tickMark.DistanceFromScale + tickMark.Length / 2f); } return(tickMark.DistanceFromScale + tickMark.Length); }
public float GetTickMarkOffset(GaugeGraphics g, TickMark tickMark) { if (tickMark.Placement == Placement.Inside) { return((float)(0.0 - this.Width / 2.0 - tickMark.DistanceFromScale)); } if (tickMark.Placement == Placement.Cross) { return((float)(0.0 - tickMark.DistanceFromScale + tickMark.Length / 2.0)); } return(tickMark.DistanceFromScale + tickMark.Length); }
public override void Render(GaugeGraphics g) { if (this.Common != null && base.Visible && this.GetScale() != null && !double.IsNaN(this.StartValue) && !double.IsNaN(this.EndValue)) { this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(this.Name)); g.StartHotRegion(this); LinearScale scale = this.GetScale(); Pen pen = null; Brush brush = null; GraphicsPath graphicsPath = null; try { graphicsPath = g.GetLinearRangePath(scale.GetPositionFromValue(this.StartValue), scale.GetPositionFromValue(this.EndValue), this.StartWidth, this.EndWidth, scale.Position, this.GetGauge().GetOrientation(), this.DistanceFromScale, this.Placement, scale.Width); if (graphicsPath != null && g.Graphics.VisibleClipBounds.IntersectsWith(graphicsPath.GetBounds())) { brush = g.GetLinearRangeBrush(graphicsPath.GetBounds(), base.FillColor, base.FillHatchStyle, base.FillGradientType, base.FillGradientEndColor, this.GetGauge().GetOrientation(), this.GetScale().GetReversed(), this.StartValue, this.EndValue); pen = new Pen(base.BorderColor, (float)base.BorderWidth); pen.DashStyle = g.GetPenStyle(base.BorderStyle); g.FillPath(brush, graphicsPath); if (base.BorderStyle != 0 && base.BorderWidth > 0) { g.DrawPath(pen, graphicsPath); } goto end_IL_0069; } g.EndHotRegion(); this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name)); return; end_IL_0069 :; } catch (Exception) { if (graphicsPath != null) { graphicsPath.Dispose(); } if (pen != null) { pen.Dispose(); } if (brush != null) { brush.Dispose(); } throw; } this.Common.GaugeCore.HotRegionList.SetHotRegion(this, PointF.Empty, graphicsPath); g.EndHotRegion(); this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name)); } }
public void BuildMatrices(GaugeGraphics g) { this.absMatrix.Reset(); RectangleF rectangleF = new RectangleF(0f, 0f, 1f, 1f); RectangleF rectangleF2 = g.GetAbsoluteRectangle(rectangleF); this.absMatrix.Translate(g.Transform.OffsetX, g.Transform.OffsetY); this.absMatrix.Scale(rectangleF2.Size.Width, rectangleF2.Size.Height); rectangleF2 = g.GetRelativeRectangle(rectangleF); this.relMatrix.Reset(); this.relMatrix.Scale(rectangleF2.Size.Width, rectangleF2.Size.Height); this.relMatrix.Translate((float)(0.0 - g.Transform.OffsetX), (float)(0.0 - g.Transform.OffsetY)); }
internal void BuildMatrices(GaugeGraphics g) { absMatrix.Reset(); RectangleF rectangleF = new RectangleF(0f, 0f, 1f, 1f); RectangleF absoluteRectangle = g.GetAbsoluteRectangle(rectangleF); absMatrix.Translate(g.Transform.OffsetX, g.Transform.OffsetY); absMatrix.Scale(absoluteRectangle.Size.Width, absoluteRectangle.Size.Height); absoluteRectangle = g.GetRelativeRectangle(rectangleF); relMatrix.Reset(); relMatrix.Scale(absoluteRectangle.Size.Width, absoluteRectangle.Size.Height); relMatrix.Translate(0f - g.Transform.OffsetX, 0f - g.Transform.OffsetY); }
public void RenderShadow(GaugeGraphics g) { if (this.ShadowOffset != 0.0) { using (GraphicsPath path = this.GetShadowPath(g)) { using (Brush brush = g.GetShadowBrush()) { g.FillPath(brush, path); } } } }
void IRenderable.RenderStaticElements(GaugeGraphics g) { if (this.Visible) { g.StartHotRegion(this); if (this.Image.Length != 0) { this.DrawImage(g, this.image, true); this.DrawImage(g, this.image, false); g.EndHotRegion(); } else { GraphicsPath graphicsPath = null; GraphicsPath graphicsPath2 = null; try { graphicsPath = this.GetTextPath(g); graphicsPath2 = this.GetBackPath(g); g.FillPath(Brushes.White, graphicsPath2); AntiAliasing antiAliasing = this.Common.GaugeContainer.AntiAliasing; AntiAliasing antiAliasing2 = g.AntiAliasing; if (this.Common.GaugeContainer.AntiAliasing == AntiAliasing.Text) { antiAliasing = AntiAliasing.Graphics; } else if (this.Common.GaugeContainer.AntiAliasing == AntiAliasing.Graphics) { antiAliasing = AntiAliasing.None; } g.AntiAliasing = antiAliasing; g.FillPath(Brushes.Black, graphicsPath); g.AntiAliasing = antiAliasing2; g.DrawPath(Pens.Black, graphicsPath2); this.Common.GaugeCore.HotRegionList.SetHotRegion(this, Point.Empty, (GraphicsPath)graphicsPath2.Clone()); } finally { if (graphicsPath != null) { graphicsPath.Dispose(); } if (graphicsPath2 != null) { graphicsPath2.Dispose(); } g.EndHotRegion(); } } } }