Exemplo n.º 1
0
        public Grid(int width, int height)
        {
            Width = width;
            Height = height;

            _grid = new Color[Height, Width];
        }
Exemplo n.º 2
0
 public HeightMapper(int width, int height, Color[,] pixels, string heightMode)
 {
     this.width = width;
     this.height = height;
     this.pixels = pixels;
     this.heightMode = heightMode;
 }
Exemplo n.º 3
0
    public void DrawNewMap(Texture2D map)
    {
        Color[] fullPixels = map.GetPixels();

        currentMapPixels = ConvertColorArrayToMulti(fullPixels, map.height, map.width);
        DrawMap();
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        rows = new string[10];
        cols = new string[10];

        rows[0] = "1.1";
        rows[1] = "2";
        rows[2] = "3.1";
        rows[3] = "5.5";
        rows[4] = "6";
        rows[5] = "1.3";
        rows[6] = "4.1";
        rows[7] = "1";
        rows[8] = "1";
        rows[9] = "1";

        cols[0] = "1.1.1";
        cols[1] = "4.1";
        cols[2] = "2.2";
        cols[3] = "6";
        cols[4] = "1.3";
        cols[5] = "3";
        cols[6] = "1";
        cols[7] = "1";
        cols[8] = "4";
        cols[9] = "3.2";

        graph = new Color[rows.Length, cols.Length];

        solve();
        printGraph();
    }
Exemplo n.º 5
0
        Color[,] terrainColors; //= TextureTo2DArray(map);

        #endregion Fields

        #region Constructors

        public Player(Texture2D tex, Texture2D map)
        {
            location.X = 450;
            location.Y = 800;
            nextLocation = location;
            money = 2000;
            speed = 5;
            cityControl = 10;

            lastMoneyChange = 0;

            policeHeat = 0;

            jobSet = false;

            playerTexture = tex;

            terrainColors = Helpers.TextureTo2DArray(map);
            playerColors = Helpers.TextureTo2DArray(playerTexture);

            //add my NPCs in order listed in the enum so we can do some hacky stuff and use that to access them when we need them specifically.
            NPCs.Add(new DrugRecruiter());
            NPCs.Add(new GunRecruiter());
            NPCs.Add(new MuscleRecruiter());
            NPCs.Add(new HookerRecruiter());
            NPCs.Add(new SpecialstRecruiter());
            NPCs.Add(new jobBoard());
            NPCs.Add(new recruiter(NPCs));
        }
Exemplo n.º 6
0
		private void SetColors(Color[] boardColors)
		{
			colors = new Color[Width,Height];
			for (int x = 0; x < Width; x++)
				for (int y = 0; y < Height; y++)
					colors[x, y] = boardColors[y * Width + x];
		}
Exemplo n.º 7
0
        public GF3File(Stream stream)
        {
            BinaryReader r = new BinaryReader(stream);

            r.ReadInt32(); // Signature

            width = r.ReadInt32();
            height = r.ReadInt32();

            pixels = new Color[width, height];

            int channels = r.ReadByte();
            byte brk = r.ReadByte();

            byte[] blue_channel = ReadChannel(r, brk, width * height);
            byte[] green_channel = ReadChannel(r, brk, width * height);
            byte[] red_channel = ReadChannel(r, brk, width * height);
            byte[] alpha_channel = null;
            if (channels == 4)
            {
                alpha_channel = ReadChannel(r, brk, width * height);
                isTransparent = true;
            }

            for (int y = 0; y < height; y++)
                for (int x = 0; x < width; x++)
                    if (channels == 4)
                        pixels[x, height - y - 1] = Color.FromArgb(alpha_channel[width * y + x], red_channel[width * y + x], green_channel[width * y + x], blue_channel[width * y + x]);
                    else
                        pixels[x, height - y - 1] = Color.FromArgb(red_channel[width * y + x], green_channel[width * y + x], blue_channel[width * y + x]);

            r.Close();
        }
Exemplo n.º 8
0
        public OutputData(int width, int height)
        {
            this.width = width;
            this.height = height;

            data = new Color[width, height];
        }
Exemplo n.º 9
0
		public void Randomize()
		{
			colors = new Color[Width,Height];
			for (int x = 0; x < Width; x++)
				for (int y = 0; y < Height; y++)
					colors[x, y] = colorFactory.Generate(MinimumColorValue, MinimumColorInterval);
		}
Exemplo n.º 10
0
 private void InitImage()
 {
     width = this.Width;
     height = this.Height;
     image = new Color[width, height];
     bmp = new Bitmap(width, height);
 }
Exemplo n.º 11
0
 public override void Init(int rows, int columns)
 {
     base.Init(rows, columns);
     _GameGrid = new Color[rows, columns];
     GameActions.Where(action => action.Button == GameButton.Up).FirstOrDefault().Duration = 250;
     _Tetromino = new Tetromino(columns);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Construct the image object from image path
 /// </summary>
 /// <param name="imagePath"></param>
 public Image(string imagePath)
 {
     // TODO: Complete member initialization and constructs the bitmap image as well as the image matrix
     this._imagePath = imagePath;
     Bitmap bitmapImage = new Bitmap(imagePath);
     this._matrix = getImageMatrix(bitmapImage);
 }
Exemplo n.º 13
0
        //constructur used for complex creation
        public TextShow(Vector2 location, Color inside_color, Color[] border_colors, int[] border_widths, string font, string text, Color text_color, bool canBeDraged)
            : base(location, (int)Game.fonts[font].MeasureString(text).X + 8 + border_widths[0] + border_widths[2], (int)Game.fonts[font].MeasureString(text).Y + 8 + border_widths[1] + border_widths[3])

        {
            if(border_widths.Length != 4||border_colors.Length != 4)
            {
                throw new Exception();
            }
            complex = true;
            this.font = font;
            this.inside_color = inside_color;
            this.border_colors = border_colors;
            this.text_color = text_color;
            this.text = text;
            this.canBeDraged = canBeDraged;
            this.border_widths = border_widths;
            sprite_height = (int)Game.fonts[font].MeasureString(text).Y;
            sprite_length = (int)Game.fonts[font].MeasureString(text).X;


            data = new Color[width * height];
            data_to_convert = new Color[width, height];

            generateTextureComplex(border_widths, border_colors, inside_color);
        }
Exemplo n.º 14
0
 public AY_3_8900()
 {
     _displayMode = DisplayMode.ForegroundBackground_FGBG; // no idea if this should be the default
     _screenshotIndex = 0;
     _screenBuffer = new Color[196, 89];
     ClearScreenBuffer();
 }
 void FillBackground(Color color)
 {
     background = new Color[Height,Wigth];
     for (int i = 0; i < Height; i++)
         for (int j = 0; j < Wigth; j++)
             background[i, j] = color;
 }
Exemplo n.º 16
0
 protected Sprite(ISprite other)
 {
     _size = other.Size;
     _layout = new Color[_size.Width, _size.Height];
     for (int i = 0; i < _size.Width; i++)
         for (int j = 0; j < _size.Height; j++)
             _layout[i, j] = other[i, j];
 }
Exemplo n.º 17
0
 public void Create()
 {
     graphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
     ScreenSize = new Point((int)(graphicsDevice.Viewport.Width / pixelScale), (int)(graphicsDevice.Viewport.Height / pixelScale));
     screen = new Color[ScreenSize.X, ScreenSize.Y];
     zBuffer = new float[ScreenSize.X, ScreenSize.Y];
     DrawClear(Color.White);
     canvas = new Texture2D(graphicsDevice, ScreenSize.X, ScreenSize.Y);
 }
Exemplo n.º 18
0
 void DoWork(object sender, DoWorkEventArgs e)
 {
     double w, h;
     w = (double)parameters["Width"].value;
     h = (double)parameters["Height"].value;
     int hf =(int)( ImageStream.CurrentImage.Height - h);
     int wf = (int)(ImageStream.CurrentImage.Width - w);
     resizedImage = ContentAwareResize.seamCarving_resize(ImageMatrix, hf, wf, (BackgroundWorker)sender);
 }
Exemplo n.º 19
0
 // Actual number of pendants
 public AnimationFrame()
 {
     m_Lights = new Color[Dome.NUM_RIBS, Dome.LEDS_PER_RIB];
     m_Lights.Initialize();
     m_Pendants = new Color[Dome.NUM_PENDANTS_MAX, Dome.LEDS_PER_PENDANT_MAX];
     m_Pendants.Initialize();
     m_Satellites = new Color[Dome.NUM_SATELLITES, Dome.LEDS_PER_SATELLITE];
     m_Satellites.Initialize();
 }
Exemplo n.º 20
0
        private void btn_apply_gamma_Click(object sender, EventArgs e)
        {
            PixelOperations gamma = new PixelOperations();
            b = (Bitmap)ControlTab.SelectedTab.BackgroundImage;
            final_image = gamma.Gamma(p.Buffering(b), (double)numericUpDown_gamma.Value);

            b = p.convert_Buffer_to_Bitmap(final_image, final_image.GetLength(0), final_image.GetLength(1));

            ControlTab.SelectedTab.BackgroundImage = b;
        }
Exemplo n.º 21
0
        public Sprite(Size size)
        {
            _size = size;
            _layout = new Color[size.Width, size.Height];

            // just ot ensure
            for (int i = 0; i < _size.Width; i++)
                for (int j = 0; j < _size.Height; j++)
                    _layout[i,j] = Color.Transparent;
        }
Exemplo n.º 22
0
 public Grid(int width = 128, int height = 128)
 {
     if (width < 1)
         width = 1;
     if (height < 1)
         height = 1;
     gridArray = new Color[width+1, height+1];
     gridWidth = width;
     gridHeight = height;
     gridPositions = new Vector2[gridColumns,gridLines];
 }
Exemplo n.º 23
0
 public PixelData(int width, int height)
 {
     this.Width = width;
     this.Height = height;
     Data = new Color[width, height];
     for (int x = 0; x < width; x++) {
         for (int y = 0; y < height; y++) {
             Data[x, y] = Color.White;
         }
     }
 }
 public Puzzle(Button[,] bottons)
 {
     Colors = new Color[3, 3];
     for (int i = 0; i < 3; i++)
     {
         for (int j = 0; j < 3; j++)
         {
             Colors[i, j] = bottons[i, j].BackColor;
         }
     }
 }
Exemplo n.º 25
0
 public Picture(Color defaultColor, int width, int height)
 {
     _pixels = new Color[width, height];
     for (int x = 0; x < width; ++x)
     {
         for (int y = 0; y < height; ++y)
         {
             _pixels[x, y] = defaultColor;
         }
     }
 }
Exemplo n.º 26
0
    TimeSpan timelimit; //De tijdlimiet van hoe lang een blokje stil mag blijven staan

    #endregion Fields

    #region Constructors

    public TetrisBlock(Texture2D sprite, ContentManager Content)
    {
        this.sprite = sprite;
        blockForm = new Color[4, 4];
        currentBlockForm = new Color[4, 4];
        for (int i = 0; i < 4; i++)
            for (int j = 0; j < 4; j++)
                blockForm[i, j] = Color.White;
        timelimit = TimeSpan.FromSeconds(0.9);
        fullrow = Content.Load<SoundEffect>("FullRow");
        blockFormPosition = new Vector2(5 * TetrisGrid.cellwidth, 0);   //Startpositie van het blokje
    }
Exemplo n.º 27
0
        public Grid(int width, int height)
        {
            this.width = width;
            this.height = height;
            grid = new Color[width, height]; //white 1x1 element: empty, !white: 1x1 element: not empty

            for (int x = 0; x < width; x++)
                for (int y = 0; y < height; y++)
                    grid[x, y] = Color.White;

            gridTexture = MediaManager.GetSprite("block");
        }
    void Awake()
    {
        //creates the array to reference tiles
        tiles = new GameObject[boardWidth, boardHeight];
        tileLocations = new Vector3[boardWidth,boardHeight];
        tileColors = new Color [boardWidth, boardHeight];
        GameObject border;
        //creates the board and stores each tile within the array
        for (int x = 0; x<boardWidth; x++)
        {

            border = (GameObject) Instantiate(vertBorder, new Vector3 (x * 3 + 1.5F, 10.5F, -1), Quaternion.identity);
            border.transform.parent = borderParent.transform;
            border = (GameObject) Instantiate(horBorder, new Vector3 (10.5F, x*3 + 1.5F, -1), Quaternion.identity);
            border.transform.parent = borderParent.transform;
            for (int y = 0; y < boardHeight; y++)
            {
                tiles [x,y] = (GameObject) Instantiate(tileCube, new Vector3 (x *3, y * 3, 0), Quaternion.identity);
                tiles [x,y].transform.parent = tileParent.transform;
                (tiles [x,y].GetComponent("Halo") as Behaviour).enabled = false;
                tileLocations [x,y] = tiles[x,y].transform.position;
           			    pieceLocation = tiles[x,y].GetComponent<positionScript>();
                pieceLocation.xPos = x;
                pieceLocation.yPos = y;
                tileColors [x,y] = Color.white;
                tiles[x,y].tag = "No Piece";

            }
        }
        border = (GameObject) Instantiate(vertBorder, new Vector3 (-1.5F, 10.5F, -1), Quaternion.identity);
        border.transform.parent = borderParent.transform;
        border = (GameObject) Instantiate(horBorder, new Vector3 (10.5F, -1.5F, -1), Quaternion.identity);
        border.transform.parent = borderParent.transform;
        //turns the even squares black
        for (int x = 1; x<boardWidth; x+=2)
        {
            for (int y = 1; y < boardHeight; y+=2)
            {
                tiles [x,y].transform.renderer.material.color = Color.black;
                tileColors [x,y] = Color.black;
            }
        }

        //turns the odd squares black
        for (int x = 0; x<boardWidth; x+=2)
        {
            for (int y = 0; y < boardHeight; y+=2)
            {
                tiles [x,y].transform.renderer.material.color = Color.black;
                tileColors [x,y] = Color.black;
            }
        }
    }
Exemplo n.º 29
0
	public BlockLayer(LayerBlendMode b) {
		colorMap = new Color[BlockEditor.textureSize, BlockEditor.textureSize];
		blendMode = b;

		//Temp
		for (int x = 0; x < colorMap.GetLength(0); x++) {
			for (int y = 0; y < colorMap.GetLength(1); y++) {
				//colorMap[x, y] = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f));
				colorMap[x, y] = new Color(0f, 0f, 0f, 0f);
			}
		}
	}
Exemplo n.º 30
0
        public Sprite(Color fillColor, int[,] layout)
        {
            if (layout == null)
                throw new ArgumentNullException("layout");

            _size = new Size(layout.GetLength(0), layout.GetLength(1));
            _layout = new Color[_size.Width, _size.Height];

            for (int i = 0; i < _size.Width; i++)
                for (int j = 0; j < _size.Height; j++)
                    _layout[i, j] = layout[i, j] != 0 ? fillColor : Color.Transparent;
        }
Exemplo n.º 31
0
 public static Color[] CreateRectangularBorder(Color[] colorData1D, int width, int height, int borderWidth, Color borderColor)
 {
     Color[,] colorData2D = ColorData1Dto2D(colorData1D, width, height);
     return(CreateRectangularBorder(colorData2D, width, height, borderWidth, borderColor));
 }
        public static Bitmap ToWhiteBorder(System.Drawing.Bitmap bmpOriginal, System.Drawing.KnownColor knownColor)
        {
            System.Drawing.Color subColor = GetCompatibleColor(knownColor);

            Bitmap untouchedImage = CreateNonIndexedImage(bmpOriginal);
            Bitmap bmp            = CreateNonIndexedImage(bmpOriginal);

            System.Drawing.Size size = bmp.Size;

            isBlack              = new bool[bmp.Width, bmp.Height];
            wasChecked           = new bool[bmp.Width, bmp.Height];
            alreadyAdded         = new bool[bmp.Width, bmp.Height];
            bool[,] isContiguous = new bool[bmp.Width, bmp.Height];
            pixels = new Color[bmp.Width, bmp.Height];
            for (int x = 0; x < bmp.Width; x++)
            {
                for (int y = 0; y < bmp.Height; y++)
                {
                    isBlack[x, y]      = false;
                    wasChecked[x, y]   = false;
                    alreadyAdded[x, y] = false;
                    pixels[x, y]       = bmp.GetPixel(x, y);
                }
            }
            bmpSize = bmp.Size;



            List <Point> continguousEdges = new List <Point>();
            Point        startPoint       = new Point(5, 5);

            continguousEdges.Add(startPoint);
            Point topRight = new Point(bmp.Width - 5, 5);

            continguousEdges.Add(topRight);
            Point bottomRight = new Point(bmp.Width - 5, bmp.Height - 5);

            continguousEdges.Add(bottomRight);

            bool pointAdded = true;

            while (continguousEdges.Count > 0)
            {
                pointAdded = false;

                if (continguousEdges.Count > 0)
                {
                    Point point = continguousEdges[0];

                    // Check in each direction

                    //left
                    if (!AlreadyAdded(point.X - 1, point.Y, ref bmp) && IsBlack(point.X - 1, point.Y, ref bmp))
                    {
                        alreadyAdded[point.X - 1, point.Y] = true;
                        continguousEdges.Add(new Point(point.X - 1, point.Y));
                        pointAdded = true;
                    }

                    //right
                    if (!AlreadyAdded(point.X + 1, point.Y, ref bmp) && IsBlack(point.X + 1, point.Y, ref bmp))
                    {
                        alreadyAdded[point.X + 1, point.Y] = true;
                        continguousEdges.Add(new Point(point.X + 1, point.Y));
                        pointAdded = true;
                    }

                    //Up
                    if (!AlreadyAdded(point.X, point.Y - 1, ref bmp) && IsBlack(point.X, point.Y - 1, ref bmp))
                    {
                        alreadyAdded[point.X, point.Y - 1] = true;
                        continguousEdges.Add(new Point(point.X, point.Y - 1));
                        pointAdded = true;
                    }

                    //Down
                    if (!AlreadyAdded(point.X, point.Y + 1, ref bmp) && IsBlack(point.X, point.Y + 1, ref bmp))
                    {
                        alreadyAdded[point.X, point.Y + 1] = true;
                        continguousEdges.Add(new Point(point.X, point.Y + 1));
                        pointAdded = true;
                    }

                    foreach (var pt in continguousEdges)
                    {
                        if ((pt.X == point.X) && (pt.Y == point.Y))
                        {
                            continguousEdges.Remove(pt);
                            break;
                        }
                    }
                }
            }

            for (int x = 0; x < bmp.Width; x++)
            {
                for (int y = 0; y < bmp.Height; y++)
                {
                    if (alreadyAdded[x, y])
                    {
                        isBlack[x, y] = true;
                    }
                }
            }


            int xMiddle = bmp.Width / 2 + 50;
            // Find top of bottom border (we want to invert the bottom)
            int innerBottomBorder = bmp.Height;

            for (int y = bmp.Height - 1; y > bmp.Height / 2; y--)
            {
                if (isBlack[xMiddle, y])
                {
                    innerBottomBorder = y;
                }
                else
                {
                    //break;
                }
            }
            int innerTopBorder = 0;

            for (int y = 1; y < bmp.Height / 2; y++)
            {
                if (isBlack[xMiddle, y])
                {
                    innerTopBorder = y;
                }
                else
                {
                    //break;
                }
            }

            int innerLeft  = 0;
            int innerRight = bmp.Width;

            // Find the inner-left and inner-right border
            for (int x = 2; x < bmp.Width / 2; x++)
            {
                if (isBlack[x, 25])
                {
                    innerLeft = x;
                }
                else
                {
                    //break;
                }
            }

            // Find the inner-left and inner-right border
            for (int x = bmp.Width - 1; x > bmp.Width / 2; x--)
            {
                if (isBlack[x, 25])
                {
                    innerRight = x;
                }
                else
                {
                    //break;
                }
            }



            System.Drawing.Color drawingColor = subColor;

            System.Drawing.Bitmap whitedOut = bmp;

            // Detect system cards and force a 15-pixel border
            if ((innerBottomBorder < bmp.Height - 1) && (innerTopBorder > 0) && (innerLeft > 0) && (innerRight < bmp.Width))
            {
                int defaultBorder = 15;
                int maxBorder     = 25;
                if ((innerBottomBorder < (bmp.Height - maxBorder)) ||
                    (innerTopBorder > maxBorder) ||
                    (innerLeft > maxBorder) ||
                    (innerRight < bmp.Width - maxBorder))
                {
                    // System card detected!  Add 4 borders of 15 pixels each!
                    innerBottomBorder = bmp.Height - defaultBorder;
                    innerTopBorder    = defaultBorder;
                    innerLeft         = defaultBorder;
                    innerRight        = bmp.Width - defaultBorder;
                }
            }

            /*
             * // Invert the bottom-border and then sub-out all of the other pixels
             * for (int x = 0; x < whitedOut.Width; x++)
             * {
             *  for (int y = 0; y < whitedOut.Height; y++)
             *  {
             *      if (y >= innerBottomBorder)
             *      {
             *          Color oldPixel = whitedOut.GetPixel(x, y);
             *          whitedOut.SetPixel(x, y, Color.FromArgb(255 - oldPixel.R, 255 - oldPixel.G, 255 - oldPixel.B));
             *      }
             *
             *
             *      if ((x <= innerLeft) || (x >= innerRight) || (y <= innerTopBorder) || (y >= innerBottomBorder))
             *      {
             *          if (isBlack[x, y])
             *          {
             *              whitedOut.SetPixel(x, y, drawingColor);
             *          }
             *      }
             *  }
             * }
             */

            /*
             * // If not turning white, remove any white pixels
             * if (subColor != System.Drawing.Color.White)
             * {
             *  // Remove any white pixels
             *  for (int x = 0; x < whitedOut.Width; x++)
             *  {
             *      for (int y = 0; y < whitedOut.Height; y++)
             *      {
             *          if (y >= innerBottomBorder)
             *          {
             *              int whiteThreshold = 150;
             *              Color oldPixel = whitedOut.GetPixel(x, y);
             *              if ((oldPixel.R > whiteThreshold) && (oldPixel.G > whiteThreshold) && (oldPixel.B > whiteThreshold))
             *              {
             *                  whitedOut.SetPixel(x, y, drawingColor);
             *              }
             *          }
             *      }
             *  }
             * }
             */


            // Blank out the entire inside of the card
            for (int x = innerLeft - 1; x <= innerRight + 1; x++)
            {
                for (int y = innerTopBorder; y <= innerBottomBorder; y++)
                {
                    whitedOut.SetPixel(x, y, drawingColor);
                }
            }


            System.Drawing.Rectangle innerImageRect = new System.Drawing.Rectangle(innerLeft, innerTopBorder, innerRight - innerLeft, innerBottomBorder - innerTopBorder);
            System.Drawing.Bitmap    innerImage     = new Bitmap(innerImageRect.Width, innerImageRect.Height);
            innerImage.SetResolution(untouchedImage.HorizontalResolution, untouchedImage.VerticalResolution);
            using (Graphics g = Graphics.FromImage(innerImage))
            {
                g.DrawImage(untouchedImage, 0, 0, innerImageRect, System.Drawing.GraphicsUnit.Pixel);
            }


            //points[0] = new System.Drawing.PointF(15, 15);
            //points[1] = new System.Drawing.PointF(335, 15);
            //points[2] = new System.Drawing.PointF(15, 475);


            // Border should be 4% of the inner-image size
            // innerWidth+0.04%*2 = newWidth;
            // New image needs to be the inner-image-rect + 14 pixel border on all sides
            float widthHeightRatio = (float)innerImageRect.Width / (float)innerImageRect.Height;
            float borderTop        = innerImageRect.Width * 0.048f;
            //float borderSide = borderTop * widthHeightRatio;
            float borderSide = borderTop;
            int   newWidth   = innerImageRect.Width + (int)(borderSide * 2.0f);
            int   newHeight  = innerImageRect.Height + (int)(borderTop * 2.0f);


            //float widthHeightRatio =  (float)innerImageRect.Width / (float)innerImageRect.Height;
            //System.Drawing.PointF[] points = new System.Drawing.PointF[3];
            //points[0] = new System.Drawing.PointF(borderSize, borderSize);
            //points[1] = new System.Drawing.PointF(newWidth - borderSize, borderSize);
            //points[2] = new System.Drawing.PointF(borderSize, (newWidth - (borderSize * 2.0f)) / widthHeightRatio + borderSize);


            // First, scale the image UP to the new size
            System.Drawing.Bitmap scaledUp = new System.Drawing.Bitmap(newWidth, newHeight);
            using (System.Drawing.Graphics graphics = Graphics.FromImage(scaledUp))
            {
                graphics.DrawImage(whitedOut, new System.Drawing.PointF[3]
                {
                    new System.Drawing.PointF(0, 0),
                    new System.Drawing.PointF(newWidth, 0),
                    new System.Drawing.PointF(0, newHeight)
                });
            }

            // Next, re-draw the original inner-image on top of the whited-out version
            using (System.Drawing.Graphics graphics2 = Graphics.FromImage(scaledUp))
            {
                //graphics.DrawImage(untouchedImage, points, innerImageRect, System.Drawing.GraphicsUnit.Pixel);
                //graphics2.DrawImage(innerImage, new System.Drawing.PointF(borderSide, borderTop));
                graphics2.DrawImage(innerImage,
                                    new System.Drawing.RectangleF(new Point((int)borderSide, (int)borderTop), innerImage.Size),
                                    new System.Drawing.RectangleF(new Point(0, 0), innerImage.Size),
                                    System.Drawing.GraphicsUnit.Pixel);

                innerImage.Save("c:\\temp\\InnerOnly.png");
            }

            whitedOut = scaledUp;

            /*
             * // Draw a slight black border around the whole image for cutting purposes
             * for (int x = 0; x < whitedOut.Width; x++)
             * {
             *  for (int y = 0; y < whitedOut.Height; y++)
             *  {
             *      if ((y == whitedOut.Height - 1) || (x == whitedOut.Width - 1) ||
             *          (y == 0) || (x == 0))
             *      {
             *          whitedOut.SetPixel(x, y, Color.FromArgb(255, 200, 200, 200));
             *      }
             *  }
             * }
             */



            return(whitedOut);
        }
Exemplo n.º 33
0
    void ColorateGrid()
    {
        Color[,] terrainTypeColors = GetGridDataFromTexture(heightmapTerreinType, Width, Height);

        foreach (var cell in Cells)
        {
            string colorRGB = ColorUtility.ToHtmlStringRGB(terrainTypeColors[cell.X, cell.Z]);

            /*
             #00cfff   rgb(0,207,255);
             #15b788   rgb(21,183,136)
             #1c6850   rgb(28,104,80)
             #91e2c9   rgb(145,226,201)
             #b2dbce   rgb(178,219,206)
             *
             #aace11   rgb(170,206,17)
             #cfea5e   rgb(207,234,94)
             #97af41   rgb(151,175,65)
             #5b662b   rgb(91,102,43)
             #d6e28f   rgb(214,226,143)
             #181c09  rgb(24,28,9)
             #145917   rgb(20,89,23)
             #aaaf77   rgb(170,175,119)
             #aaaf77   rgb(170,175,119)
             *
             #1a1468   rgb(26,20,104)
             #678ca5    rgb(103,140,165)
             #0a2a3f   rgb(10,42,63)
             #3b464f   rgb(59,70,79)
             #afbdc6   rgb(175,189,198)
             *
             #7a6a46   rgb(122,106,70)
             */

            switch (colorRGB)
            {
            case "00CFFF":
                cell.SetTerrainType(CellTerrainType.Water1);
                break;

            case "15B789":
                cell.SetTerrainType(CellTerrainType.Water2);
                break;

            case "1B674F":
                cell.SetTerrainType(CellTerrainType.Water3);
                break;

            case "91E1C8":
                cell.SetTerrainType(CellTerrainType.Water4);
                break;

            case "B2DBCE":
                cell.SetTerrainType(CellTerrainType.Water5);
                break;

            case "AACD10":
                cell.SetTerrainType(CellTerrainType.Grass1);
                break;

            case "AACF10":
                cell.SetTerrainType(CellTerrainType.Grass1);
                break;

            case "CEE95D":
                cell.SetTerrainType(CellTerrainType.Grass2);
                break;

            case "D0EC5D":
                cell.SetTerrainType(CellTerrainType.Grass2);
                break;

            case "96AF42":
                cell.SetTerrainType(CellTerrainType.Grass3);
                break;

            case "5A6629":
                cell.SetTerrainType(CellTerrainType.Grass4);
                break;

            case "5A662B":
                cell.SetTerrainType(CellTerrainType.Grass4);
                break;

            case "D6E18E":
                cell.SetTerrainType(CellTerrainType.Grass5);
                break;

            case "181C08":
                cell.SetTerrainType(CellTerrainType.Grass6);
                break;

            case "181E21":
                cell.SetTerrainType(CellTerrainType.Desert);
                break;

            case "145918":
                cell.SetTerrainType(CellTerrainType.Grass7);
                break;

            case "125915":
                cell.SetTerrainType(CellTerrainType.Grass7);
                break;

            case "155915":
                cell.SetTerrainType(CellTerrainType.Grass7);
                break;

            case "AAAF78":
                cell.SetTerrainType(CellTerrainType.Grass8);
                break;

            case "A9B077":
                cell.SetTerrainType(CellTerrainType.Grass8);
                break;

            case "AAAF75":
                cell.SetTerrainType(CellTerrainType.Grass8);
                break;

            case "CBED00":
                cell.SetTerrainType(CellTerrainType.Grass9);
                break;

            case "1B1468":
                cell.SetTerrainType(CellTerrainType.Ancient1);
                break;

            case "688CA7":
                cell.SetTerrainType(CellTerrainType.Ancient2);
                break;

            case "678CA5":
                cell.SetTerrainType(CellTerrainType.Ancient2);
                break;

            case "0A2A3F":
                cell.SetTerrainType(CellTerrainType.Ancient3);
                break;

            case "3C464F":
                cell.SetTerrainType(CellTerrainType.Ancient4);
                break;

            case "AFBDC6":
                cell.SetTerrainType(CellTerrainType.Ancient5);
                break;

            case "7B6A47":
                cell.SetTerrainType(CellTerrainType.Desert);
                break;

            case "7B6A44":
                cell.SetTerrainType(CellTerrainType.Desert);
                break;

            case "7B6946":
                cell.SetTerrainType(CellTerrainType.Desert);
                break;

            case "786A44":
                cell.SetTerrainType(CellTerrainType.Desert);
                break;

            case "000000":

                break;

            default:
                Debug.Log(colorRGB + "   " + cell.X + "x" + cell.Z);
                break;
            }
        }
    }
Exemplo n.º 34
0
        /// <summary>
        /// Loads a level to the screen
        /// </summary>
        /// <param name="gameObjects">collection for map objects to be added to</param>
        /// /// <param name="graphics">GraphicsDevice object</param>
        //TODO: make it work with spritepacks (folders) instead of specific textures (files)
        public void LevelLoad(Game1 game, GraphicsDevice graphics)
        {
            //reset
            rooms    = new List <List <MapObject> >();
            this.map = new MapObject[image.Width, image.Height];


            //get an array of color data from the image
            colors = new Color[image.Width, image.Height];
            Color[] data = new Color[colors.Length];
            image.GetData <Color>(data);

            //use data to populate colors 2d array
            //as well as finding the starting point
            int  k          = 0;
            bool startFound = false;
            bool endFound   = false;

            for (int i = 0; i < image.Height; i++)
            {
                for (int j = 0; j < image.Width; j++, k++)
                {
                    colors[j, i] = data[k];
                    if (colors[j, i].Equals(new Color(0, 255, 0)) && !startFound)
                    {
                        startingPoint = new Vector2(
                            -(graphics.Viewport.Width / 2) + (j * tileSideSize) + (2 * (tileSideSize / 3)),
                            -(graphics.Viewport.Height / 2) + (i * tileSideSize) + (2 * (tileSideSize / 3)));
                        startFound = true;
                    }
                    if (colors[j, i].Equals(new Color(0, 150, 0)) && !endFound)
                    {
                        endPoint = new Point(j, i);
                        endFound = true;
                    }
                }
            }

            //actually populate the map with images (also map representation)
            for (int i = 0; i < image.Height; i++, k++)
            {
                for (int j = 0; j < image.Width; j++, k++)
                {
                    //if starting
                    if (colors[j, i].Equals(new Color(0, 255, 0)))
                    {
                        MapObject mObj = new MapObject(
                            -((int)startingPoint.X - ((j * tileSideSize) + 50)),
                            -((int)startingPoint.Y - ((i * tileSideSize) + 50)), floor);
                        game.GameObjects.Add(mObj);
                        map[j, i] = mObj;

                        playerStart = new Point(j, i);
                    }
                    //if end
                    if (colors[j, i].Equals(new Color(0, 150, 0)))
                    {
                        MapObject mObj = new MapObject(
                            -((int)startingPoint.X - ((j * tileSideSize) + 50)),
                            -((int)startingPoint.Y - ((i * tileSideSize) + 50)), end, true);
                        game.GameObjects.Add(mObj);
                        map[j, i] = mObj;
                    }
                    //if floor
                    else if (colors[j, i].Equals(new Color(255, 255, 255)))
                    {
                        MapObject mObj = new MapObject(
                            -((int)startingPoint.X - ((j * tileSideSize) + 50)),
                            -((int)startingPoint.Y - ((i * tileSideSize) + 50)), floor);
                        game.GameObjects.Add(mObj);
                        map[j, i] = mObj;
                    }
                    //if wall
                    else if (colors[j, i].Equals(new Color(0, 0, 255)))
                    {
                        MapObject mObj = new MapObject(
                            -((int)startingPoint.X - ((j * tileSideSize) + 50)),
                            -((int)startingPoint.Y - ((i * tileSideSize) + 50)), wall, true, false);
                        game.GameObjects.Add(mObj);
                        map[j, i] = mObj;
                    }
                    //if closed door
                    else if (colors[j, i].Equals(new Color(255, 0, 0)))
                    {
                        MapObject mObj = new MapObject(
                            -((int)startingPoint.X - ((j * tileSideSize) + 50)),
                            -((int)startingPoint.Y - ((i * tileSideSize) + 50)), door, true, true);
                        game.GameObjects.Add(mObj);
                        map[j, i] = mObj;
                    }
                    //if open door
                    else if (colors[j, i].Equals(new Color(150, 0, 0)))
                    {
                        MapObject mObj = new MapObject(
                            -((int)startingPoint.X - ((j * tileSideSize) + 50)),
                            -((int)startingPoint.Y - ((i * tileSideSize) + 50)), door, false, true);
                        game.GameObjects.Add(mObj);
                        map[j, i] = mObj;
                    }
                    //if enemy
                    else if (colors[j, i].Equals(new Color(255, 255, 0)))
                    {
                        MapObject mObj = new MapObject(
                            -((int)startingPoint.X - ((j * tileSideSize) + 50)),
                            -((int)startingPoint.Y - ((i * tileSideSize) + 50)), floor);
                        game.GameObjects.Add(mObj);
                        map[j, i] = mObj;

                        game.Enemies.Add(new Enemy(
                                             -((int)startingPoint.X - ((j * tileSideSize) + 150)),
                                             -((int)startingPoint.Y - ((i * tileSideSize) + 100)),
                                             enemy, game.GameObjects, new Point(j, i), game.Enemies, game));
                    }
                    //if secret wall
                    else if (colors[j, i].Equals(new Color(0, 0, 150)))
                    {
                        MapObject mObj = new MapObject(
                            -((int)startingPoint.X - ((j * tileSideSize) + 50)),
                            -((int)startingPoint.Y - ((i * tileSideSize) + 50)), wall, true, true);
                        game.GameObjects.Add(mObj);
                        map[j, i] = mObj;
                    }
                    //if landmark
                    else if (colors[j, i].Equals(new Color(0, 255, 255)))
                    {
                        IItem newItem = RNGItem();

                        MapObject mObj = new MapObject(
                            -((int)startingPoint.X - ((j * tileSideSize) + 50)),
                            -((int)startingPoint.Y - ((i * tileSideSize) + 50)), landmark,
                            (int)Math.Round((endPoint - new Point(j, i)).ToVector2().Length()), newItem);
                        game.GameObjects.Add(mObj);
                        map[j, i] = mObj;
                    }
                    //else do nothing (black/blank)
                }
            }

            //room assignment
            for (int i = 0; i < image.Height; i++)
            {
                for (int j = 0; j < image.Width; j++)
                {
                    //start assigning a room from a floor that is not assigned (and not null)
                    if (map[j, i] != null && map[j, i].IsFloor && !map[j, i].FloorAssgn)
                    {
                        List <MapObject> room = new List <MapObject>();
                        rooms.Add(room);
                        RoomAssgnHelper(j, i, room);
                        RoomWallHelper(room);
                    }
                }
            }

            //fix landmarks
            foreach (MapObject m in map)
            {
                if (m != null && m.IsLandmark)
                {
                    m.LandmarkFix();
                }
            }
        }
Exemplo n.º 35
0
        private void fileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            path = Directory.GetCurrentDirectory();

            Directory.CreateDirectory(path + @"\Water");
            string[] names = Directory.GetFiles(path, "*.jpg");


            for (int i = 0; i < names.Length; i++)
            {
                pictureBox1.Image = Image.FromFile(names[i]);

                c = new Color[pictureBox1.Width, pictureBox1.Height];

                bitM  = new Bitmap(pictureBox1.Image);
                bitM1 = new Bitmap(pictureBox1.Image);

                for (int p = 0; p < 3; p++)
                {
                    for (int y = (pictureBox1.Height / 10) * 9 - 18; y < (pictureBox1.Height / 10) * 9 + 12; y++)

                    {
                        for (int x = 2; x < pictureBox1.Width - 2; x++)
                        {
                            r1 = 0;
                            g1 = 0;
                            b1 = 0;
                            r2 = 0;
                            g2 = 0;
                            b2 = 0;


                            for (int x0 = x - 2; x0 <= x + 2; x0++)
                            {
                                for (int y0 = y - 2; y0 <= y + 2; y0++)
                                {
                                    r1 += bitM.GetPixel(x0, y0).R;
                                    g1 += bitM.GetPixel(x0, y0).G;
                                    b1 += bitM.GetPixel(x0, y0).B;
                                }
                            }
                            r1 /= 25;
                            g1 /= 25;
                            b1 /= 25;



                            if (r1 < 0)
                            {
                                r1 = 0;
                            }
                            if (g1 < 0)
                            {
                                g1 = 0;
                            }
                            if (b1 < 0)
                            {
                                b1 = 0;
                            }
                            if (r2 < 0)
                            {
                                r2 = 0;
                            }
                            if (g2 < 0)
                            {
                                g2 = 0;
                            }
                            if (b2 < 0)
                            {
                                b2 = 0;
                            }

                            if (r1 > 255)
                            {
                                r1 = 255;
                            }
                            if (g1 > 255)
                            {
                                g1 = 255;
                            }
                            if (b1 > 255)
                            {
                                b1 = 255;
                            }
                            if (r2 > 255)
                            {
                                r2 = 255;
                            }
                            if (g2 > 255)
                            {
                                g2 = 255;
                            }
                            if (b2 > 255)
                            {
                                b2 = 255;
                            }

                            c[x, y] = Color.FromArgb(r1, g1, b1);
                        }
                    }

                    for (int y = (pictureBox1.Height / 10) * 9 - 18; y < (pictureBox1.Height / 10) * 9 + 12; y++)

                    {
                        for (int x = 2; x < pictureBox1.Width - 2; x++)
                        {
                            bitM.SetPixel(x, y, c[x, y]);
                        }
                    }
                }



                /*for (int y = 0; y < pictureBox1.Height; y++)
                 *
                 * {
                 *  for (int x = 0; x < pictureBox1.Width; x++)
                 *  {
                 *      c[x, y] = bitM.GetPixel(x,y);
                 *      c[x, y] = Color.FromArgb(0, 0, c[x, y].B);
                 *      bitM.SetPixel(x,y, c[x, y]);
                 *  }
                 * }*/



                pictureBox1.Image = bitM;

                pictureBox1.Image.Save(path + @"\Water\" + i + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
            }
        }
Exemplo n.º 36
0
    public static List <ColorMethods.ColorName> GetLines(Color[,] data, LineCount lineCount)
    {
        List <ColorMethods.ColorName> result = new List <ColorMethods.ColorName>();

        if (lineCount == LineCount.four)
        {
            //Add most left line
            ColorMethods.ColorName color = GetColor(data, 1);
            //if (color != ColorMethods.ColorName.Unknown)
            result.Add(color);
            //else
            //    return null;

            //Add second line
            int linePosition = data.GetLength(1) / 3;
            color = GetColor(data, linePosition);
            //if (color != ColorMethods.ColorName.Unknown)
            result.Add(color);
            //else
            //    return null;

            //Add third line
            linePosition = data.GetLength(1) / 3 * 2;
            color        = GetColor(data, linePosition);
            //if (color != ColorMethods.ColorName.Unknown)
            result.Add(color);
            //else
            //    return null;

            //Add fourth line
            linePosition = data.GetLength(1) - 2;
            color        = GetColor(data, linePosition);
            //if (color != ColorMethods.ColorName.Unknown)
            result.Add(color);
            //else
            //    return null;
        }
        else
        {
            //Add most left line
            ColorMethods.ColorName color = GetColor(data, 1);
            //if (color != ColorMethods.ColorName.Unknown)
            result.Add(color);
            //else
            //    return null;

            //Add second line
            int linePosition = (int)(data.GetLength(1) * 0.27f);
            color = GetColor(data, linePosition);
            //if (color != ColorMethods.ColorName.Unknown)
            result.Add(color);
            //else
            //    return null;

            //Add third line
            linePosition = (int)(data.GetLength(1) * 0.5f);
            color        = GetColor(data, linePosition);
            //if (color != ColorMethods.ColorName.Unknown)
            result.Add(color);
            //else
            //    return null;

            //Add fourth line
            linePosition = (int)(data.GetLength(1) * 0.73f);
            color        = GetColor(data, linePosition);
            //if (color != ColorMethods.ColorName.Unknown)
            result.Add(color);
            //else
            //    return null;

            //Add fourth line
            linePosition = data.GetLength(1) - 2;
            color        = GetColor(data, linePosition);
            //if (color != ColorMethods.ColorName.Unknown)
            result.Add(color);
            //else
            //    return null;
        }
        //Debug.Log("LINES FOUND!");
        return(result);
    }
Exemplo n.º 37
0
        public float rotateWeapon(Texture2D texture)
        {
            enemyColorArray = TextureTo2DArray(texture);
            double weapRot = new double();

            weapRot = 0;
            Vector2 pos1   = new Vector2(0, 0);
            Vector2 pos2   = new Vector2(0, 0);
            Vector2 pos3   = new Vector2(0, 0);
            Vector2 eyePos = new Vector2(0, 0);

            for (int y = 0; y < texture.Height; y++)
            {
                for (int x = 0; x < texture.Width; x++)
                {
                    Color color = enemyColorArray[x, y];

                    Color weapBottomColor = new Color(57, 44, 32, 255);
                    Color weapMidColor    = new Color(57, 43, 31, 255);
                    Color weapTopColor    = new Color(57, 44, 31, 255);
                    Color eyeColor        = new Color(25, 84, 15, 255);

                    if (color == weapTopColor)
                    {
                        pos1.X = x + position.X; pos1.Y = y + position.Y;
                    }
                    if (color == weapMidColor)
                    {
                        pos2.X = x + position.X; pos2.Y = y + position.Y;
                    }
                    if (color == weapBottomColor)
                    {
                        pos3.X = x + position.X; pos3.Y = y + position.Y;
                    }
                    if (color == eyeColor)
                    {
                        eyePos.X = x + position.X; eyePos.Y = y + position.Y;
                    }

                    double opp = pos2.Y - eyePos.Y;
                    double adj = pos2.X - eyePos.X;

                    //Standing guy eye position is 75, 21.  Glove color pixel position is 113, 55
                    //When the hands are below the starting pos by 5 lets tweak the rotation down to mimic moving the wrist
                    //When the hands are above the eye pos by the height of the head start keeping the rotation at perpendicular
                    double correction = -0.9;
                    if (opp > 45)
                    {
                        correction = 0.5;
                    }
                    if (opp < 0)
                    {
                        correction = -0.25;
                    }
                    weapRot = (Math.Atan2(opp, adj)) + correction;

                    //1.57 is pointing to the right
                    //-1.57 is pointing to the left
                    //0.7854 is pointing NE
                    //0 is north
                    //3.142 is pointing south

                    if (opp < 0 && weapRot < -1.57)
                    {
                        weapRot = -1.57;
                    }
                    //weapRot = (Math.Atan2(pos1.Y - pos2.Y, pos1.X - pos2.X)) - 1.5;
                }
            }

            return((float)weapRot);
        }
Exemplo n.º 38
0
 public ImageResult(Color[,] colorData)
 {
     ColorData = colorData;
     Width     = colorData.GetLength(0);
     Height    = colorData.GetLength(1);
 }
Exemplo n.º 39
0
    /// <summary>
    /// Creates the grid and initializes all the tiles and labels of walkable objects.
    /// </summary>
    void CreateGrid()
    {
        gridTiles  = new GameObject[gridSizeX, gridSizeY];
        gridCosts  = new GameObject[gridSizeX, gridSizeY];
        gridColors = new Color[gridSizeX, gridSizeY];
        grid       = new Node[gridSizeX, gridSizeY];

        string[] mapString = null;
        string[] cost_line = null;
        if (!randomCosts)
        {
            mapString = mapCosts.text.TrimEnd('\n').Split('\n');
        }



        Vector3 worldBottomLeft = transform.position - Vector3.right * gridWorldSize.x / 2 - Vector3.forward * gridWorldSize.y / 2;

        for (int y = 0; y < gridSizeY; y++)
        {
            if (!randomCosts)
            {
                cost_line = mapString [gridSizeY - 1 - y].Split(',');
            }

            for (int x = 0; x < gridSizeX; x++)
            {
                Vector3 worldPoint = worldBottomLeft + Vector3.right * (x * nodeDiameter + nodeRadius) + Vector3.forward * (y * nodeDiameter + nodeRadius);
                bool    walkable   = !(Physics.CheckSphere(worldPoint, nodeRadius, unwalkableMask));
                grid [x, y] = new Node(walkable, worldPoint, x, y);

                if (randomCosts)
                {
                    grid [x, y].gCost = (int)(Random.value * 9f) + 1;
                }
                else if (mapString != null)
                {
                    int value = int.Parse(cost_line [x]);
                    if (value < 0)
                    {
                        walkable             = false;
                        grid [x, y].walkable = walkable;
                        grid [x, y].gCost    = -1;

                        if (!Physics.CheckSphere(worldPoint, nodeRadius / 2, everything))
                        {
                            // if not added using inspector.. places a random asset instead
                            PlaceUnWalkable(grid [x, y]);
                        }
                    }
                    else
                    {
                        grid [x, y].gCost = value;
                    }
                }

                if (!walkable)
                {
                    continue;
                }

                // tiles
                GameObject a_tile = Instantiate(tile, worldPoint, Quaternion.identity) as GameObject;
                a_tile.transform.SetParent(tiles.transform);
                a_tile.name = "T:(" + x + " , " + y + ") g: " + grid [x, y].gCost;
                Color altColor = Color.black;
                altColor.g = 1 - ((float)grid [x, y].gCost / 10.0f);
                a_tile.GetComponent <Renderer> ().material.color = altColor;
                gridTiles[x, y]   = a_tile;
                gridColors [x, y] = new Color(altColor.r, altColor.g, altColor.b);

                worldPoint.z += 0.4f;
                GameObject a_tile_text = Instantiate(tileText, worldPoint, Quaternion.identity) as GameObject;
                a_tile_text.transform.SetParent(tiles.transform);
                a_tile_text.transform.Rotate(new Vector3(90f, 0f, 0f));
                a_tile_text.GetComponent <TextMesh> ().text = grid [x, y].gCost.ToString();
                a_tile_text.name = "C:(" + x + " , " + y + ") g: " + grid [x, y].gCost;
                gridCosts[x, y]  = a_tile_text;
            }
        }
    }
Exemplo n.º 40
0
 /// <summary>
 /// Verifies a screen capture is within tolerance from the rendered buffer.
 /// </summary>
 /// <param name="captured">The captured image.</param>
 /// <param name="expected">The expected image.</param>
 /// <returns>Number of pixels which fail tolerance check. Pass == 0.</returns>
 public static int VerifyRender(Color[,] captured, RenderBuffer expected)
 {
     return(VerifyRender(captured, expected, 0, null));
 }
Exemplo n.º 41
0
 public static Color[] CreateGappedRectangularBorder(Color[] colorData1D, int width, int height, int borderWidth, Color borderColor, Vector2 textSize)
 {
     Color[,] colorData2D = ColorData1Dto2D(colorData1D, width, height);
     return(CreateGappedRectangularBorder(colorData2D, width, height, borderWidth, borderColor, textSize));
 }
Exemplo n.º 42
0
 public Color[,] DetectColor(Color[,] i)
 {
     //code here
     return(i);
 }
Exemplo n.º 43
0
 /// <summary>
 /// Constructor that fills the framebuffer with an image.
 /// </summary>
 /// <param name="premultipliedImage">An image that will be premultiplied and pasted into the framebuffer.</param>
 public static RenderBuffer FromPremultipliedImage(Color[,] premultipliedImage)
 {
     return(new RenderBuffer(premultipliedImage));
 }
Exemplo n.º 44
0
 public FrameState Init(ScreenConfig screen)
 {
     _value = new Color[screen.Width, screen.Height];
     return(this);
 }
Exemplo n.º 45
0
    private static ColorMethods.ColorName GetColor2(Color[,] data, int i)
    {
        int j = (data.GetLength(0) - 1) / 2;

        ColorMethods.ColorName color = ColorMethods.GetResistorColorCode(data[j, i]);
        if (color != ColorMethods.ColorName.Unknown)
        {
            return(color);
        }

        //If color did not recognized, look left..
        if (i > 0 && (color = ColorMethods.GetResistorColorCode(data[j, i - 1])) != ColorMethods.ColorName.Unknown)
        {
            return(color);
        }

        //If not recognized, look rigth
        if (i < data.GetLength(1) - 1 && (color = ColorMethods.GetResistorColorCode(data[j, i + 1])) != ColorMethods.ColorName.Unknown)
        {
            return(color);
        }

        //If not recognized, look top
        if (j > 0 && (color = ColorMethods.GetResistorColorCode(data[j - 1, i])) != ColorMethods.ColorName.Unknown)
        {
            return(color);
        }

        //If not recognized, look bottom
        if (data.GetLength(0) > 1 && (color = ColorMethods.GetResistorColorCode(data[j + 1, i])) != ColorMethods.ColorName.Unknown)
        {
            return(color);
        }

        //If not recognized, look top left
        if (j > 0 && i > 0 && (color = ColorMethods.GetResistorColorCode(data[j - 1, i - 1])) != ColorMethods.ColorName.Unknown)
        {
            return(color);
        }

        //If not recognized, look top rigth
        if (j > 0 && i < data.GetLength(1) - 1 && (color = ColorMethods.GetResistorColorCode(data[j - 1, i + 1])) != ColorMethods.ColorName.Unknown)
        {
            return(color);
        }

        //If not recognized, look bottom left
        if (data.GetLength(0) > 1 && i > 0 && (color = ColorMethods.GetResistorColorCode(data[j + 1, i - 1])) != ColorMethods.ColorName.Unknown)
        {
            return(color);
        }

        //If not recognized, look bottom right
        if (data.GetLength(0) > 1 && i < data.GetLength(1) - 1 && (color = ColorMethods.GetResistorColorCode(data[j + 1, i + 1])) != ColorMethods.ColorName.Unknown)
        {
            return(color);
        }

        //If never recognized, return null
        return(ColorMethods.ColorName.Unknown);
    }
Exemplo n.º 46
0
        /// <summary>
        /// Залить цветом ячейки в таблице
        /// </summary>
        /// <param name="progress"></param>
        /// <param name="worksheet">Страница</param>
        /// <param name="colors">Цвета</param>
        private void DecorateWorksheetCells(ExcelExportProgressCommand progress, dynamic worksheet, Color[,] colors)
        {
            var areas = new List <ColorArea>();

            for (int i = 0; i < Rows; i++)
            {
                for (int j = 0; j < Columns; j++)
                {
                    var c = colors[i, j];
                    if (c.R < 250 || c.B < 250 || c.G < 250)
                    {
                        var a = new ColorArea();
                        a.Fill(colors, j, i);
                        a.Bleach(colors);
                        areas.Add(a);
                    }
                }
            }

            foreach (var a in areas)
            {
                progress.Area = string.Format("{0}:{1:D2} - {2}:{3:D2}", a.Y + 2, a.X + 1, a.Y + 1 + a.Height,
                                              a.X + a.Width);
                var r1 = worksheet.Cells[a.Y + 2, a.X + 1];
                var r2 = worksheet.Cells[a.Y + 1 + a.Height, a.X + a.Width];
                var r  = worksheet.Range(r1, r2);
                r.Interior.Color = a.Color.ToOle();
            }
        }
Exemplo n.º 47
0
    public static List <ColorData> GetLines(Color[,] data, out Color baseColorInfo)
    {
        //Convert all data to ColorData.
        ColorData[,] colorInfo = GetColorData(data);

        //Find the center of the vertical axis of pixel group.
        int j = colorInfo.GetLength(0) / 2;

        //Set base color info to most left and center pixel.
        baseColorInfo = colorInfo[j, 0].color;

        //Set most left and center pixel as base color of resistor.
        ColorMethods.HSV baseColor = ColorMethods.GetHSV(colorInfo[j, 0].color);

        //Create an empty list to save lines.
        List <ColorData> lines = new List <ColorData>();

        //Set tolerance level to check if a color is same as the base color since base color has no known range.
        float[] tolerance = { 5f, 0.1f, 0.3f };

        //Create a flag to know if last checked pixel was a part of a line.
        ColorData lastPixel = null;

        //Iterate through all pixel from left to right to resolve their colors and find line colors.
        for (int i = 1; i < colorInfo.GetLength(1); i++)
        {
            //Get current pixel.
            ColorData currentPixel = colorInfo[j, i];

            //If current pixel is white, check if it is just a shine effect.
            if (currentPixel.colorName == ColorMethods.ColorName.White)
            {
                currentPixel = CheckShine(i, colorInfo);
            }

            //If color of current pixel couldn't be resolved, continue to next pixel.
            if (currentPixel.colorName == ColorMethods.ColorName.Unknown)
            {
                Debug.LogWarning("Unknown pixel color found: " + currentPixel.color.ToString());
                continue;
            }

            //If current pixel is NOT same as the base color ...
            if (CompareColors(baseColor, ColorMethods.GetHSV(currentPixel.color), tolerance) == false)
            {
                /*If last checked pixel was NOT a line color, that means we found a new line on resistor.
                 * We should add this pixel to lines list and turn on the flag to let next pixel know last
                 * pixel was a line pixel.*/
                if (lastPixel == null)
                {
                    if (lines.Count < 6)
                    {
                        lines.Add(currentPixel);
                        lastPixel = currentPixel;
                    }
                    /*If there are already 6 lines but found a seventh one, that means this object is not a resistor.*/
                    else
                    {
                        return(null);
                    }
                }

                /*If last checked pixel was a line color, but not same as this pixel's color; that means
                 * there are two different lines next to each other without a base color seperating them.
                 * That is not possible on a resistor.*/
                else
                {
                    if (lastPixel.colorName != currentPixel.colorName)
                    {
                        Debug.LogWarning("Two different adjoining lines found: 1)" + currentPixel.colorName.ToString() + " 2)" + lastPixel.colorName.ToString());
                    }
                }
            }
            //If current pixel is same as the base color, turn off the flag of last pixel was a line.
            else
            {
                lastPixel = null;
            }
        }
        return(lines);
    }
Exemplo n.º 48
0
 public static Color[] GetAllAvailableColors(Color[,] image, int K, BackgroundWorker backgroundWorker)
 {
     int[,,] amount = new int[256, 256, 256];
     (Color, int)[] colorAmount = new (Color, int)[256 * 256 * 256];
Exemplo n.º 49
0
 public Bitmap(int x, int y)
 {
     data = new Color[x, y];
 }
Exemplo n.º 50
0
 /* Creates an animation frame using the provided analogy, image, and parameters */
 private Color[,] createImage(ImageAnalogy ia, string frameB1)
 {
     Color[,] imageB1 = Utilities.createImageArrayFromFile(frameB1);
     Color[,] imageB2 = ia.CreateImageAnalogy(imageB1, randAmount);
     return(imageB2);
 }
Exemplo n.º 51
0
 public ColorGridStyle(Color[,] colors, float cellSpacing, int roundedRadius)
 {
     Colors           = colors;
     CellSpacingScale = cellSpacing;
     RoundedRadius    = roundedRadius;
 }
Exemplo n.º 52
0
    void Start()
    {
        moduleId      = moduleIdCounter++;
        patternColors = new[, ] {
            { "#6C190E".Color(), "#6C3610".Color(), "#68530F".Color(), "#555F0D".Color(), "#335C0E".Color(), "#0C580D".Color(), "#0A5C30".Color(), "#0A5D55".Color(), "#0A5169".Color(), "#0C3368".Color(), "#101669".Color(), "#351A69".Color(), "#591C67".Color(), "#6D1D56".Color(), "#6B1B33".Color(), "#424242".Color() },
            { "#FF4E41".Color(), "#FF8F31".Color(), "#FFD232".Color(), "#DBEF30".Color(), "#85E836".Color(), "#2EE235".Color(), "#2EE38E".Color(), "#2BEDD1".Color(), "#2ECEFF".Color(), "#3888FF".Color(), "#3848FF".Color(), "#8E4FFF".Color(), "#DA53F3".Color(), "#FD55E2".Color(), "#FE5388".Color(), "#A9A9A9".Color() }
        };

        colorNames   = patterns.Keys.ToArray();
        usedColors   = Enumerable.Range(0, patternColors.GetLength(1)).ToArray().Shuffle().Take(8).ToArray();
        unusedColors = Enumerable.Range(0, patternColors.GetLength(1)).Where(x => !usedColors.Contains(x)).ToArray();
        unusedMap    = Enumerable.Range(0, patternColors.GetLength(1)).Select(x => !usedColors.Contains(x)).ToArray().ToArray2D(4, 4);
        stageColors  = usedColors.Shuffle().Take(3).ToArray();
        Debug.LogFormat(@"[Wavetapping #{0}] Possible colors are: {1}", moduleId, usedColors.Select(x => colorNames[x]).Join(", "));
        Debug.LogFormat(@"[Wavetapping #{0}] Stage colors are: {1}", moduleId, stageColors.Select(x => colorNames[x]).Join(", "));

        for (var i = 0; i < ColorDisplays.Length; i++)
        {
            ColorDisplays[i].material.color = (usedColors.Contains(i)) ? "#DDDDDD".Color() : patternColors[0, i];
        }

        serialNumber = BombInfo.GetSerialNumber();
        serialDigits = BombInfo.GetSerialNumberNumbers();

        if (BombInfo.GetSerialNumberLetters().Count("SRFMU".Contains) >= 3)
        {
            Debug.LogFormat(@"[Wavetapping #{0}] Rotating the patterns 180 degrees.", moduleId);

            for (var i = 0; i < colorNames.Length; i++)
            {
                patterns[colorNames[i]] = patterns[colorNames[i]].Select(x => x.Reverse()).ToArray();
            }
        }

        GetCorrects();
        StartStage();
        StartCoroutine(PixelBlink());

        SubmitButton.OnInteract += delegate() {
            OnSubmitPress();

            return(false);
        };

        for (var i = 0; i < ModuleButtons.Length; i++)
        {
            var j = i;

            ModuleButtons[i].OnInteract += delegate() {
                OnButtonPress(j);
                dragging = true;

                return(false);
            };

            ModuleButtons[i].OnInteractEnded += delegate() { dragging = false; };

            ModuleButtons[i].OnHighlight += delegate() {
                if (dragging)
                {
                    OnButtonPress(j);
                }
            };
        }
    }
Exemplo n.º 53
0
        public Color[,] ColorizeVectors(Color[,] input)
        {
            if (LongestChord.firstPixel == null || LongestChord.secondPixel == null ||
                LongestPerpendicularChord.firstPixel == null || LongestPerpendicularChord.secondPixel == null)
            {
                return(input);
            }

            Color[,] output = (Color[, ])input.Clone();

            double angle       = LongestChord.orientation;
            double uv1CosAngle = Math.Cos(angle);
            double uv1SinAngle = Math.Sin(angle);

            double pAngle = Math.PI / 2;

            double[]        rotationArray  = new double[] { Math.Cos(pAngle), -1.0 * Math.Sin(pAngle), Math.Sin(pAngle), Math.Cos(pAngle) };
            Matrix <double> rotationMatrix = new DenseMatrix(2, 2, rotationArray);

            Vector <double> unitVector1 = new DenseVector(new double[] { uv1CosAngle, uv1SinAngle });
            Vector <double> unitVector2 = new DenseVector(new double[2]);

            rotationMatrix.LeftMultiply(unitVector1, unitVector2);

            double uv2CosAngle = unitVector2[0];
            double uv2SinAngle = unitVector2[1];

            int lcX = 0;

            if (uv1CosAngle > 0)
            {
                if (LongestChord.firstPixel.X < LongestChord.secondPixel.X)
                {
                    lcX = LongestChord.firstPixel.X;
                }
                else
                {
                    lcX = LongestChord.secondPixel.X;
                }
            }
            else
            if (LongestChord.firstPixel.X < LongestChord.secondPixel.X)
            {
                lcX = LongestChord.secondPixel.X;
            }
            else
            {
                lcX = LongestChord.firstPixel.X;
            }

            int lcY = 0;

            if (uv1SinAngle > 0)
            {
                if (LongestChord.firstPixel.Y < LongestChord.secondPixel.Y)
                {
                    lcY = LongestChord.firstPixel.Y;
                }
                else
                {
                    lcY = LongestChord.secondPixel.Y;
                }
            }
            else
            if (LongestChord.firstPixel.Y < LongestChord.secondPixel.Y)
            {
                lcY = LongestChord.secondPixel.Y;
            }
            else
            {
                lcY = LongestChord.firstPixel.Y;
            }

            for (int i = 0; i < LongestChord.distance; i++)
            {
                int uv1X = OffsetX + lcX + ((int)Math.Round(uv1CosAngle * i));
                int uv1Y = OffsetY + lcY + ((int)Math.Round(uv1SinAngle * i));
                output[uv1X, uv1Y] = Color.Red;
            }

            int lpcX = 0;

            if (uv2CosAngle > 0)
            {
                if (LongestPerpendicularChord.firstPixel.X < LongestPerpendicularChord.secondPixel.X)
                {
                    lpcX = LongestPerpendicularChord.firstPixel.X;
                }
                else
                {
                    lpcX = LongestPerpendicularChord.secondPixel.X;
                }
            }
            else
            if (LongestPerpendicularChord.firstPixel.X < LongestPerpendicularChord.secondPixel.X)
            {
                lpcX = LongestPerpendicularChord.secondPixel.X;
            }
            else
            {
                lpcX = LongestPerpendicularChord.firstPixel.X;
            }

            int lpcY = 0;

            if (uv2SinAngle > 0)
            {
                if (LongestPerpendicularChord.firstPixel.Y < LongestPerpendicularChord.secondPixel.Y)
                {
                    lpcY = LongestPerpendicularChord.firstPixel.Y;
                }
                else
                {
                    lpcY = LongestPerpendicularChord.secondPixel.Y;
                }
            }
            else
            if (LongestPerpendicularChord.firstPixel.Y < LongestPerpendicularChord.secondPixel.Y)
            {
                lpcY = LongestPerpendicularChord.secondPixel.Y;
            }
            else
            {
                lpcY = LongestPerpendicularChord.firstPixel.Y;
            }

            for (int i = 0; i < LongestPerpendicularChord.distance; i++)
            {
                int uv2X = OffsetX + lpcX + ((int)Math.Round(uv2CosAngle * i));
                int uv2Y = OffsetY + lpcY + ((int)Math.Round(uv2SinAngle * i));
                output[uv2X, uv2Y] = Color.Blue;
            }

            return(output);
        }
Exemplo n.º 54
0
 /// <summary>
 /// Creates a PNG image from the specified pixels.
 /// </summary>
 /// <param name="pixels">The pixels (bottom line first).</param>
 /// <returns>An Image.</returns>
 public static Image PngFromArgb(Color[,] pixels)
 {
     return(new Image(PngEncoder.Encode(pixels)));
 }
Exemplo n.º 55
0
        /* Iterate through each frame, generating the animation frame and copying over
         * all the frames (including keyframes) into the imageB2 path folder.
         */
        private void iterFiles()
        {
            //Get all the image files from the provided directories
            framesA1 = Directory.GetFiles(pathA1);
            framesA2 = Directory.GetFiles(pathA2);
            framesB1 = Directory.GetFiles(pathB1);
            Array.Sort(framesA1);
            Array.Sort(framesA2);
            Array.Sort(framesB1);

            //Set keyframe values
            int          startKeyIndex = 0;
            int          endKeyIndex   = startKeyIndex + 1;
            int          startKeyNum   = parseFrameFromName(framesA1[startKeyIndex]);
            int          endKeyNum     = parseFrameFromName(framesA1[endKeyIndex]);
            ImageAnalogy startAnalogy  = createAnalogy(framesA1[startKeyIndex], framesA2[startKeyIndex]);
            ImageAnalogy endAnalogy    = createAnalogy(framesA1[endKeyIndex], framesA2[endKeyIndex]);

            //Copy the current keyframes to destination directory
            copyFrame(framesA2[startKeyIndex]);
            copyFrame(framesA2[endKeyIndex]);

            //Iterate through the in-between frames, creating a new frame for each
            foreach (string frame in framesB1)
            {
                //Adjust current start and end key frames if the in-between we're on
                //is not between them.
                int currentFrameNum = parseFrameFromName(frame);
                if (currentFrameNum > endKeyNum)
                {
                    startKeyIndex++;
                    endKeyIndex++;

                    //We've reached the end
                    if (endKeyIndex >= framesA1.Count())
                    {
                        return;
                    }

                    //Change values for keyframes
                    startKeyNum  = parseFrameFromName(framesA1[startKeyIndex]);
                    endKeyNum    = parseFrameFromName(framesA1[endKeyIndex]);
                    startAnalogy = endAnalogy;
                    endAnalogy   = createAnalogy(framesA1[endKeyIndex], framesA2[endKeyIndex]);

                    //Make sure keyframes get copied over as the index increases
                    copyFrame(framesA2[endKeyIndex]);
                }

                Utilities.print("CREATING IN-BETWEEN FRAME: " + Path.GetFileName(frame));


                //FOR TESTING PURPOSES WE'RE JUST DOING ONE TO SEE IF WE GET THE SAME RESULTS USING THIS NEW SYSTEM
                Color[,] imageFromStart = createImage(startAnalogy, frame);
                //Color[,] imageFromEnd = createImage(endAnalogy, frame);

                //FOR NOW, BLEND 50-50 BETWEEN START AND END. IN THE FUTURE, WE'LL WEIGHT BASED
                //ON HOW CLSE THE IN BETWEEN IS TO THE START AND END KEYFRAMES
                //Color[,] average = Utilities.averageArrays(imageFromStart, imageFromEnd, 0.50f);
                //writeImage(average, frame);
                writeImage(imageFromStart, frame);
            }
        }
Exemplo n.º 56
0
        public Color[,] RenderEffect(Color[,] buffer, Color[] palette, int eventToRender)
        {
            var rows          = buffer.GetLength(Utils.IndexRowsOrHeight);
            var columns       = buffer.GetLength(Utils.IndexColsOrWidth);
            var pixelSpacing  = tbSpacing.Value * rows / 100 + 3;
            var limit         = rows * pixelSpacing * 4;
            var garlandsState = (limit - (eventToRender % limit)) / 4;

            for (var ring = 0; ring < rows; ring++)
            {
                var ratio     = ring / (double)rows;
                var color     = palette.GetMultiColorBlend(ratio, false);
                var intialRow = garlandsState - ring * pixelSpacing;
                for (var column = 0; column < columns; column++)
                {
                    var row = intialRow;
                    switch (tbGarlandType.Value)
                    {
                    case 1:
                        switch (column % 5)
                        {
                        case 2:
                            row -= 2;
                            break;

                        case 1:
                        case 3:
                            row -= 1;
                            break;
                        }
                        break;

                    case 2:
                        switch (column % 5)
                        {
                        case 2:
                            row -= 4;
                            break;

                        case 1:
                        case 3:
                            row -= 2;
                            break;
                        }
                        break;

                    case 3:
                        switch (column % 6)
                        {
                        case 3:
                            row -= 6;
                            break;

                        case 2:
                        case 4:
                            row -= 4;
                            break;

                        case 1:
                        case 5:
                            row -= 2;
                            break;
                        }
                        break;

                    case 4:
                        switch (column % 5)
                        {
                        case 1:
                        case 3:
                            row -= 2;
                            break;
                        }
                        break;
                    }

                    if (row < rows - ring - 1)
                    {
                        row = rows - ring - 1;
                    }
                    if (row < rows)
                    {
                        buffer[row, column] = color;
                    }
                }
            }
            return(buffer);
        }
Exemplo n.º 57
0
        /// <summary>
        /// Updates the minimap's tile preview and player positions
        /// </summary>
        public void Update(GameTime gameTime)
        {
            if (gameTime.TotalGameTime.TotalSeconds > lastUpdate + updateRate)
            {
                if (twoArray == null)
                {
                    twoArray = new Color[Width, Height];  //A 2D color array used to store the primary texture and allow precise data retri
                    oneArray = new Color[Width * Height]; //the 1D array that will be used to create the final texture
                }

                //Add tiles
                for (int y = 0; y < Height; y++)
                {
                    for (int x = 0; x < Width; x++)
                    {
                        Tile foreground = map.Tiles[x, y, 1];
                        Tile background = map.Tiles[x, y, 0];

                        if (foreground.Block.ID != BlockType.Empty.ID && foreground.Block.Color != Color.Transparent)
                        {
                            twoArray[x, y] = foreground.Block.Color;
                        }
                        else if (background.Block.ID != BlockType.Empty.ID && background.Block.Color != Color.Transparent)
                        {
                            //If BG and FG block, tint it darker slightly, otherwise draw it normally
                            if (background.Block.Layer == Layer.All)
                            {
                                twoArray[x, y] = Color.Lerp(background.Block.Color, Color.Black, .4f);
                            }
                            else
                            {
                                twoArray[x, y] = background.Block.Color;
                            }
                        }
                        else
                        {
                            twoArray[x, y] = emptyColor;
                        }
                        //Convert the 2D array to 1D
                        oneArray[x + y * Width] = twoArray[x % Width, y % Height];
                    }
                }
                //Add players and update their fade effects
                foreach (Player player in map.Players)
                {
                    if (player.DisplayState.Position != player.PreviousState.Position && !player.LastColors.ContainsKey(player.GridPosition)) //Add a new fade color trail if they are moving
                    {
                        player.LastColors.Add(player.GridPosition, 0);
                    }
                    else if (player.LastColors.ContainsKey(player.GridPosition)) //If the color list already contains this point, update it
                    {
                        player.LastColors[player.GridPosition] = 0;
                    }
                    for (int i = 0; i < player.LastColors.Count; i++) //Fade out trail and add to map
                    {
                        KeyValuePair <Point, float> point = player.LastColors.ElementAt(i);
                        player.LastColors[point.Key] += (float)gameTime.ElapsedGameTime.TotalSeconds;
                        if (Game.Map.InBounds(point.Key.X, point.Key.Y))
                        {
                            oneArray[point.Key.X + point.Key.Y * Width] = Color.Lerp(player.Tint, twoArray[point.Key.X, point.Key.Y], point.Value); //Fade between tint and original tile color
                            if (point.Value >= 1)                                                                                                   //Remove old points
                            {
                                player.LastColors.Remove(point.Key);
                                i--;
                            }
                        }
                    }
                    if (Game.Map.InBounds(player.GridPosition.X, player.GridPosition.Y))
                    {
                        oneArray[player.GridPosition.X + player.GridPosition.Y * Width] = player.Tint;
                    }
                }

                //Create a new, blank, square texture
                if (Texture == null)
                {
                    Texture = new Texture2D(map.Game.GraphicsDevice, Width, Height);
                }
                try
                {
                    //Assign the newly filled 1D array into the texture
                    Texture.SetData <Color>(oneArray);
                }
                catch
                {
                }

                lastUpdate = gameTime.TotalGameTime.TotalSeconds;
            }
        }
Exemplo n.º 58
0
 public Color[,] NormalizedRgb(Color[,] i)
 {
     //code here
     return(i);
 }
Exemplo n.º 59
0
        public void Output(string[,] cellsStr, Color[,] cellsCol, ref string stepsStr, ref string scoreStr, ref string recordStr, string[] skillsPrice)
        {
            //надо переделать передачу с массива кнопок, лейблов на массив интов, цветов и строк
            //fix me
            stepsStr  = "Ход: " + this.steps.ToString();
            scoreStr  = "Счёт: " + this.score.ToString();
            recordStr = "Рекорд: " + this.record.ToString();
            for (int i = 0; i < Skill.skillCount; i++)
            {
                skillsPrice[i] = this.skills[i].GetPrice().ToString();
            }

            //в переданные поля передаём значения игры

            //передаём значения ячеек и задаём для них нужный цвет
            for (int i = 0; i < this.cellsCount; i++)
            {
                for (int j = 0; j < this.cellsCount; j++)
                {
                    cellsStr[i, j] = this.cellsContainer[i, j].num.ToString();
                    if (this.cellsContainer[i, j].num == 0)
                    {
                        cellsStr[i, j] = "";
                    }

                    if (this.cellsContainer[i, j].num == 0)
                    {
                        cellsCol[i, j] = Color.WhiteSmoke;
                    }
                    if (this.cellsContainer[i, j].num == 2)
                    {
                        cellsCol[i, j] = Color.Gainsboro;
                    }
                    if (this.cellsContainer[i, j].num == 4)
                    {
                        cellsCol[i, j] = Color.Silver;
                    }
                    if (this.cellsContainer[i, j].num == 8)
                    {
                        cellsCol[i, j] = Color.PeachPuff;
                    }
                    if (this.cellsContainer[i, j].num == 16)
                    {
                        cellsCol[i, j] = Color.DarkSalmon;
                    }
                    if (this.cellsContainer[i, j].num == 32)
                    {
                        cellsCol[i, j] = Color.Tomato;
                    }
                    if (this.cellsContainer[i, j].num == 64)
                    {
                        cellsCol[i, j] = Color.OrangeRed;
                    }
                    if (this.cellsContainer[i, j].num == 128)
                    {
                        cellsCol[i, j] = Color.LemonChiffon;
                    }
                    if (this.cellsContainer[i, j].num == 256)
                    {
                        cellsCol[i, j] = Color.Khaki;
                    }
                    if (this.cellsContainer[i, j].num == 512)
                    {
                        cellsCol[i, j] = Color.Yellow;
                    }
                    if (this.cellsContainer[i, j].num == 1024)
                    {
                        cellsCol[i, j] = Color.Gold;
                    }
                    if (this.cellsContainer[i, j].num == 2048)
                    {
                        cellsCol[i, j] = Color.Goldenrod;
                    }
                    if (this.cellsContainer[i, j].num == 4096)
                    {
                        cellsCol[i, j] = Color.Salmon;
                    }
                    if (this.cellsContainer[i, j].num == 8192)
                    {
                        cellsCol[i, j] = Color.IndianRed;
                    }
                    if (this.cellsContainer[i, j].num > 16384)
                    {
                        cellsCol[i, j] = Color.Brown;
                    }
                }
            }
        }
Exemplo n.º 60
0
 public static void Paint(this Graphics g, Picture picture, Wypelnienie wypelnienie, Color[,] sampleImage, Color[,] normalMap, Color backColor, TrybPracy trybPracy, double ks, double kd, int m, RodzajMalowania rodzajMalowania, Color lightColor, OpcjaWektoraN opcjaWektoraN, (int, int, int) lightSource, bool randomKdKsM, bool triangleWeb, (int, int) mouse, double waveDistance)