Exemple #1
0
        public void SetFluidAmount(double amount, int x, int y, PixelSetOptions option)
        {
            if (x >= 0 && x < t_grid.Length && y >= 0 && y < t_grid[0].Length)
            {
                t_grid[x][y] = amount;
                return;
            }

            switch (option)
            {
            case PixelSetOptions.Ignore:
                return;

            case PixelSetOptions.RaiseError:
                throw new ArgumentOutOfRangeException(String.Format("In FluidField.SetFluidAmount(), location {0}:{1} is outside image bounds.", x, y));

            default:

                throw new ArgumentOutOfRangeException(String.Format("In FluidField.SetFluidAmount(), PixelSetOption {0} is not supported.", option.ToString()));
            }
        }
Exemple #2
0
        public void SetPixel(Engine.Color.Cell c, int x, int y, PixelSetOptions option)
        {
            if (x >= 0 && x < Width && y >= 0 && y < Height)
            {
                c.WriteBytes(t_imageData.Array, t_grid[x][y]);
                return;
            }

            switch (option)
            {
            case PixelSetOptions.Ignore:
                return;

            case PixelSetOptions.RaiseError:
                throw new ArgumentOutOfRangeException(String.Format("In ImageDataGrid.SetPixel(), requested pixel {0}{1} is outside image bounds.", x, y));

            default:

                throw new ArgumentOutOfRangeException(String.Format("In ImageDataGrid.SetPixel(), PixelSetOption {0} is not supported.", option.ToString()));
            }
        }
Exemple #3
0
        public void SetPixel(byte c, int x, int y, PixelSetOptions option)
        {
            if (x >= 0 && x < Width && y >= 0 && y < Height)
            {
                t_grid[x][y] = c;
                return;
            }

            switch (option)
            {
            case PixelSetOptions.Ignore:
                return;

            case PixelSetOptions.RaiseError:
                throw new ArgumentOutOfRangeException(String.Format("In Mask.SetPixel(), requested pixel {0}{1} is outside image bounds.", x, y));

            default:

                throw new ArgumentOutOfRangeException(String.Format("In Mask.SetPixel(), PixelSetOption {0} is not supported.", option.ToString()));
            }
        }