コード例 #1
0
        /*
         * Sets the color of the pixel at the input point to the input color
         */
        public void ColorPixel(int x, int y, Color color)
        {
            try
            {
                // Color a pixel on the grid representation
                Grid.DrawToGrid(x, y, color);

                // tell the animator to update this frame, currently borked
                //MainWindow.Instance.GetAnimationPane().GetAnimationPreview().animation[frame - 1] = Grid.DisplayMap;
            }
            catch (IndexOutOfRangeException ex)
            {
                // no op
            }
        }
コード例 #2
0
        public void DrawToGridTest()
        {
            DrawingGrid grid = new DrawingGrid(20, 20, 1);

            // Select a random location and color
            Random r = new Random();
            int    x = r.Next(20);
            int    y = r.Next(20);
            Color  c = Color.FromArgb(255, Color.FromArgb(r.Next()));

            // Color that pixel
            grid.DrawToGrid(x, y, c);

            // Get the new bitmap of the grid
            Bitmap newBmp = grid.DisplayMap;

            // Verify that the pixel specified got colored correctly
            AreEqual(newBmp.GetPixel(x, y), c);
        }