예제 #1
0
        private void LoadRound(string filePath)
        {
            var imageSource = new BitmapImage(new Uri(filePath));

            Animation      = CreateAnimation();
            RoundStartTime = DateTime.Now;
            PixelateEffect.BeginAnimation(PixelateEffect.SizeInPixelsProperty, Animation);
            Image = imageSource;
        }
예제 #2
0
 private void OnImageSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs)
 {
     if (Animation != null)
     {
         Animation           = CreateAnimation();
         Animation.BeginTime = -(DateTime.Now - RoundStartTime);
         PixelateEffect.BeginAnimation(PixelateEffect.SizeInPixelsProperty, Animation);
     }
 }
        public void PixelateEffect2()
        {
            var src = GetSourceImage("input.png");

            var effect = new PixelateEffect(10);

            effect.Render(src);

            Compare(src, "pixelate2.png");
        }
예제 #4
0
 public MainViewModel()
 {
     _imagesFolder   = "Resources";
     _roundDuration  = TimeSpan.FromSeconds(30);
     _pixelateEffect = new PixelateEffect()
     {
         PixelatedHeight = 1,
         PixelatedWidth  = 1,
     };
     NextRoundCommand = new Command(NextRound, o => true);
 }
    public void OnGameSettingsChanged(GameSettings newSettings)
    {
        if (_mainCamera == null)
        {
            return;
        }

        if (newSettings.pixelate)
        {
            _mainCamera.gameObject.AddComponent <PixelateEffect>();
        }
        else
        {
            PixelateEffect effect = _mainCamera.gameObject.GetComponent <PixelateEffect>();
            if (effect)
            {
                Destroy(effect);
            }
        }
    }
예제 #6
0
    public void onChangeSlider()
    {
        PixelateEffect comprovant = cam.GetComponent <PixelateEffect>();

        Debug.Assert(comprovant != null);

        float newValue = pixelEffectSlider.value;

        if (newValue == pixelEffectSlider.maxValue)
        {
            newValue           = -1;
            comprovant.enabled = false;
        }
        else
        {
            comprovant.enabled        = true;
            comprovant.verticalPixels = newValue;
        }

        PlayerPrefs.SetFloat("PixelEffect", newValue);
        PlayerPrefs.Save();
    }