private void demoGeometryFromPoints() { tess.Reset(); tess.Forward(30); tess.Stamp(); tess.Forward(30); Point[] pts = { new Point(-10, -10), new Point(15, 0), new Point(-10, 10), new Point(-4, 0) }; // a pointy arrowHead tess.SetAppearance(Turtle.GeometryFromPoints(pts), null, null); // tess.TurtleUI.Opacity = 0.4; tess.Stamp(); tess.Forward(30); tess.Stamp(); tess.Forward(30); tess.Stamp(); tess.Forward(30); BlurEffect be = new BlurEffect(); be.Radius = 10; tess.TurtleUI.Effect = be; tess.TurtleUI.Effect = new DropShadowEffect() { Direction = 3, Color = Colors.Black, ShadowDepth = 20 }; }
private void ToolsButton_Click(object sender, RoutedEventArgs e) { IToolsDialog.IsOpen = true; BlurEffect bme = new BlurEffect(); MainGrid.Effect = bme; }
private void ShowTasks(bool animate) { ShowSavegames(false); if (animate && TaskListPanel.Visibility == Visibility.Hidden) { TaskListPanel.BeginAnimation(DockPanel.OpacityProperty, null); var anim = new DoubleAnimation(0, 2, new Duration(TimeSpan.FromSeconds(0.1))) { DecelerationRatio = 1 }; TaskListPanel.BeginAnimation(DockPanel.OpacityProperty, anim); var blur = new BlurEffect { RenderingBias = RenderingBias.Quality, Radius = 30 }; TaskListPanel.Effect = blur; var anim0 = new DoubleAnimation(10, 0, new Duration(TimeSpan.FromSeconds(0.5))) { DecelerationRatio = 1 }; anim0.Completed += (object sender, EventArgs e) => { SaveListPanel.Effect = null; }; blur.BeginAnimation(BlurEffect.RadiusProperty, anim0); } TaskListPanel.Visibility = Visibility.Visible; }
private void Export_Click(object sender, RoutedEventArgs e) { using (SaveFileDialog saveFileDialog = new SaveFileDialog()) { saveFileDialog.InitialDirectory = ProjectPath; saveFileDialog.Filter = "EPUB files (*.epub)|*.epub"; if (saveFileDialog.ShowDialog() == DResult.OK) { _ExportPath = saveFileDialog.FileName; this.IsEnabled = false; BlurEffect objBlur = new BlurEffect(); objBlur.Radius = 5; Effect = objBlur; ExportOkButton.Visibility = Visibility.Hidden; ExportCancelButton.Visibility = Visibility.Visible; ExportProgress.Visibility = Visibility.Visible; ExportWait.Content = "Please wait while exporting ..."; ///// ExportPopup.IsOpen = true; BackgroundWorker bw = new BackgroundWorker(); bw.WorkerReportsProgress = true; bw.WorkerSupportsCancellation = true; bw.DoWork += bw_DoWork; bw.ProgressChanged += bw_ProgressChanged; bw.RunWorkerCompleted += bw_RunWorkerCompleted; bw.RunWorkerAsync(); } } }
/// <summary> /// Fires when user opens pop-up window with a list of available oredrs. /// </summary> /// <param name="sender">The button New that the action is for.</param> /// <param name="e">Arguments that the implementor of this event may find useful.</param> private void ExploreOrders(object sender, RoutedEventArgs e) { try { var OrdersDict = UnitOfWorkInstance.GetOrders().ToDictionary(order => order.Id, order => $"{order.ClientData.FirstName} {order.ClientData.LastName}"); if (OrdersDict.Count > 0) { OrdersList.ItemsSource = OrdersDict; OrdersExplorer.IsOpen = true; ResetOrderInstance(); WindowMain.IsEnabled = false; EditOrderButton.IsEnabled = false; DeletOrderButton.IsEnabled = false; Opacity = 0.5; Effect = new BlurEffect(); } else { Util.Info("Explore orders", "Orders table is empty!"); } } catch (DbException exc) { Cancel(sender, e); Logger.Error($"Error occurred while retrieving orders from the database.\nError: {exc}"); Util.Error("Exploring orders error", exc.Message); } catch (Exception exc) { Cancel(sender, e); Logger.Error($"Unknown error occurred while exploring orders.\nError: {exc}"); Util.Error("Exploring orders error", exc.Message); } }
public void addBackgroundImage(ImageSource source, int blur) { VisualBrush vb = new VisualBrush(); Image im = new Image(); BlurEffect ef = new BlurEffect(); ef.Radius = blur; //FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); //try //{ // BitmapImage bitmap = new BitmapImage(); // bitmap.BeginInit(); // bitmap.StreamSource = stream; // bitmap.EndInit(); // im.Source = bitmap; //} //catch //{ // stream.Close(); // throw; //} im.Source = source; im.Effect = ef; vb.Visual = im; vb.Stretch = Stretch.UniformToFill; vb.Viewbox = new Rect(0.05, 0.05, 0.9, 0.9); ChatBorder.Background = vb; }
// -------- Editor Frame Operation -------- public void OpenEditor(Page page) { Editor.Visibility = Visibility.Visible; Editor.Navigate(page); DoubleAnimation animation = new DoubleAnimation(); animation.From = 0d; animation.To = 10d; animation.Duration = TimeSpan.FromSeconds(0.5d); BlurEffect effect; if (LeftPanel.Effect != null && LeftPanel.Effect is BlurEffect) { effect = (BlurEffect)LeftPanel.Effect; } else { effect = new BlurEffect(); } effect.Radius = 0; effect.BeginAnimation(BlurEffect.RadiusProperty, animation); LeftPanel.Effect = effect; RightPanel.Effect = effect; EditorHub.HubInstance.HideNavigatorPanel(); }
private void BlurOwner(object sender, RoutedEventArgs e) { if (!(Owner?.Content is FrameworkElement content)) { return; } _previousEffect = content.Effect; content.Effect = null; var blurEffect = new BlurEffect(); content.Effect = blurEffect; var blurEffectAnimation = new DoubleAnimation { From = 5, To = 0, Duration = TimeSpan.FromMilliseconds(50000) }; Storyboard.SetTarget(blurEffectAnimation, content); Storyboard.SetTargetProperty(blurEffectAnimation, new PropertyPath("Effect.Radius")); var sb = new Storyboard(); sb.Children.Add(blurEffectAnimation); sb.Begin(); }
public void AddBGPreview(ImageSource source) { currentImage = source.Clone(); VisualBrush vb = new VisualBrush(); Image im = new Image(); BlurEffect ef = new BlurEffect(); ef.Radius = (int)GetBlurLv(); //FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); //try //{ // BitmapImage bitmap = new BitmapImage(); // bitmap.BeginInit(); // bitmap.StreamSource = stream; // bitmap.EndInit(); // im.Source = bitmap; //} //catch //{ // stream.Close(); // throw; //} im.Source = source; im.Effect = ef; vb.Visual = im; vb.Stretch = Stretch.Uniform; vb.Viewbox = new Rect(0.05, 0.05, 0.9, 0.9); borderBG_Preview.Background = vb; ChatPage.Instance.addBackgroundImage(source, (int)GetBlurLv()); }
private void UpdateImage() { if (bmp.Handle != IntPtr.Zero) //以下代码将原始图像数据用来进行图像! { Win32Api.CopyMemory((IntPtr)bmp.Pointer, (IntPtr)DataCopy, bmp.Stride * bmp.Height); } switch (filters) { case FiltersMethod.BoxBlur: BlurEffect.BoxBlur(bmp, (int)trbValue.Value); break; case FiltersMethod.Mosaic: BlurEffect.Mosaic(bmp, (int)trbValue.Value); break; } Graphics G = picPreview.CreateGraphics(); IntPtr Hdc = G.GetHdc(); bmp.DrawImage(Hdc, DestX, DestY, ViewWidth, ViewHeight, 0, 0, bmp.Width, bmp.Height); G.ReleaseHdc(); G.Dispose(); picPreview.Invalidate(); Graphics Gcanvas = canvas.CreateGraphics(); IntPtr canvasHdc = Gcanvas.GetHdc(); bmp.DrawImage(canvasHdc, 0, 0, canvas.Width, canvas.Height, 0, 0, bmp.Width, bmp.Height); Gcanvas.ReleaseHdc(); Gcanvas.Dispose(); canvas.Invalidate(); }
public Effect getEffect() { BlurEffect blur = new BlurEffect(); blur.Radius = 15; return(blur); }
} // method private void _dishDescrWithoutAnimation() { if (_showDescription == true) { _btnDescr.Background = _brushSelectedItem; _descrTextBorder.Visibility = Visibility.Visible; _descrTextBorder.Opacity = 0.6; _descrText.Visibility = Visibility.Visible; _descrText.Opacity = 1; if ((_descrText.Effect != null) && (_descrText.Effect is BlurEffect)) { BlurEffect be = (_descrText.Effect as BlurEffect); if (be.Radius != 0) { be.Radius = 0; } } } else { _btnDescr.Background = Brushes.White; _descrTextBorder.Visibility = Visibility.Hidden; _descrTextBorder.Opacity = 0; _descrText.Visibility = Visibility.Hidden; _descrText.Opacity = 0; } }
private BloomEffect bloomEffect; //BloomEffect /// <summary> /// Effectを管理するクラス /// </summary> /// <param name="graphicsDevice">グラフィック機器</param> /// <param name="contents">コンテントマネージャー</param> public EffectManager(GraphicsDevice graphicsDevice, ContentManager contents) { this.graphicsDevice = graphicsDevice; basicEffect = new BasicEffect(graphicsDevice); miniMapEffect = new BasicEffect(graphicsDevice); basicEffect.VertexColorEnabled = true; //頂点色を有効 miniMapEffect.VertexColorEnabled = true; //頂点色を有効 currentEffect = basicEffect; blurEffect = new BlurEffect( //BlurEffectをShaderから読み取って生成する graphicsDevice, contents.Load <Effect>("./Effect/blur")); blurEffect.Initialize(); //初期化 polygonEffect = new PolygonEffect( contents.Load <Effect>("./Effect/polygon")); depthEffect = new DepthEffect( graphicsDevice, contents.Load <Effect>("./Effect/depth")); bloomEffect = new BloomEffect( graphicsDevice, contents.Load <Effect>("./Effect/hightLight"), contents.Load <Effect>("./Effect/bloom"), new BlurEffect( graphicsDevice, contents.Load <Effect>("./Effect/blur"))); }
private void SpawnParticle(Ellipse e) { // Randomization double x = RandomWithVariance(Canvas.ActualWidth / 2, Canvas.ActualWidth / 2); double y = Canvas.ActualHeight; double z = 10 * (random.NextDouble() * 100); double speed = RandomWithVariance(20, 15); double size = RandomWithVariance(75, 50); Particle p = new Particle(); p.Position = new Point3D(x, y, z); p.Size = size; // Blur var blur = new BlurEffect(); blur.RenderingBias = RenderingBias.Performance; blur.Radius = RandomWithVariance(10, 15); p.Blur = blur; // Brush (for opacity) var brush = (Brush)Brushes.White.Clone(); brush.Opacity = RandomWithVariance(0.5, 0.5); p.Brush = brush; TranslateTransform t; if (e != null) // re-use { e.Fill = null; e.Width = e.Height = size; p.Ellipse = e; t = e.RenderTransform as TranslateTransform; } else { p.Ellipse = new Ellipse(); p.Ellipse.Width = p.Ellipse.Height = size; Canvas.Children.Add(p.Ellipse); t = new TranslateTransform(); p.Ellipse.RenderTransform = t; p.Ellipse.RenderTransformOrigin = new Point(0.5, 0.5); } t.X = p.Position.X; t.Y = p.Position.Y; // Speed double velocityMultiplier = (random.NextDouble() + 0.25) * speed; double vX = (1.0 - (random.NextDouble() * 2.0)) * velocityMultiplier; // Only going from the bottom of the screen to the top (for now) double vY = -Math.Abs((1.0 - (random.NextDouble() * 2.0)) * velocityMultiplier); p.Velocity = new Point3D(vX, vY, 0); this.particles.Add(p); }
public MainWindow() { InitializeComponent(); //get the model from the xaml model = DataContext as LetterWallViewModel; //disable message entry until connected MessageTextBox.IsEnabled = false; SendMessageButton.IsEnabled = false; StopButton.IsEnabled = false; //set opacity on lights to off value ConnectionStatusLedImage.Opacity = LedOffOpacity; LogoImage.Opacity = LogoOffOpacity; LogoImageBlurLayer.Opacity = LogoOffOpacity; //init effects to 0 - will animate later _ledBlurEffect = new BlurEffect { Radius = 0 }; _logoBlurEffect = new BlurEffect { Radius = 0 }; //assign effects ConnectionStatusLedImage.Effect = _ledBlurEffect; LogoImageBlurLayer.Effect = _logoBlurEffect; _opcClient = new OpcClient(); _letterWall = new LetterWall(); }
public Pokemon2D() { IsHitTestVisible = false; UseLayoutRounding = true; Image = new Image() { Stretch = Stretch.UniformToFill }; Image.SnapsToDevicePixels = true; Image.Effect = ImageEffect = new BlurEffect() { Radius = 0, KernelType = KernelType.Box }; Children.Add(Image); FaintAnimation = new DoubleAnimation(0, 0, Duration.Automatic); FaintAnimation.Completed += (sender, e) => { Image.Source = null; Pokemon.RemoveListener(this); Pokemon = null; Image.BeginAnimation(Image.HeightProperty, null); }; BeginChangeImageAnimation = new DoubleAnimation(0, 15, new Duration(TimeSpan.FromSeconds(0.5))); EndChangeImageAnimation = new DoubleAnimation(0, new Duration(TimeSpan.FromSeconds(0.5))); BeginChangeImageAnimation.Completed += (sender, e) => { RefreshImage(); ImageEffect.BeginAnimation(BlurEffect.RadiusProperty, EndChangeImageAnimation); }; }
private void placeOrderBtn(object sender, RoutedEventArgs e) { widgetCheckGrid.Visibility = Visibility.Visible; blur = new BlurEffect(); blur.Radius = 20; listView.Effect = blur; }
private async Task DarkenAsync() { WebBrowser_Today.Visibility = Visibility.Hidden; // sry but we have to do this Grid_AnimationContainer.Visibility = Visibility.Visible; var animation = new DoubleAnimation { From = 0, To = 5, Duration = new TimeSpan(0, 0, 0, 0, 625) }; animation.EasingFunction = new PowerEase() { Power = 15, EasingMode = EasingMode.EaseOut }; var effect = new BlurEffect() { KernelType = KernelType.Gaussian, Radius = 0 }; Grid_Master.Effect = effect; Grid_Master.Effect.BeginAnimation(BlurEffect.RadiusProperty, animation); var sb = Grid_AnimationContainer.FindResource("DarkenAnimation") as Storyboard; await sb.BeginAsync(); }
private void Awake() { camera = Camera.main.transform; fogEffect = ppProfile.GetSetting <UWFogEffect>(); uwEffect = ppProfile.GetSetting <UWEffect>(); blurEffect = ppProfile.GetSetting <BlurEffect>(); }
public static async Task <ImageSource> BlurImageAsync([NotNull] IBuffer buffer, int blur) { using (Stream imageStream = buffer.AsStream()) using (IRandomAccessStream randomImageStream = imageStream.AsRandomAccessStream()) { BitmapDecoder decoder; try { decoder = await BitmapDecoder.CreateAsync(randomImageStream); } catch { // Invalid image data return(null); } randomImageStream.Seek(0); using (RandomAccessStreamImageSource imageProvider = new RandomAccessStreamImageSource(randomImageStream)) using (BlurEffect blurEffect = new BlurEffect(imageProvider) { KernelSize = blur }) { WriteableBitmap blurred = new WriteableBitmap((int)decoder.PixelWidth, (int)decoder.PixelHeight); return(await blurEffect.GetBitmapAsync(blurred, OutputOption.Stretch)); } } }
public void TestEffect() { var element = Button(); var effect = new BlurEffect(); element.Effect(effect).Effect.Should().Be(effect); }
public override void Draw() { SpriteBatch.Begin(); //SHADERS START if (blurEffect == null) { blurEffect = new BlurEffect(SpriteBatch.GraphicsDevice, Content); } SpriteBatch.End(); blurEffect.start(); SpriteBatch.Begin(); SpriteBatch.Draw(background, background_dest, Color.Navy); visualizer.Draw(SpriteBatch); //pad.Draw(SpriteBatch); //lifebar.Draw(SpriteBatch); // SHADERS END SpriteBatch.End(); blurEffect.applyEffect(SpriteBatch); SpriteBatch.Begin(); pad.Draw(SpriteBatch); lifebar.Draw(SpriteBatch); grades.Draw(SpriteBatch); //runner.Draw(SpriteBatch); SpriteBatch.End(); base.Draw(); }
public NumberInput(string title, string description) { InitializeComponent(); Opacity = 0; var anim = new DoubleAnimation(1, new Duration(TimeSpan.FromSeconds(0.1))) { DecelerationRatio = 1 }; BeginAnimation(Window.OpacityProperty, anim); var blur = new BlurEffect { Radius = 10, RenderingBias = RenderingBias.Quality }; Effect = blur; var anim0 = new DoubleAnimation(1, new Duration(TimeSpan.FromSeconds(0.4))) { DecelerationRatio = 1 }; blur.BeginAnimation(BlurEffect.RadiusProperty, anim0); Title = title; Description.Text = description; }
double[] opacityArr; // control the opacity for each label in the column public MColumnComet(Point StartPoint, float FontSize, double ScreenHeight, Canvas BackgroundCanvas, string TextSet, int LenCount, int VerticalDistance = 0) : base(StartPoint, FontSize, ScreenHeight, BackgroundCanvas, TextSet) { len = LenCount; verticalDist = (0 == VerticalDistance) ? (int)Math.Ceiling(FontSize): VerticalDistance; columnHeight = ScreenHeight + VerticalDistance * len; cursor = len - 1; opacityArr = new double[len]; double opaDelta = 1f / len; for (int i = 0; i < len; i++) { opacityArr[i] = (i + 1) * opaDelta; } lbArr = new Label[len]; for (int i = 0; i < len; i++) { Label l = new Label(); l.Content = textSet.Substring(rd.Next(textSet.Length), 1); l.FontSize = fontSize; l.Foreground = new SolidColorBrush(Colors.ForestGreen); BlurEffect b = new BlurEffect(); b.Radius = 2; l.Effect = b; l.Opacity = opacityArr[i]; l.Margin = new Thickness(startPoint.X, (startPoint.Y + i * verticalDist) % columnHeight, 0, 0); BackgroundCanvas.Children.Add(l); lbArr[i] = l; } }
private void CreateParticle() { // Brush (White) var brush = Brushes.White.Clone(); // Opacity (0.2 <= 1) brush.Opacity = 0.2 + random.NextDouble() * 0.8; // Blur effect var blur = new BlurEffect(); blur.RenderingBias = RenderingBias.Performance; // Radius (1 <= 40) blur.Radius = 1 + random.NextDouble() * 39; // Ellipse var ellipse = new Ellipse(); // Size (from 15% to 95% of MaxSize) ellipse.Width = ellipse.Height = MaxSize * 0.15 + random.NextDouble() * MaxSize * 0.8; // Starting location of the ellipse (anywhere in the screen) ellipse.RenderTransform = new TranslateTransform(random.NextDouble() * Width, random.NextDouble() * Height); ellipse.Tag = new Particle { Blur = blur, Brush = brush, Velocity = new Point { X = HorizontalVelocity + random.NextDouble() * 4, Y = VerticalVelocity + random.NextDouble() * 2 } }; // Add the ellipse to the Canvas ParticleHost.Children.Add(ellipse); }
public new void ShowDialog() { UIElement root = null; BlurEffect blur = null; if (Owner != null) { root = Owner.Content as UIElement; blur = new BlurEffect(); blur.Radius = 0; root.Effect = blur; root.AnimateEase(UIElement.OpacityProperty, 1, 0.6, TimeSpan.FromSeconds(1)); blur.AnimateEase(BlurEffect.RadiusProperty, 1, 4, TimeSpan.FromSeconds(0.5)); // NOTE: Blur radius is internally converted to integer which is bad for slow animations. // See https://social.msdn.microsoft.com/Forums/vstudio/en-US/ced0cc07-44fd-43e7-8829-e329be038d82 } base.ShowDialog(); if (root != null && blur != null) { root.AnimateEase(UIElement.OpacityProperty, 0.6, 1, TimeSpan.FromSeconds(0.2)); blur.AnimateEase(BlurEffect.RadiusProperty, 4, 0, TimeSpan.FromSeconds(0.2)); DelayedCall.Start(() => { root.Effect = null; }, 250); } }
private void ApplyEffect(Window win) { BlurEffect objBlur = new BlurEffect(); objBlur.Radius = 4; win.Effect = objBlur; }
private void OnMoveMade(object sender, HandledEventArgs e) { // Blur or unblur based on whether the move was a valid one. BlurEffect blur = new BlurEffect(); blur.Radius = 2; //BlurBitmapEffect blur = (BlurBitmapEffect)ControlPanel.BitmapEffect; //ControlPanel.Effect.SetValue(); ControlPanel.Effect = blur; if (blur != null) { if (e.Handled) { if (blur.Radius >= 2.0) { blur.Radius -= 2.0; } StatusLabel.Content = ""; } else { blur.Radius += 2.0; StatusLabel.Content = "Bad Move!"; } } }
public void OnEnable() { Color clearColor = new Color(0f, 0f, 0f, 0f); //Set up catch cameras. runtimeDatasMap.Clear(); foreach (var pair in lightLayerMap) { var runtimeData = new LayerRuntimeData(); var go = GoUtils.AddAnEmptyGameObject("Catch " + pair.Key, transform); var camera = CameraUtils.AddRenderCamera(go, pair.Value.catchLayer); camera.depth = -2; camera.backgroundColor = clearColor; runtimeData.catchCamera = camera; runtimeData.catchTexture = ScreenTextureAllocator.generateRenderTexture(); runtimeData.catchCamera.targetTexture = runtimeData.catchTexture; StartCoroutine(UpdateRuntimeData(runtimeData)); runtimeDatasMap.Add(pair.Key, runtimeData); } MixEffect.SetLightMixShader(LightMixMesh); MixEffect.SetScreenMixShader(ScreenMix); BlurEffect.SetShader(BlurShader); finalTexture = ScreenTextureAllocator.generateRenderTexture(); layers = new List <string>(lightLayerMap.Keys); layers.Sort((ll, rl) => lightLayerMap[ll].depth.CompareTo(lightLayerMap[rl].depth)); originMainCameraCullingMask = Camera.main.cullingMask; Camera.main.cullingMask = finalTexLayerMask; }
public static async Task <Tuple <ImageSource, ImageSource> > GetImageAndBlurredCopyFromPixelDataAsync([NotNull] IBuffer buffer, int blur) { // Check if the input is valid if (buffer.Length == 0) { return(null); } // Apply the blur effect on a copy of the original image using (Stream imageStream = buffer.AsStream()) using (IRandomAccessStream randomImageStream = imageStream.AsRandomAccessStream()) { // Load the default image BitmapImage original = new BitmapImage(); await original.SetSourceAsync(randomImageStream); // Blur the copy of the image randomImageStream.Seek(0); using (RandomAccessStreamImageSource imageProvider = new RandomAccessStreamImageSource(randomImageStream)) using (BlurEffect blurEffect = new BlurEffect(imageProvider) { KernelSize = blur }) { // Process the blurred image WriteableBitmap blurred = new WriteableBitmap((int)original.PixelWidth, (int)original.PixelHeight); await blurEffect.GetBitmapAsync(blurred, OutputOption.Stretch); // Return the two images return(Tuple.Create <ImageSource, ImageSource>(original, blurred)); } } }
// Use this for initialization void Start() { blurEfect = Camera.main.GetComponent<BlurEffect>(); blurEfect.blurSpread = 0; blurEfect.iterations = 0; blurEfect.enabled = false; }
// Use this for initialization void Start() { gc = gameObject.GetComponent<GameController>(); be = gameObject.GetComponent<BlurEffect>(); cs = gameObject.GetComponent<CameraShake>(); fe = gameObject.GetComponent<FadeEffect>(); te = gameObject.GetComponent<TwirlEffect>(); gt = gameObject.GetComponent<GameTimer>(); }
void Awake() { sceneFader = GameObject.FindGameObjectWithTag("GameController").GetComponent<SceneFader>(); butRect = new Rect((Screen.width - ctrlWidth)/2,0,ctrlWidth, ctrlHeight); bgMusic = GameObject.FindGameObjectWithTag("GameController").GetComponent<AudioSource>(); blurEffect = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<BlurEffect>(); }
/// <summary> /// Constructs a high pass effect with the specified parameters. /// </summary> /// <param name="kernelSize">The size of the filter kernel. A larger size preserves more of lower frequencies.</param> /// <param name="isGrayscale">True if the highpass effect should give a grayscale result. Otherwise the individual R, G, B channels are treated separately.</param> /// <param name="downscaleDivisor">How much to downscale the image to reduce the cost of the internal blur operation, trading speed for some fidelity. Suitable value depends on the kernelSize.</param> public HighpassEffect(uint kernelSize, bool isGrayscale = false, uint downscaleDivisor = 1) { m_kernelSize = kernelSize; m_downscaleDivisor = downscaleDivisor; m_isGrayscale = isGrayscale; if (m_downscaleDivisor > 1) { m_downscaleEffect = new ScaleEffect(/*source*/ 1.0 / m_downscaleDivisor); m_downscaleCachingEffect = new CachingEffect(m_downscaleEffect); int blurKernelSize = Math.Max(1, (int)(3.0 * m_kernelSize / m_downscaleDivisor)); m_blurEffect = new BlurEffect(m_downscaleCachingEffect) { KernelSize = blurKernelSize }; m_highPassBlendEffect = new BlendEffect( /*source*/) { ForegroundSource = m_blurEffect, BlendFunction = BlendFunction.SignedDifference }; } else { int blurKernelSize = Math.Max(1, (int)(3.0 * m_kernelSize)); m_blurEffect = new BlurEffect() { KernelSize = blurKernelSize }; m_highPassBlendEffect = new BlendEffect( /*source*/) { ForegroundSource = m_blurEffect, BlendFunction = BlendFunction.SignedDifference }; } if (m_isGrayscale) { m_highPassGrayscaleEffect = new GrayscaleEffect(m_highPassBlendEffect); } }
void Start() { disableGUIElements (); backgroundGradient.enabled = false; promptPosYLerpEnd = -((Screen.height/9)*8); promptPosYLerp = promptPosYLerpEnd + padding50; promptPosYLerpStart = promptPosYLerp; screenYSplit9set3 = -((Screen.height / 9) *3); // setFormatting = GetComponent<Formatter> (); blurControl = Camera.main.GetComponent<BlurEffect> (); // Debug.Log ("BLUR CONTROL ENABLED?: " + blurControl.enabled); blurControl.enabled = false; }
void Start() { blurefecto= camarablur.gameObject.GetComponent<BlurEffect>(); bluractivo=false; }
/** * initializes everything needed for seebright * Called specifically from Game Manager class */ public void initSeebright() { if(_SBLHS != null || _SBRHS != null) { Debug.LogError("Already enabled seebright for camera controller!"); return; } SBCamera sbCamera = GetComponent<SBCamera>(); if(sbCamera == null) { Debug.LogError("No Seebright Camera attached to main camera object!"); return; } sbCamera.enabled = true; //return if it just got enabled for the first time if(sbCamera.sbLeftCamera == null || sbCamera.sbRightCamera == null) { return; } _SBLHS = sbCamera.sbLeftCamera.GetComponentInChildren<Camera>(); _SBRHS = sbCamera.sbRightCamera.GetComponentInChildren<Camera>(); //Get RetroPixel shaders _retroPixelShaderLHS = _SBLHS.gameObject.AddComponent<AlpacaSound.RetroPixel>(); _retroPixelShaderRHS = _SBRHS.gameObject.AddComponent<AlpacaSound.RetroPixel>(); _retroPixelShaderLHS.enabled = false; _retroPixelShaderRHS.enabled = false; //Blur shader _blurShaderLHS = _SBLHS.gameObject.AddComponent<BlurEffect>(); _blurShaderRHS = _SBRHS.gameObject.AddComponent<BlurEffect>(); _blurShaderLHS.blurShader = (Shader)Resources.Load("Shaders/BlurEffectConeTaps"); _blurShaderRHS.blurShader = (Shader)Resources.Load("Shaders/BlurEffectConeTaps"); _blurShaderLHS.enabled = false; _blurShaderRHS.enabled = false; //Fast Bloom shaders //_SBLHS.gameObject.AddComponent<FastBloom>(); }
void Start() { //Implements Singleton if(currentCamera != null) { Debug.LogError("Can't have more than one camera!"); return; } _retroPixelShader = GetComponent<AlpacaSound.RetroPixel>(); _blurShader = GetComponent<BlurEffect>(); currentCamera = this; _mainCamera = gameObject.camera; }
void Start() { _tagsToRevert = new ArrayList(); _blurEffect = Camera.main.GetComponent<BlurEffect>(); }