Example #1
0
        public void Render(int w, int h)
        {
            if (ReferenceEquals(mBitmap, null))
            {
                w       = 8;
                h       = 16;
                mBitmap = new DirectBitmap(w, h);
                w4s     = w * 4;

                for (int y = 0; y <= h - 1; y++)
                {
                    for (int x = 0; x <= w - 1; x++)
                    {
                        if (FontBitmaps[CGAChar * w * h + y * w + x] == 1)
                        {
                            mBitmap.set_Pixel(x, y, ForeColor);
                        }
                        else
                        {
                            mBitmap.set_Pixel(x, y, BackColor);
                        }
                    }
                }
            }
        }
Example #2
0
 public static void FillRectangle(this DirectBitmap dbmp, Color c, int x, int y, int w, int h)
 {
     for (int y1 = y; y1 <= y + h - 1; y1++)
     {
         for (int x1 = x; x1 <= x + w - 1; x1++)
         {
             dbmp.set_Pixel(x1, y1, c);
         }
     }
 }
Example #3
0
        public static void DrawLine(this DirectBitmap dbmp, Color c, int x1, int y1, int x2, int y2)
        {
            int    dx = x2 - x1;
            int    dy = y2 - y1;
            int    l  = (int)(Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)));
            double a  = Math.Atan2(dy, dx);

            for (int r = 0; r <= l; r++)
            {
                dbmp.set_Pixel((int)(x1 + r * Math.Cos(System.Convert.ToDouble(-a))), (int)(y1 + r * Math.Sin(a)), c);
            }
        }