// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osuTK; using osuTK.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; namespace osu.Framework.Graphics.Effects { /// /// Creates a glow around the drawable this effect gets applied to. /// public class GlowEffect : IEffect { /// /// The strength of the glow. A higher strength means that the glow fades outward slower. Default is 1. /// public float Strength = 1f; /// /// The sigma value for the blur of the glow. This controls how spread out the glow is. Default is 5 in both X and Y. /// public Vector2 BlurSigma = new Vector2(5); /// /// The color of the outline. Default is . /// public ColourInfo Colour = Color4.White; /// /// The blending mode of the glow. Default is additive. /// public BlendingParameters Blending = BlendingParameters.Additive; /// /// Whether to draw the glow or the glowing /// . Default is . /// public EffectPlacement Placement = EffectPlacement.InFront; /// /// Whether to automatically pad by the glow extent such that no clipping occurs at the sides of the effect. Default is false. /// public bool PadExtent; /// /// True if the effect should be cached. This is an optimization, but can cause issues if the drawable changes the way it looks without changing its size. /// Turned off by default. /// public bool CacheDrawnEffect; public BufferedContainer ApplyTo(Drawable drawable) => drawable.WithEffect(new BlurEffect { Strength = Strength, Sigma = BlurSigma, Colour = Colour, Blending = Blending, Placement = Placement, PadExtent = PadExtent, CacheDrawnEffect = CacheDrawnEffect, DrawOriginal = true, }); } }