public static GraphicsPath GetSymbol7(char symbol, PointF point, float size, bool decDot, bool comma, bool sepDots, SegmentsCache cache) { LEDSegment7 lEDSegment = LEDSegment7.Empty; if (char.IsDigit(symbol)) { lEDSegment = (LEDSegment7)Enum.Parse(typeof(LEDSegment7), "N" + symbol); } else { switch (symbol) { case '-': lEDSegment = LEDSegment7.SG; break; case ' ': lEDSegment = LEDSegment7.Empty; break; case '+': lEDSegment = LEDSegment7.Empty; break; default: try { lEDSegment = (LEDSegment7)Enum.Parse(typeof(LEDSegment7), "C" + symbol); } catch { lEDSegment = LEDSegment7.Unknown; } break; } } if (decDot) { lEDSegment |= LEDSegment7.SDP; } if (comma) { lEDSegment |= LEDSegment7.SComma; } return(DigitalSegment.GetOrientedSegments(lEDSegment, point, size, cache)); }
public static GraphicsPath GetOrientedSegments(LEDSegment7 segments, PointF point, float size, SegmentsCache cache) { GraphicsPath graphicsPath = cache.GetSegment((Enum)(object)segments, point, size); if (graphicsPath == null) { graphicsPath = DigitalSegment.GetSegments(segments, point, size); using (Matrix matrix = new Matrix()) { matrix.Shear(-0.0618034f, 0f); graphicsPath.Transform(matrix); matrix.Reset(); matrix.Translate(point.X, point.Y); graphicsPath.Transform(matrix); matrix.Reset(); } cache.SetSegment((Enum)(object)segments, graphicsPath, point, size); } return(graphicsPath); }
private static GraphicsPath GetSegment7(LEDSegment7 segment, PointF p, float size) { GraphicsPath graphicsPath = new GraphicsPath(); SizeF sizeF = new SizeF((float)(size * 0.6180340051651001), size); float num = (float)(sizeF.Width * 0.1428571492433548); SizeF s = new SizeF(sizeF.Width - num, num); SizeF s2 = new SizeF((float)(sizeF.Height / 2.0 - num / 2.0), num); s.Width -= (float)(num / 3.0); s2.Width -= (float)(num / 3.0); if ((long)segment <= 16L) { if ((long)segment <= 4L) { if ((long)segment < 1L) { goto IL_04d0; } switch (segment - 1) { case LEDSegment7.Empty: graphicsPath.AddPolygon(DigitalSegment.GetSegment7(p, s)); graphicsPath.CloseAllFigures(); using (Matrix matrix3 = new Matrix()) { matrix3.Translate(0f, (float)((0.0 - sizeF.Height) / 2.0 + num / 2.0)); graphicsPath.Transform(matrix3); return(graphicsPath); } case LEDSegment7.SA | LEDSegment7.SB: graphicsPath.AddPolygon(DigitalSegment.GetSegment7(p, s2)); graphicsPath.CloseAllFigures(); using (Matrix matrix2 = new Matrix()) { matrix2.RotateAt(90f, p); graphicsPath.Transform(matrix2); matrix2.Reset(); matrix2.Translate((float)(sizeF.Width / 2.0 - num / 2.0), (float)(sizeF.Height / 4.0 - num / 4.0)); graphicsPath.Transform(matrix2); return(graphicsPath); } case LEDSegment7.SA: graphicsPath.AddPolygon(DigitalSegment.GetSegment7(p, s2)); graphicsPath.CloseAllFigures(); using (Matrix matrix = new Matrix()) { matrix.RotateAt(90f, p); graphicsPath.Transform(matrix); matrix.Reset(); matrix.Translate((float)(sizeF.Width / 2.0 - num / 2.0), (float)((0.0 - sizeF.Height) / 4.0 + num / 4.0)); graphicsPath.Transform(matrix); return(graphicsPath); } case LEDSegment7.SB: goto IL_04d0; } } switch (segment) { case LEDSegment7.SD: graphicsPath.AddPolygon(DigitalSegment.GetSegment7(p, s)); graphicsPath.CloseAllFigures(); using (Matrix matrix5 = new Matrix()) { matrix5.RotateAt(180f, p); graphicsPath.Transform(matrix5); matrix5.Reset(); matrix5.Translate(0f, (float)(sizeF.Height / 2.0 - num / 2.0)); graphicsPath.Transform(matrix5); return(graphicsPath); } case LEDSegment7.SE: graphicsPath.AddPolygon(DigitalSegment.GetSegment7(p, s2)); graphicsPath.CloseAllFigures(); using (Matrix matrix4 = new Matrix()) { matrix4.RotateAt(90f, p); graphicsPath.Transform(matrix4); matrix4.Reset(); matrix4.Translate((float)((0.0 - sizeF.Width) / 2.0 + num / 2.0), (float)(sizeF.Height / 4.0 - num / 4.0)); graphicsPath.Transform(matrix4); return(graphicsPath); } } } else { switch (segment) { case LEDSegment7.SG: graphicsPath.AddPolygon(DigitalSegment.GetSegment7(p, s)); graphicsPath.CloseAllFigures(); break; case LEDSegment7.SF: graphicsPath.AddPolygon(DigitalSegment.GetSegment7(p, s2)); graphicsPath.CloseAllFigures(); using (Matrix matrix8 = new Matrix()) { matrix8.RotateAt(90f, p); graphicsPath.Transform(matrix8); matrix8.Reset(); matrix8.Translate((float)((0.0 - sizeF.Width) / 2.0 + num / 2.0), (float)((0.0 - sizeF.Height) / 4.0 + num / 4.0)); graphicsPath.Transform(matrix8); return(graphicsPath); } case LEDSegment7.SDP: graphicsPath.AddEllipse(p.X, p.Y, (float)(num * 2.0), (float)(num * 2.0)); using (Matrix matrix7 = new Matrix()) { matrix7.Translate((float)(sizeF.Width / 2.0 + num / 2.0), (float)(sizeF.Height / 2.0 - num * 2.0)); graphicsPath.Transform(matrix7); return(graphicsPath); } case LEDSegment7.SComma: graphicsPath.AddRectangle(new RectangleF(p.X, p.Y, (float)(num * 2.0), (float)(num * 4.0))); using (Matrix matrix6 = new Matrix()) { matrix6.Translate((float)(sizeF.Width / 2.0 + num / 2.0), (float)(sizeF.Height / 2.0 - num * 2.0)); graphicsPath.Transform(matrix6); return(graphicsPath); } } } goto IL_04d0; IL_04d0: return(graphicsPath); }
public static GraphicsPath GetSegments(LEDSegment7 segments, PointF point, float size) { GraphicsPath graphicsPath = new GraphicsPath(); PointF p = new PointF(0f, 0f); if ((segments & LEDSegment7.SA) == LEDSegment7.SA) { using (GraphicsPath graphicsPath2 = DigitalSegment.GetSegment7(LEDSegment7.SA, p, size)) { if (graphicsPath2.PointCount > 0) { graphicsPath.AddPath(graphicsPath2, false); } } } if ((segments & LEDSegment7.SB) == LEDSegment7.SB) { using (GraphicsPath graphicsPath3 = DigitalSegment.GetSegment7(LEDSegment7.SB, p, size)) { if (graphicsPath3.PointCount > 0) { graphicsPath.AddPath(graphicsPath3, false); } } } if ((segments & LEDSegment7.SC) == LEDSegment7.SC) { using (GraphicsPath graphicsPath4 = DigitalSegment.GetSegment7(LEDSegment7.SC, p, size)) { if (graphicsPath4.PointCount > 0) { graphicsPath.AddPath(graphicsPath4, false); } } } if ((segments & LEDSegment7.SD) == LEDSegment7.SD) { using (GraphicsPath graphicsPath5 = DigitalSegment.GetSegment7(LEDSegment7.SD, p, size)) { if (graphicsPath5.PointCount > 0) { graphicsPath.AddPath(graphicsPath5, false); } } } if ((segments & LEDSegment7.SE) == LEDSegment7.SE) { using (GraphicsPath graphicsPath6 = DigitalSegment.GetSegment7(LEDSegment7.SE, p, size)) { if (graphicsPath6.PointCount > 0) { graphicsPath.AddPath(graphicsPath6, false); } } } if ((segments & LEDSegment7.SF) == LEDSegment7.SF) { using (GraphicsPath graphicsPath7 = DigitalSegment.GetSegment7(LEDSegment7.SF, p, size)) { if (graphicsPath7.PointCount > 0) { graphicsPath.AddPath(graphicsPath7, false); } } } if ((segments & LEDSegment7.SG) == LEDSegment7.SG) { using (GraphicsPath graphicsPath8 = DigitalSegment.GetSegment7(LEDSegment7.SG, p, size)) { if (graphicsPath8.PointCount > 0) { graphicsPath.AddPath(graphicsPath8, false); } } } if ((segments & LEDSegment7.SDP) == LEDSegment7.SDP) { using (GraphicsPath graphicsPath9 = DigitalSegment.GetSegment7(LEDSegment7.SDP, p, size)) { if (graphicsPath9.PointCount > 0) { graphicsPath.AddPath(graphicsPath9, false); } } } if ((segments & LEDSegment7.SComma) == LEDSegment7.SComma) { using (GraphicsPath graphicsPath10 = DigitalSegment.GetSegment7(LEDSegment7.SComma, p, size)) { if (graphicsPath10.PointCount > 0) { graphicsPath.AddPath(graphicsPath10, false); return(graphicsPath); } return(graphicsPath); } } return(graphicsPath); }
private static GraphicsPath GetSegment7(LEDSegment7 segment, PointF p, float size) { GraphicsPath graphicsPath = new GraphicsPath(); SizeF sizeF = new SizeF(size * 0.618034f, size); float num = sizeF.Width * 0.142857149f; SizeF s = new SizeF(sizeF.Width - num, num); SizeF s2 = new SizeF(sizeF.Height / 2f - num / 2f, num); s.Width -= num / 3f; s2.Width -= num / 3f; switch (segment) { case LEDSegment7.Empty: case LEDSegment7.SA: case LEDSegment7.SB: case LEDSegment7.SA | LEDSegment7.SB: case LEDSegment7.SC: case LEDSegment7.SA | LEDSegment7.SC: case LEDSegment7.N1: case LEDSegment7.N7: case LEDSegment7.SD: case LEDSegment7.SA | LEDSegment7.SD: case LEDSegment7.SB | LEDSegment7.SD: case LEDSegment7.SA | LEDSegment7.SB | LEDSegment7.SD: case LEDSegment7.SC | LEDSegment7.SD: case LEDSegment7.SA | LEDSegment7.SC | LEDSegment7.SD: case LEDSegment7.SB | LEDSegment7.SC | LEDSegment7.SD: case LEDSegment7.SA | LEDSegment7.SB | LEDSegment7.SC | LEDSegment7.SD: case LEDSegment7.SE: { LEDSegment7 num2 = segment - 1; if (num2 <= (LEDSegment7.SA | LEDSegment7.SB)) { switch (num2) { case LEDSegment7.Empty: { graphicsPath.AddPolygon(GetSegment7(p, s)); graphicsPath.CloseAllFigures(); using (Matrix matrix6 = new Matrix()) { matrix6.Translate(0f, (0f - sizeF.Height) / 2f + num / 2f); graphicsPath.Transform(matrix6); return(graphicsPath); } } case LEDSegment7.SA | LEDSegment7.SB: { graphicsPath.AddPolygon(GetSegment7(p, s2)); graphicsPath.CloseAllFigures(); using (Matrix matrix5 = new Matrix()) { matrix5.RotateAt(90f, p); graphicsPath.Transform(matrix5); matrix5.Reset(); matrix5.Translate(sizeF.Width / 2f - num / 2f, sizeF.Height / 4f - num / 4f); graphicsPath.Transform(matrix5); return(graphicsPath); } } case LEDSegment7.SA: { graphicsPath.AddPolygon(GetSegment7(p, s2)); graphicsPath.CloseAllFigures(); using (Matrix matrix4 = new Matrix()) { matrix4.RotateAt(90f, p); graphicsPath.Transform(matrix4); matrix4.Reset(); matrix4.Translate(sizeF.Width / 2f - num / 2f, (0f - sizeF.Height) / 4f + num / 4f); graphicsPath.Transform(matrix4); return(graphicsPath); } } case LEDSegment7.SB: goto end_IL_007f; } } switch (segment) { case LEDSegment7.SD: { graphicsPath.AddPolygon(GetSegment7(p, s)); graphicsPath.CloseAllFigures(); using (Matrix matrix8 = new Matrix()) { matrix8.RotateAt(180f, p); graphicsPath.Transform(matrix8); matrix8.Reset(); matrix8.Translate(0f, sizeF.Height / 2f - num / 2f); graphicsPath.Transform(matrix8); return(graphicsPath); } } case LEDSegment7.SE: { graphicsPath.AddPolygon(GetSegment7(p, s2)); graphicsPath.CloseAllFigures(); using (Matrix matrix7 = new Matrix()) { matrix7.RotateAt(90f, p); graphicsPath.Transform(matrix7); matrix7.Reset(); matrix7.Translate((0f - sizeF.Width) / 2f + num / 2f, sizeF.Height / 4f - num / 4f); graphicsPath.Transform(matrix7); return(graphicsPath); } } } break; } case LEDSegment7.SG: graphicsPath.AddPolygon(GetSegment7(p, s)); graphicsPath.CloseAllFigures(); break; case LEDSegment7.SF: { graphicsPath.AddPolygon(GetSegment7(p, s2)); graphicsPath.CloseAllFigures(); using (Matrix matrix3 = new Matrix()) { matrix3.RotateAt(90f, p); graphicsPath.Transform(matrix3); matrix3.Reset(); matrix3.Translate((0f - sizeF.Width) / 2f + num / 2f, (0f - sizeF.Height) / 4f + num / 4f); graphicsPath.Transform(matrix3); return(graphicsPath); } } case LEDSegment7.SDP: { graphicsPath.AddEllipse(p.X, p.Y, num * 2f, num * 2f); using (Matrix matrix2 = new Matrix()) { matrix2.Translate(sizeF.Width / 2f + num / 2f, sizeF.Height / 2f - num * 2f); graphicsPath.Transform(matrix2); return(graphicsPath); } } case LEDSegment7.SComma: { graphicsPath.AddRectangle(new RectangleF(p.X, p.Y, num * 2f, num * 4f)); using (Matrix matrix = new Matrix()) { matrix.Translate(sizeF.Width / 2f + num / 2f, sizeF.Height / 2f - num * 2f); graphicsPath.Transform(matrix); return(graphicsPath); } } end_IL_007f: break; } return(graphicsPath); }
internal static GraphicsPath GetSegments(LEDSegment7 segments, PointF point, float size) { GraphicsPath graphicsPath = new GraphicsPath(); PointF p = new PointF(0f, 0f); if ((segments & LEDSegment7.SA) == LEDSegment7.SA) { using (GraphicsPath graphicsPath2 = GetSegment7(LEDSegment7.SA, p, size)) { if (graphicsPath2.PointCount > 0) { graphicsPath.AddPath(graphicsPath2, connect: false); } } } if ((segments & LEDSegment7.SB) == LEDSegment7.SB) { using (GraphicsPath graphicsPath3 = GetSegment7(LEDSegment7.SB, p, size)) { if (graphicsPath3.PointCount > 0) { graphicsPath.AddPath(graphicsPath3, connect: false); } } } if ((segments & LEDSegment7.SC) == LEDSegment7.SC) { using (GraphicsPath graphicsPath4 = GetSegment7(LEDSegment7.SC, p, size)) { if (graphicsPath4.PointCount > 0) { graphicsPath.AddPath(graphicsPath4, connect: false); } } } if ((segments & LEDSegment7.SD) == LEDSegment7.SD) { using (GraphicsPath graphicsPath5 = GetSegment7(LEDSegment7.SD, p, size)) { if (graphicsPath5.PointCount > 0) { graphicsPath.AddPath(graphicsPath5, connect: false); } } } if ((segments & LEDSegment7.SE) == LEDSegment7.SE) { using (GraphicsPath graphicsPath6 = GetSegment7(LEDSegment7.SE, p, size)) { if (graphicsPath6.PointCount > 0) { graphicsPath.AddPath(graphicsPath6, connect: false); } } } if ((segments & LEDSegment7.SF) == LEDSegment7.SF) { using (GraphicsPath graphicsPath7 = GetSegment7(LEDSegment7.SF, p, size)) { if (graphicsPath7.PointCount > 0) { graphicsPath.AddPath(graphicsPath7, connect: false); } } } if ((segments & LEDSegment7.SG) == LEDSegment7.SG) { using (GraphicsPath graphicsPath8 = GetSegment7(LEDSegment7.SG, p, size)) { if (graphicsPath8.PointCount > 0) { graphicsPath.AddPath(graphicsPath8, connect: false); } } } if ((segments & LEDSegment7.SDP) == LEDSegment7.SDP) { using (GraphicsPath graphicsPath9 = GetSegment7(LEDSegment7.SDP, p, size)) { if (graphicsPath9.PointCount > 0) { graphicsPath.AddPath(graphicsPath9, connect: false); } } } if ((segments & LEDSegment7.SComma) == LEDSegment7.SComma) { using (GraphicsPath graphicsPath10 = GetSegment7(LEDSegment7.SComma, p, size)) { if (graphicsPath10.PointCount <= 0) { return(graphicsPath); } graphicsPath.AddPath(graphicsPath10, connect: false); return(graphicsPath); } } return(graphicsPath); }