Class VideoEffectLightness
- Namespace
- VisioForge.Core.Types.VideoEffects
- Assembly
- VisioForge.Core.dll
Represents a lightness adjustment effect that modifies the overall brightness while preserving color hue and saturation.
public class VideoEffectLightness : VideoEffect, IVideoEffectLightness, IVideoEffectInheritance
Implements
Inherited Members
Remarks
Lightness adjustment modifies the L component in the HSL (Hue, Saturation, Lightness) color space, affecting how light or dark colors appear without changing their hue or saturation. This differs from brightness adjustment which operates in RGB space and can affect color relationships.
A value of 128 represents neutral lightness (no change). Values above 128 increase lightness (making the image lighter), while values below 128 decrease it (making darker).
This effect supports animated lightness transitions through the VisioForge.Core.Types.VideoEffects.VideoEffectLightness.ValueStop property, enabling smooth fade-in/fade-out effects or day-to-night transitions while maintaining color purity.
Key differences from similar effects:
- Lightness: Adjusts perceived brightness in HSL space, preserving hue/saturation
- Brightness: Adds/subtracts uniform RGB values, may shift colors
- Darkness: Inverse of brightness, darkens the image
- Contrast: Expands or compresses the tonal range
Constructors
VideoEffectLightness(bool, int, int, string, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.VideoEffects.VideoEffectLightness class with specified parameters.
public VideoEffectLightness(bool enabled, int value, int valueStop = 0, string name = "Lightness", TimeSpan startTime = default, TimeSpan stopTime = default)Parameters
enabledbool-
trueto enable the effect immediately;falseto create the effect in a disabled state. valueint-
The initial lightness adjustment value (0-255). A value of 128 represents neutral (no change). Values above 128 lighten the image, values below darken it.
valueStopint-
The ending lightness value for animated transitions (0-255). Default is 0 (no animation). When non-zero and different from
value, creates a smooth transition. namestring-
An optional name identifier for this effect instance. Default is "Lightness".
startTimeTimeSpan-
The time at which the effect should start being applied. Default is zero (from beginning).
stopTimeTimeSpan-
The time at which the effect should stop being applied. Default is zero (until end). Required when using
valueStopto define the animation duration.
Remarks
For static lightness adjustment, only set the value parameter.
For animated lightness changes, set both value and valueStop
along with appropriate time values.
Lightness adjustment is particularly useful for color-accurate brightness modification where maintaining color hue is important.
Properties
Value
Gets or sets the lightness adjustment value.
public int Value { get; set; }Property Value
Remarks
The lightness value controls the overall brightness while preserving color:
- 0: Maximum darkness (approaching black)
- 1-127: Darkening effect
- 128: Neutral (original lightness, no change)
- 129-200: Lightening effect
- 201-255: Maximum lightness (approaching white)
When combined with VisioForge.Core.Types.VideoEffects.VideoEffectLightness.ValueStop, the lightness will smoothly animate from this value to the stop value over the effect's time range.
Unlike brightness, lightness adjustment works in perceptual color space (HSL), providing more natural-looking results that maintain color relationships.
ValueStop
Gets or sets the ending lightness value for animated lightness transitions.
public int ValueStop { get; set; }Property Value
Remarks
When VisioForge.Core.Types.VideoEffects.VideoEffectLightness.ValueStop is set to a non-zero value different from VisioForge.Core.Types.VideoEffects.VideoEffectLightness.Value, the lightness will smoothly transition from VisioForge.Core.Types.VideoEffects.VideoEffectLightness.Value to this value over the time period defined by VisioForge.Core.Types.VideoEffects.VideoEffect.StartTime and VisioForge.Core.Types.VideoEffects.VideoEffect.StopTime.
If set to 0 (default), the lightness remains constant at VisioForge.Core.Types.VideoEffects.VideoEffectLightness.Value throughout the effect.
Common animated effects:
- Fade to white: Value=128, ValueStop=255
- Fade from white: Value=255, ValueStop=128
- Sunrise effect: Value=50, ValueStop=180
- Sunset effect: Value=180, ValueStop=100
Methods
GetEffectType()
Gets the specific type of this video effect.
public VideoEffectType GetEffectType()Returns
- VideoEffectType
-
Returns VisioForge.Core.Types.VideoEffects.VideoEffectType.Lightness to identify this as a lightness adjustment effect.
Remarks
This method is used by the video processing pipeline to route the effect to the appropriate HSL-based lightness adjustment processor.