Class ShapeGlow
A soft glow outside a shape's outline. Glow holds one; each draw call captures its values as it is made.
public sealed class ShapeGlow
- Inheritance
-
ShapeGlow
Examples
shapes.Glow.Set(8f, new Color(0, 0, 0, 200)); // a dark halo
shapes.DrawRing(cursor, Vector3.UnitY, 0.9f, Color.White);
shapes.Glow.Clear();
Remarks
The glow lies outside the shape only, never under the fill or the border, and fades out quadratically from the border's outer edge over Width pixels - constant at any distance, like the border. For a stroke-only ring or arc the shape is the stroke, so the glow sits on both sides of it, which is what makes a light ring with a dark glow readable on any background.
Properties
Additive
Whether the glow adds its light to whatever is behind it rather than covering it. Off by default: a glow then behaves like a soft, translucent halo that can darken as well as lighten. On, it is a neon bloom that only ever brightens - a black glow adds nothing.
public bool Additive { get; set; }
Property Value
Color
The glow's colour, or null (the default) to glow in the outline colour. Its alpha is
the glow's strength at the outline, before the fade - and it is the number that decides what
the glow reads as. At full alpha the halo is solid colour where it meets the edge and only
then falls off, so a thin stroke looks like a fatter stroke; at 30 to 40 percent it reads as
light around the stroke, which is the neon look. Start there.
public Color? Color { get; set; }
Property Value
Strength
How strong a glow in the outline colour is at the outline, 0 to 1. The default 1 is the
outline colour as it is, which reads as a fatter stroke; 0.35f is the neon look in
every shape's own colour. It is the knob for the case where there is no colour of your own
to give an alpha to: a Color you set carries its own alpha and is used as given.
public float Strength { get; set; }
Property Value
Width
Width of the glow in on-screen pixels. The default 0 draws none. A few pixels reads as a crisp halo and a few dozen as a neon bloom.
public float Width { get; set; }
Property Value
Methods
Clear()
No glow, back to the outline colour at full strength, and not additive.
public void Clear()
Set(float, Color?)
Sets both at once.
public void Set(float width, Color? color = null)