private GraphicsPath GetBarPath(float barOffsetInside, float barOffsetOutside) { GaugeGraphics graph = Common.Graph; GraphicsPath graphicsPath = new GraphicsPath(); float num = 0f; if (MajorTickMark.Visible) { num = MajorTickMark.Width / 2f; } if (MinorTickMark.Visible) { num = Math.Max(num, MinorTickMark.Width / 2f); } RectangleF relative = new RectangleF(0f, 0f, 0f, 0f); if (ParentGauge.GetOrientation() == GaugeOrientation.Horizontal) { relative.X = base.StartPosition; relative.Width = base.EndPosition - base.StartPosition; relative.Y = Position - barOffsetInside; relative.Height = barOffsetInside + barOffsetOutside; relative = graph.GetAbsoluteRectangle(relative); relative.Inflate(graph.GetAbsoluteDimension(num), 0f); } else { relative.Y = base.StartPosition; relative.Height = base.EndPosition - base.StartPosition; relative.X = Position - barOffsetInside; relative.Width = barOffsetInside + barOffsetOutside; relative = graph.GetAbsoluteRectangle(relative); relative.Inflate(0f, graph.GetAbsoluteDimension(num)); } if (relative.Width <= 0f) { relative.Width = 1E-06f; } if (relative.Height <= 0f) { relative.Height = 1E-06f; } graphicsPath.AddRectangle(relative); return(graphicsPath); }
internal MarkerStyleAttrib GetMarkerStyleAttrib(GaugeGraphics g) { MarkerStyleAttrib markerStyleAttrib = new MarkerStyleAttrib(); float absoluteDimension = g.GetAbsoluteDimension(MarkerLength); float absoluteDimension2 = g.GetAbsoluteDimension(Width); markerStyleAttrib.path = g.CreateMarker(new PointF(0f, 0f), absoluteDimension2, absoluteDimension, MarkerStyle); float num = 0f; if (Placement == Placement.Cross || Placement == Placement.Inside) { num += 180f; } if (GetGauge().GetOrientation() == GaugeOrientation.Vertical) { num += 270f; } if (num > 0f) { using (Matrix matrix = new Matrix()) { matrix.Rotate(num); markerStyleAttrib.path.Transform(matrix); } } float num2 = CalculateMarkerDistance(); LinearScale scale = GetScale(); float positionFromValue = scale.GetPositionFromValue(scale.GetValueLimit(base.Position)); PointF pointF = Point.Empty; pointF = ((GetGauge().GetOrientation() != 0) ? g.GetAbsolutePoint(new PointF(num2, positionFromValue)) : g.GetAbsolutePoint(new PointF(positionFromValue, num2))); markerStyleAttrib.brush = g.GetMarkerBrush(markerStyleAttrib.path, MarkerStyle, pointF, 0f, FillColor, FillGradientType, FillGradientEndColor, FillHatchStyle); using (Matrix matrix2 = new Matrix()) { matrix2.Translate(pointF.X, pointF.Y, MatrixOrder.Append); markerStyleAttrib.path.Transform(matrix2); return(markerStyleAttrib); } }
public MarkerStyleAttrib GetMarkerStyleAttrib(GaugeGraphics g) { MarkerStyleAttrib markerStyleAttrib = new MarkerStyleAttrib(); float absoluteDimension = g.GetAbsoluteDimension(this.MarkerLength); float absoluteDimension2 = g.GetAbsoluteDimension(this.Width); markerStyleAttrib.path = g.CreateMarker(new PointF(0f, 0f), absoluteDimension2, absoluteDimension, this.MarkerStyle); float num = 0f; if (this.Placement == Placement.Cross || this.Placement == Placement.Inside) { num = (float)(num + 180.0); } if (this.GetGauge().GetOrientation() == GaugeOrientation.Vertical) { num = (float)(num + 270.0); } if (num > 0.0) { using (Matrix matrix = new Matrix()) { matrix.Rotate(num); markerStyleAttrib.path.Transform(matrix); } } float num2 = this.CalculateMarkerDistance(); ScaleBase scale = this.GetScale(); float positionFromValue = scale.GetPositionFromValue(scale.GetValueLimit(base.Position)); PointF pointOrigin = Point.Empty; pointOrigin = ((this.GetGauge().GetOrientation() != 0) ? g.GetAbsolutePoint(new PointF(num2, positionFromValue)) : g.GetAbsolutePoint(new PointF(positionFromValue, num2))); markerStyleAttrib.brush = g.GetMarkerBrush(markerStyleAttrib.path, this.MarkerStyle, pointOrigin, 0f, this.FillColor, this.FillGradientType, this.FillGradientEndColor, this.FillHatchStyle); using (Matrix matrix2 = new Matrix()) { matrix2.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append); markerStyleAttrib.path.Transform(matrix2); return(markerStyleAttrib); } }
internal void DrawImage(GaugeGraphics g, bool drawShadow) { if (!Visible || (drawShadow && base.ShadowOffset == 0f)) { return; } Image image = Common.ImageLoader.LoadImage(Image); if (image.Width == 0 || image.Height == 0) { return; } Point point = new Point(ImageOrigin.X, ImageOrigin.Y); if (point.X == 0) { point.X = image.Width / 2; } if (point.Y == 0) { point.Y = image.Height / 2; } float absoluteDimension = g.GetAbsoluteDimension(Width); float absoluteDimension2 = g.GetAbsoluteDimension(MarkerLength); float num = absoluteDimension / (float)image.Width; float num2 = absoluteDimension2 / (float)image.Height; float num3 = CalculateMarkerDistance(); float positionFromValue = GetScale().GetPositionFromValue(base.Position); PointF pointF = Point.Empty; pointF = ((GetGauge().GetOrientation() != 0) ? g.GetAbsolutePoint(new PointF(num3, positionFromValue)) : g.GetAbsolutePoint(new PointF(positionFromValue, num3))); Matrix transform = g.Transform; Matrix matrix = g.Transform.Clone(); Rectangle rectangle = new Rectangle((int)(pointF.X - (float)point.X * num) + 1, (int)(pointF.Y - (float)point.Y * num2) + 1, (int)((float)image.Width * num) + 1, (int)((float)image.Height * num2) + 1); ImageAttributes imageAttributes = new ImageAttributes(); if (ImageTransColor != Color.Empty) { imageAttributes.SetColorKey(ImageTransColor, ImageTransColor, ColorAdjustType.Default); } if (drawShadow) { ColorMatrix colorMatrix = new ColorMatrix(); colorMatrix.Matrix00 = 0f; colorMatrix.Matrix11 = 0f; colorMatrix.Matrix22 = 0f; colorMatrix.Matrix33 = Common.GaugeCore.ShadowIntensity / 100f; imageAttributes.SetColorMatrix(colorMatrix); matrix.Translate(base.ShadowOffset, base.ShadowOffset, MatrixOrder.Append); } else { ColorMatrix colorMatrix2 = new ColorMatrix(); if (!ImageHueColor.IsEmpty) { Color color = g.TransformHueColor(ImageHueColor); colorMatrix2.Matrix00 = (float)(int)color.R / 255f; colorMatrix2.Matrix11 = (float)(int)color.G / 255f; colorMatrix2.Matrix22 = (float)(int)color.B / 255f; } colorMatrix2.Matrix33 = 1f - ImageTransparency / 100f; imageAttributes.SetColorMatrix(colorMatrix2); } g.Transform = matrix; g.DrawImage(image, rectangle, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imageAttributes); g.Transform = transform; if (!drawShadow) { GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.AddRectangle(rectangle); AddHotRegion(graphicsPath, primary: true); } }
public GraphicsPath GetTextPath(GaugeGraphics g) { if (!this.Visible) { return(null); } if (this.Text.Length == 0) { return(null); } RectangleF absoluteRectangle = g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f)); GraphicsPath graphicsPath = new GraphicsPath(); string text = this.Text; Font font = this.Font; text = text.Replace("\\n", "\n"); float emSize; if (this.ResizeMode == ResizeMode.AutoFit) { SizeF sizeF = g.MeasureString(text, font); SizeF absoluteSize = g.GetAbsoluteSize(new SizeF(100f, 100f)); float num = absoluteSize.Width / sizeF.Width; float num2 = absoluteSize.Height / sizeF.Height; emSize = (float)((!(num < num2)) ? (font.SizeInPoints * num2 * 1.2999999523162842 * g.Graphics.DpiY / 96.0) : (font.SizeInPoints * num * 1.2999999523162842 * g.Graphics.DpiY / 96.0)); } else { if (this.FontUnit == FontUnit.Percent) { g.RestoreDrawRegion(); emSize = g.GetAbsoluteDimension(font.Size); RectangleF boundRect = ((IRenderable)this).GetBoundRect(g); g.CreateDrawRegion(boundRect); } else { emSize = (float)(font.SizeInPoints * g.Graphics.DpiY / 96.0); } emSize = (float)(emSize * 1.2999999523162842); } StringFormat stringFormat = new StringFormat(); if (this.TextAlignment == ContentAlignment.TopLeft) { stringFormat.Alignment = StringAlignment.Near; stringFormat.LineAlignment = StringAlignment.Near; } else if (this.TextAlignment == ContentAlignment.TopCenter) { stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Near; } else if (this.TextAlignment == ContentAlignment.TopRight) { stringFormat.Alignment = StringAlignment.Far; stringFormat.LineAlignment = StringAlignment.Near; } else if (this.TextAlignment == ContentAlignment.MiddleLeft) { stringFormat.Alignment = StringAlignment.Near; stringFormat.LineAlignment = StringAlignment.Center; } else if (this.TextAlignment == ContentAlignment.MiddleCenter) { stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; } else if (this.TextAlignment == ContentAlignment.MiddleRight) { stringFormat.Alignment = StringAlignment.Far; stringFormat.LineAlignment = StringAlignment.Center; } else if (this.TextAlignment == ContentAlignment.BottomLeft) { stringFormat.Alignment = StringAlignment.Near; stringFormat.LineAlignment = StringAlignment.Far; } else if (this.TextAlignment == ContentAlignment.BottomCenter) { stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Far; } else { stringFormat.Alignment = StringAlignment.Far; stringFormat.LineAlignment = StringAlignment.Far; } graphicsPath.AddString(text, 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); }
public KnobStyleAttrib GetKnobStyleAttrib(GaugeGraphics g, PointF pointOrigin, float angle) { KnobStyleAttrib knobStyleAttrib = new KnobStyleAttrib(); if (this.Image != "" && this.CapImage != "") { return(knobStyleAttrib); } float absoluteDimension = g.GetAbsoluteDimension(this.Width); float num = (float)(this.CapWidth / 100.0 * absoluteDimension); knobStyleAttrib.paths = new GraphicsPath[6]; knobStyleAttrib.brushes = new Brush[6]; if (this.Image == "") { knobStyleAttrib.paths[0] = this.GetKnobPath(g, absoluteDimension, (float)(absoluteDimension * 0.5)); } else { knobStyleAttrib.paths[0] = null; } if (this.CapVisible && this.CapImage == "") { if (this.CapShadowOffset != 0.0) { knobStyleAttrib.paths[1] = new GraphicsPath(); knobStyleAttrib.paths[1].AddEllipse((float)(0.0 - num + this.CapShadowOffset), (float)(0.0 - num + this.CapShadowOffset), (float)(num * 2.0), (float)(num * 2.0)); using (Matrix matrix = new Matrix()) { matrix.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append); knobStyleAttrib.paths[1].Transform(matrix); } } knobStyleAttrib.paths[2] = new GraphicsPath(); knobStyleAttrib.paths[2].AddEllipse((float)(0.0 - num), (float)(0.0 - num), (float)(num * 2.0), (float)(num * 2.0)); } else { if (this.CapShadowOffset == 0.0) { knobStyleAttrib.paths[1] = null; } knobStyleAttrib.paths[2] = null; } float y = (float)(this.MarkerPosition / 100.0 * absoluteDimension * 2.0); float num2 = (float)(this.MarkerWidth / 100.0 * absoluteDimension * 2.0); float markerHeight = (float)(this.MarkerLength / 100.0 * absoluteDimension * 2.0); PointF point = new PointF(0f, y); knobStyleAttrib.paths[3] = g.CreateMarker(point, num2, markerHeight, this.MarkerStyle); using (Matrix matrix2 = new Matrix()) { matrix2.RotateAt(180f, point, MatrixOrder.Append); if (!this.MarkerRotateGradient) { matrix2.Rotate(angle, MatrixOrder.Append); matrix2.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append); } knobStyleAttrib.paths[3].Transform(matrix2); } if (this.Image == "" && knobStyleAttrib.paths[0] != null) { float angle2 = (float)(this.RotateGradient ? angle : 0.0); knobStyleAttrib.brushes[0] = this.GetFillBrush(g, knobStyleAttrib.paths[0], pointOrigin, angle2, this.FillColor, this.FillGradientType, this.FillGradientEndColor, this.FillHatchStyle); } else { knobStyleAttrib.brushes[0] = null; } if (this.CapVisible && this.CapImage == "") { if (this.CapShadowOffset != 0.0) { knobStyleAttrib.brushes[1] = g.GetShadowBrush(); } float angle3 = (float)(this.CapRotateGradient ? angle : 0.0); knobStyleAttrib.brushes[2] = this.GetFillBrush(g, knobStyleAttrib.paths[2], pointOrigin, angle3, this.CapFillColor, this.CapFillGradientType, this.CapFillGradientEndColor, this.CapFillHatchStyle); } else { if (this.CapShadowOffset == 0.0) { knobStyleAttrib.brushes[1] = null; } knobStyleAttrib.brushes[2] = null; } float angle4 = (float)(this.MarkerRotateGradient ? angle : 0.0); PointF pointOrigin2 = pointOrigin; if (!this.MarkerRotateGradient) { pointOrigin2 = new PointF(0f, 0f); } knobStyleAttrib.brushes[3] = g.GetMarkerBrush(knobStyleAttrib.paths[3], this.MarkerStyle, pointOrigin2, angle4, this.MarkerFillColor, this.MarkerFillGradientType, this.MarkerFillGradientEndColor, this.MarkerFillHatchStyle); if (this.CapVisible && this.CapReflection && this.CapImage == "") { g.GetCircularEdgeReflection(knobStyleAttrib.paths[2].GetBounds(), 135f, 200, pointOrigin, out knobStyleAttrib.paths[4], out knobStyleAttrib.brushes[4]); g.GetCircularEdgeReflection(knobStyleAttrib.paths[2].GetBounds(), 315f, 128, pointOrigin, out knobStyleAttrib.paths[5], out knobStyleAttrib.brushes[5]); } else { knobStyleAttrib.paths[4] = null; knobStyleAttrib.paths[5] = null; knobStyleAttrib.brushes[4] = null; knobStyleAttrib.brushes[5] = null; } using (Matrix matrix3 = new Matrix()) { matrix3.Rotate(angle, MatrixOrder.Append); matrix3.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append); if (knobStyleAttrib.paths[0] != null) { knobStyleAttrib.paths[0].Transform(matrix3); } if (knobStyleAttrib.paths[2] != null) { knobStyleAttrib.paths[2].Transform(matrix3); } if (knobStyleAttrib.paths[3] != null) { if (this.MarkerRotateGradient) { knobStyleAttrib.paths[3].Transform(matrix3); return(knobStyleAttrib); } return(knobStyleAttrib); } return(knobStyleAttrib); } }
public void DrawImage(GaugeGraphics g, bool primary, bool drawShadow) { if (this.Visible) { if (drawShadow && base.ShadowOffset == 0.0) { return; } float width = this.Width; width = g.GetAbsoluteDimension(width); Image image = null; image = ((!primary) ? this.Common.ImageLoader.LoadImage(this.CapImage) : this.Common.ImageLoader.LoadImage(this.Image)); if (image.Width != 0 && image.Height != 0) { Point point = Point.Empty; point = ((!primary) ? this.CapImageOrigin : this.ImageOrigin); if (point.IsEmpty) { point.X = image.Width / 2; point.Y = image.Height / 2; } int num = (image.Height <= image.Width) ? image.Width : image.Height; if (num != 0) { float num2 = (!primary) ? (g.GetAbsoluteDimension((float)(this.CapWidth * 2.0)) / (float)num) : (g.GetAbsoluteDimension((float)(this.Width * 2.0)) / (float)num); Rectangle rectangle = new Rectangle(0, 0, (int)((float)image.Width * num2), (int)((float)image.Height * num2)); ImageAttributes imageAttributes = new ImageAttributes(); if (primary && this.ImageTransColor != Color.Empty) { imageAttributes.SetColorKey(this.ImageTransColor, this.ImageTransColor, ColorAdjustType.Default); } if (!primary && this.CapImageTransColor != Color.Empty) { imageAttributes.SetColorKey(this.CapImageTransColor, this.CapImageTransColor, ColorAdjustType.Default); } Matrix transform = g.Transform; Matrix matrix = g.Transform.Clone(); float positionFromValue = this.GetScale().GetPositionFromValue(base.Position); PointF absolutePoint = g.GetAbsolutePoint(this.GetScale().GetPivotPoint()); PointF pointF = new PointF((float)point.X * num2, (float)point.Y * num2); float offsetX = matrix.OffsetX; float offsetY = matrix.OffsetY; matrix.Translate(absolutePoint.X - pointF.X, absolutePoint.Y - pointF.Y, MatrixOrder.Append); absolutePoint.X += offsetX; absolutePoint.Y += offsetY; matrix.RotateAt(positionFromValue, absolutePoint, MatrixOrder.Append); if (drawShadow) { ColorMatrix colorMatrix = new ColorMatrix(); colorMatrix.Matrix00 = 0f; colorMatrix.Matrix11 = 0f; colorMatrix.Matrix22 = 0f; colorMatrix.Matrix33 = (float)(this.Common.GaugeCore.ShadowIntensity / 100.0); imageAttributes.SetColorMatrix(colorMatrix); matrix.Translate(base.ShadowOffset, base.ShadowOffset, MatrixOrder.Append); } else if (primary && !this.ImageHueColor.IsEmpty) { Color color = g.TransformHueColor(this.ImageHueColor); ColorMatrix colorMatrix2 = new ColorMatrix(); colorMatrix2.Matrix00 = (float)((float)(int)color.R / 255.0); colorMatrix2.Matrix11 = (float)((float)(int)color.G / 255.0); colorMatrix2.Matrix22 = (float)((float)(int)color.B / 255.0); imageAttributes.SetColorMatrix(colorMatrix2); } else if (!primary && !this.CapImageHueColor.IsEmpty) { Color color2 = g.TransformHueColor(this.CapImageHueColor); ColorMatrix colorMatrix3 = new ColorMatrix(); colorMatrix3.Matrix00 = (float)((float)(int)color2.R / 255.0); colorMatrix3.Matrix11 = (float)((float)(int)color2.G / 255.0); colorMatrix3.Matrix22 = (float)((float)(int)color2.B / 255.0); imageAttributes.SetColorMatrix(colorMatrix3); } g.Transform = matrix; ImageSmoothingState imageSmoothingState = new ImageSmoothingState(g); imageSmoothingState.Set(); g.DrawImage(image, rectangle, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imageAttributes); imageSmoothingState.Restore(); g.Transform = transform; if (!drawShadow) { matrix.Translate((float)(0.0 - offsetX), (float)(0.0 - offsetY), MatrixOrder.Append); GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.AddRectangle(rectangle); graphicsPath.Transform(matrix); this.AddHotRegion(graphicsPath, primary); } } } } }
private void BuildCircularGaugeAutoFrame(GaugeGraphics g, GraphicsPath path, CircularGauge gauge, float shrinkBy) { float startAngle = gauge.Scales[0].StartAngle; float num = gauge.Scales[0].StartAngle + gauge.Scales[0].SweepAngle; float radius = gauge.Scales[0].Radius; float num2 = gauge.Scales[0].GetLargestRadius(g); if (gauge.Scales.Count > 1) { for (int i = 1; i < gauge.Scales.Count; i++) { if (startAngle > gauge.Scales[i].StartAngle) { startAngle = gauge.Scales[i].StartAngle; } if (num < gauge.Scales[i].StartAngle + gauge.Scales[i].SweepAngle) { num = gauge.Scales[i].StartAngle + gauge.Scales[i].SweepAngle; } if (radius < gauge.Scales[i].Radius) { radius = gauge.Scales[i].Radius; } float largestRadius = gauge.Scales[i].GetLargestRadius(g); if (num2 < largestRadius) { num2 = largestRadius; } } } float num3 = 0f; foreach (CircularPointer pointer in gauge.Pointers) { if (pointer.Visible && pointer.Type == CircularPointerType.Needle) { float num4 = pointer.CapWidth / 2f * pointer.GetScale().Radius / 100f; if (pointer.CapVisible && num4 > num3) { num3 = num4; } float num5 = pointer.GetNeedleTailLength() * pointer.GetScale().Radius / 100f; if (num5 > num3) { num3 = num5; } } } foreach (Knob knob in gauge.Knobs) { if (knob.Visible) { float num6 = knob.Width * knob.GetScale().Radius / 100f; if (num6 > num3) { num3 = num6; } } } num3 = g.GetAbsoluteDimension(num3); float absoluteDimension = g.GetAbsoluteDimension(radius / 5f); float absoluteDimension2 = g.GetAbsoluteDimension(FrameWidth * radius / 100f); float absoluteDimension3 = g.GetAbsoluteDimension(shrinkBy * radius / 100f); absoluteDimension += absoluteDimension2; absoluteDimension -= absoluteDimension3; float num7 = num - startAngle; PointF absolutePoint = g.GetAbsolutePoint(gauge.PivotPoint); float absoluteDimension4 = g.GetAbsoluteDimension(num2); float num8 = startAngle * (float)Math.PI / 180f; float num9 = (360f - startAngle - num7) * (float)Math.PI / 180f; PointF pointF = default(PointF); pointF.X = absolutePoint.X - absoluteDimension4 * (float)Math.Sin(num8); pointF.Y = absolutePoint.Y + absoluteDimension4 * (float)Math.Cos(num8); PointF pointF2 = default(PointF); pointF2.X = absolutePoint.X + absoluteDimension4 * (float)Math.Sin(num9); pointF2.Y = absolutePoint.Y + absoluteDimension4 * (float)Math.Cos(num9); RectangleF rect = new RectangleF(pointF.X, pointF.Y, 0f, 0f); rect.Inflate(absoluteDimension, absoluteDimension); RectangleF rect2 = new RectangleF(pointF2.X, pointF2.Y, 0f, 0f); rect2.Inflate(absoluteDimension, absoluteDimension); RectangleF rect3 = new RectangleF(absolutePoint.X, absolutePoint.Y, 0f, 0f); rect3.Inflate(absoluteDimension + num3, absoluteDimension + num3); RectangleF rect4 = new RectangleF(absolutePoint.X, absolutePoint.Y, 0f, 0f); rect4.Inflate(absoluteDimension4 + absoluteDimension, absoluteDimension4 + absoluteDimension); if (num7 < 270f) { path.AddArc(rect, startAngle + 270f + 90f, 90f); path.AddArc(rect4, startAngle + 90f, num7); path.AddArc(rect2, startAngle + num7 + 90f, 90f); path.AddArc(rect3, startAngle + num7 + 90f + 45f, 360f - num7 - 90f); } else if (num7 >= 320f) { path.AddEllipse(rect4); } else { float num10 = 90f - (360f - num7) / 2f; path.AddArc(rect, startAngle + 270f + 90f + num10, 90f - num10); path.AddArc(rect4, startAngle + 90f, num7); path.AddArc(rect2, startAngle + num7 + 90f, 90f - num10); } path.CloseFigure(); }
internal GraphicsPath GetFramePath(GaugeGraphics g, float shrinkBy) { RectangleF frameRectangle = GetFrameRectangle(g); float absoluteDimension = g.GetAbsoluteDimension(shrinkBy); frameRectangle.Inflate(0f - absoluteDimension, 0f - absoluteDimension); if (shrinkBy > 0f) { frameRectangle.Inflate(1f, 1f); } if (FrameShape == BackFrameShape.Circular) { GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.AddEllipse(frameRectangle); return(graphicsPath); } if (FrameShape == BackFrameShape.AutoShape) { GraphicsPath graphicsPath2 = new GraphicsPath(); if (Parent is CircularGauge) { CircularGauge circularGauge = (CircularGauge)Parent; if (circularGauge.Scales.Count == 0) { graphicsPath2.AddEllipse(frameRectangle); } else { BuildCircularGaugeAutoFrame(g, graphicsPath2, circularGauge, shrinkBy); } } else { graphicsPath2.AddRectangle(frameRectangle); } return(graphicsPath2); } if (FrameShape != BackFrameShape.RoundedRectangular) { if (FrameShape == BackFrameShape.Rectangular) { GraphicsPath graphicsPath3 = new GraphicsPath(); graphicsPath3.AddRectangle(frameRectangle); return(graphicsPath3); } GraphicsPath graphicsPath4 = new GraphicsPath(); graphicsPath4.FillMode = FillMode.Winding; XamlRenderer cachedXamlRenderer = GetCachedXamlRenderer(g); graphicsPath4.AddPath(cachedXamlRenderer.Layers[0].Paths[0], connect: false); return(graphicsPath4); } float num = (!(frameRectangle.Width > frameRectangle.Height)) ? frameRectangle.Width : frameRectangle.Height; float num2 = num / 8f; float[] array = new float[10]; for (int i = 0; i < 10; i++) { array[i] = num2; } return(g.CreateRoundedRectPath(frameRectangle, array)); }
internal void RenderGlassEffect(GaugeGraphics g) { if (GlassEffect == GlassEffect.None || FrameStyle == BackFrameStyle.None) { return; } if (IsCustomXamlFrame()) { GetCachedXamlRenderer(g).Layers[2].Render(g); return; } RectangleF bounds; using (GraphicsPath graphicsPath = GetFramePath(g, FrameWidth - 1f)) { bounds = graphicsPath.GetBounds(); using (Brush brush = new LinearGradientBrush(bounds, Color.FromArgb(15, Color.Black), Color.FromArgb(128, Color.Black), LinearGradientMode.ForwardDiagonal)) { if (bounds.Height > 0f && bounds.Width > 0f) { g.FillPath(brush, graphicsPath); } } } if (FrameShape == BackFrameShape.Rectangular || FrameShape == BackFrameShape.RoundedRectangular) { _ = g.GetAbsoluteSize(new SizeF(8f, 0f)).Width; GraphicsPath graphicsPath2 = new GraphicsPath(); float absoluteDimension = g.GetAbsoluteDimension(30f); float absoluteDimension2 = g.GetAbsoluteDimension(10f); float absoluteDimension3 = g.GetAbsoluteDimension(50f); float absoluteDimension4 = g.GetAbsoluteDimension(5f); g.GetAbsoluteDimension(30f); g.GetAbsoluteDimension(5f); PointF[] points = new PointF[4] { new PointF(bounds.X, bounds.Y + absoluteDimension), new PointF(bounds.X + absoluteDimension, bounds.Y), new PointF(bounds.X + absoluteDimension + absoluteDimension2, bounds.Y), new PointF(bounds.X, bounds.Y + absoluteDimension + absoluteDimension2) }; PointF[] points2 = new PointF[4] { new PointF(bounds.X, bounds.Y + absoluteDimension3), new PointF(bounds.X + absoluteDimension3, bounds.Y), new PointF(bounds.X + absoluteDimension3 + absoluteDimension4, bounds.Y), new PointF(bounds.X, bounds.Y + absoluteDimension3 + absoluteDimension4) }; graphicsPath2.AddPolygon(points); graphicsPath2.AddPolygon(points2); Brush brush2 = new SolidBrush(Color.FromArgb(148, Color.White)); g.FillPath(brush2, graphicsPath2); } else if ((FrameShape == BackFrameShape.Circular || FrameShape == BackFrameShape.AutoShape) && GlassEffect == GlassEffect.Simple) { float absoluteDimension5 = g.GetAbsoluteDimension(15f); bounds.X += absoluteDimension5; bounds.Y += absoluteDimension5; bounds.Width -= absoluteDimension5 * 2f; bounds.Height -= absoluteDimension5 * 2f; GraphicsPath circularRangePath = g.GetCircularRangePath(g.GetRelativeRectangle(bounds), 226f, 30f, 6f, 6f, Placement.Inside); GraphicsPath circularRangePath2 = g.GetCircularRangePath(g.GetRelativeRectangle(bounds), 224f, -30f, 6f, 6f, Placement.Inside); Brush brush3 = new SolidBrush(Color.FromArgb(200, Color.White)); g.FillPath(brush3, circularRangePath); g.FillPath(brush3, circularRangePath2); } }