Exemplo n.º 1
0
        private void loadBackgroundImage(String filename)
        {
            if (File.Exists(filename))
            {
                Bitmap background = new Bitmap(filename);
                Byte[] back_bmp   = new Byte[background.Width * background.Height * 3];
                BitmapArrayConversions.updatebitmapslow(background, back_bmp);
                background_bmp = new Byte[global_variables.standard_width * global_variables.standard_height * 3];

                int n = 0;
                for (int y = 0; y < global_variables.standard_height; y++)
                {
                    int yy = y * background.Height / global_variables.standard_height;
                    for (int x = 0; x < global_variables.standard_width; x++)
                    {
                        int xx = x * background.Width / global_variables.standard_width;
                        int n2 = ((yy * background.Width) + xx) * 3;
                        for (int c = 0; c < 3; c++)
                        {
                            background_bmp[n] = back_bmp[n2 + c];
                            n++;
                        }
                    }
                }
            }
        }