Esempio n. 1
0
        public void Draw(BGICanvas bgi, float x, float y, BGICanvas.Direction dir, int size, IList <Rectangle> updates)
        {
            var drawUpdates = updates ?? new List <Rectangle> ();

            var height = font.Height * scaleup [size] / scaledown [size];

            if (dir == BGICanvas.Direction.Horizontal)
            {
                foreach (var stroke in strokes)
                {
                    int curx = (int)x + (stroke.x * scaleup [size] / scaledown [size]);
                    int cury = (int)y + height - (stroke.y * scaleup [size] / scaledown [size]);

                    if (stroke.type == StrokeType.MoveTo)
                    {
                        bgi.MoveTo(curx, cury);
                    }
                    else if (stroke.type == StrokeType.LineTo)
                    {
                        bgi.LineTo(curx, cury, drawUpdates);
                    }
                }
            }
            else
            {
                foreach (var stroke in strokes)
                {
                    int curx = (int)x + height - (stroke.y * scaleup [size] / scaledown [size]);
                    int cury = (int)y - (stroke.x * scaleup [size] / scaledown [size]);

                    if (stroke.type == StrokeType.MoveTo)
                    {
                        bgi.MoveTo(curx, cury);
                    }
                    else if (stroke.type == StrokeType.LineTo)
                    {
                        bgi.LineTo(curx, cury, drawUpdates);
                    }
                }
            }
            if (updates == null)
            {
                bgi.UpdateRegion(drawUpdates);
            }
        }