Beispiel #1
0
        private void UpdatePolyLib(object sender, EventArgs e)
        {
            if (_currentTriangulation == null)
            {
                _currentTriangulation = _polyLibView.CurrentTriangulation;
            }

            var boundsWidth  = Int32.Parse(_widthTB.Text);
            var boundsHeight = Int32.Parse(_heightTB.Text);

            var variance = float.Parse(_varTB.Text);
            var cellSize = int.Parse(_sizeTB.Text);

            if (!boundsWidth.Equals(_polyLibView.Width) || !boundsHeight.Equals(_polyLibView.Height))
            {
                _polyLibView          = _polyLibView.ResizeView(boundsWidth, boundsHeight, this);
                _currentTriangulation = _polyLibView.CurrentTriangulation;
            }
            //set props on triangulation
            _currentTriangulation.Variance  = variance;
            _currentTriangulation.CellSize  = cellSize;
            _currentTriangulation.Frequency = _freqProgress;
            _currentTriangulation.Seed      = _seedProgress;

            var colors = Triangulation.getRandomColorBruColors(6);
            var shader = Triangulation.GetRandomGradientShader(colors, _currentTriangulation.BoundsWidth,
                                                               _currentTriangulation.BoundsHeight);

            _currentTriangulation.GradientShader = shader;
        }
Beispiel #2
0
        void Generate(object sender, EventArgs e)
        {
            //convert pixel height/width to point
            var boundsWidth  = (int)(Int32.Parse(widthInput.Text) / UIScreen.MainScreen.Scale);
            var boundsHeight = (int)(Int32.Parse(heightInput.Text) / UIScreen.MainScreen.Scale);

            var variance = float.Parse(varInput.Text);
            var cellSize = int.Parse(cellSizeInput.Text);

            if (!(boundsWidth == _polyLibViewRef.Frame.Width) || !(boundsHeight == _polyLibViewRef.Frame.Height))
            {
                _polyLibViewRef = _polyLibViewRef.ResizeView(boundsWidth, boundsHeight, new List <UIGestureRecognizer> {
                    _tapGestureRecognizer, _panGestureRecognizer
                });
                _currentTriangulation = _polyLibViewRef.CurrentTriangulation;
            }
            //set props on triangulation
            _currentTriangulation.Variance = variance;
            _currentTriangulation.CellSize = cellSize;

            var colors = Triangulation.getRandomColorBruColors(6);
            var shader = Triangulation.GetRandomGradientShader(colors, _currentTriangulation.BoundsWidth,
                                                               _currentTriangulation.BoundsHeight);

            _currentTriangulation.GradientShader = shader;
        }