示例#1
0
        public unsafe void RenderCharacter(IDrawingContext ctx, char c, DisplayPixel color)
        {
            //Make sure we have this
            if (!font.ContainsKey(c))
            {
                return;
            }

            //Get lines
            byte[] data = font[c];

            //Copy
            for (int y = 0; y < height; y++)
            {
                //Get pointer and offset
                DisplayPixel *line   = ctx.GetPixelPointer(0, y);
                int           offset = width * y;

                //Transfer
                for (int x = 0; x < width; x++)
                {
                    //Cheap out
                    if (data[offset + x] == byte.MaxValue)
                    {
                        line[x] = color;
                    }
                    else if (data[offset + x] == 0)
                    {
                        continue;
                    }

                    //Mix
                    DisplayPixel.Mix(&color, line + x, data[offset + x] / 255f, line + x);
                }
            }
        }