Beispiel #1
0
        internal static GraphicsPath GetSymbol14(char symbol, PointF point, float size, bool decDot, bool comma, bool sepDots, SegmentsCache cache)
        {
            LEDSegment14 lEDSegment = LEDSegment14.Empty;

            if (char.IsDigit(symbol))
            {
                lEDSegment = (LEDSegment14)Enum.Parse(typeof(LEDSegment14), "N" + symbol);
            }
            else
            {
                switch (symbol)
                {
                case ' ':
                    lEDSegment = LEDSegment14.Empty;
                    break;

                case '-':
                    lEDSegment = LEDSegment14.SG;
                    break;

                case '+':
                    lEDSegment = LEDSegment14.Plus;
                    break;

                case '$':
                    lEDSegment = LEDSegment14.CDollar;
                    break;

                default:
                    try
                    {
                        lEDSegment = (LEDSegment14)Enum.Parse(typeof(LEDSegment14), "C" + symbol);
                    }
                    catch
                    {
                        lEDSegment = LEDSegment14.Unknown;
                    }
                    break;
                }
            }
            if (decDot)
            {
                lEDSegment |= LEDSegment14.SDP;
            }
            if (comma)
            {
                lEDSegment |= LEDSegment14.SComma;
            }
            return(GetOrientedSegments(lEDSegment, point, size, cache));
        }
Beispiel #2
0
        internal static GraphicsPath GetOrientedSegments(LEDSegment14 segments, PointF point, float size, SegmentsCache cache)
        {
            GraphicsPath graphicsPath = cache.GetSegment(segments, point, size);

            if (graphicsPath == null)
            {
                graphicsPath = 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(segments, graphicsPath, point, size);
            }
            return(graphicsPath);
        }