Exemple #1
0
        protected virtual void OnRenderImage(RenderTexture source, RenderTexture destination)
        {
            if (blurAlgorithm == null || BlurConfig == null)
            {
                goto draw_unmodified;
            }

            if (shouldUpdateBlur())
            {
                //Resize final texture if base downsample changed
                if (Downsample != lastDownsample || !BlurRegion.Approximately(lastBlurRegion))
                {
                    CreateNewBlurredScreen();
                    lastDownsample = Downsample;
                    lastBlurRegion = BlurRegion;
                }

                blurAlgorithm.Blur(source, BlurRegion, ref blurredScreen);
            }

            if (preview)
            {
                previewMaterial.SetVector(ShaderProperties.blurTextureCropRegion, BlurRegion.ToMinMaxVector());
                Graphics.Blit(BlurredScreen, destination, previewMaterial);
                return;
            }

draw_unmodified:
            Graphics.Blit(source, destination);
        }
Exemple #2
0
 void BlurAndSave()
 {
     _internalBitmap = _blurAlgorithm.Blur(_internalBitmap, _blurRadius);
     if (!_blurAlgorithm.CanModifyBitMap)
     {
         _internalCanvas.SetBitmap(_internalBitmap);
     }
 }
Exemple #3
0
        protected virtual void OnRenderImage(RenderTexture source, RenderTexture destination)
        {
            if (blurAlgorithm == null || BlurConfig == null)
            {
                goto draw_unmodified;
            }

            if (shouldUpdateBlur())
            {
                OnBeforeBlur();
                blurAlgorithm.Blur(source, BlurRegion, ref blurredScreen);
            }

            if (preview)
            {
                previewMaterial.SetVector(ShaderId.CROP_REGION, BlurRegion.ToMinMaxVector());
                Graphics.Blit(BlurredScreen, destination, previewMaterial);
                return;
            }

draw_unmodified:
            Graphics.Blit(source, destination);
        }