Exemplo n.º 1
0
        public ImageSource GenerateBmp(int rows, int cols, Color color)
        {
            BmpMaker bmpMaker = new BmpMaker(rows, cols);

            //background color to white
            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    bmpMaker.SetPixel(i, j, Color.White);
                }
            }
            //draw a square
            int marginX = rows / 10;
            int marginY = cols / 10;

            for (int row = marginX; row < (rows - marginX); row++)
            {
                for (int col = marginY; col < (cols - marginY); col++)
                {
                    bmpMaker.SetPixel(row, col, color);
                }
            }
            ImageSource resultImage = bmpMaker.Generate();

            return(resultImage);
        }
Exemplo n.º 2
0
		public ImageSource GenerateBmp (int rows, int cols, Color color)
		{
			BmpMaker bmpMaker = new BmpMaker (rows, cols);
			//background color to white
			for (int i = 0; i < rows; i++) {
				for (int j = 0; j < cols; j++) {
					bmpMaker.SetPixel (i, j, Color.White);
				}
			}
			//draw a square
			int marginX = rows / 10;
			int marginY = cols / 10;
			for (int row = marginX; row < (rows - marginX); row++) {
				for (int col = marginY; col < (cols - marginY); col++) {
					bmpMaker.SetPixel (row, col, color);
				}
			}
			ImageSource resultImage = bmpMaker.Generate ();
			return resultImage;
		}