Class VideoEffectDarkness
- Namespace
- VisioForge.Core.Types.VideoEffects
- Assembly
- VisioForge.Core.dll
Represents a darkness adjustment effect that darkens the image by moving each color channel toward black.
public class VideoEffectDarkness : VideoEffect, IVideoEffectDarkness, IVideoEffectInheritance
Implements
Inherited Members
Remarks
Darkness works on each RGB channel independently: a channel keeps a fraction of its own value, newChannel = channel - channel * value / 255.
A value of 0 leaves the image unchanged; the image approaches black as the value grows to 255.
This effect moves in the opposite direction to VisioForge.Core.Types.VideoEffects.VideoEffectLightness: it darkens toward black where lightness fills toward white. It is not an exact mathematical inverse of it.
This effect supports animated darkness transitions through the VisioForge.Core.Types.VideoEffects.VideoEffectDarkness.ValueStop property, enabling smooth fade-to-black effects over time.
For GPU-accelerated darkness adjustment with better performance on high-resolution video, consider using VisioForge.Core.Types.VideoEffects.GPUVideoEffectDarkness.
Constructors
VideoEffectDarkness(bool, int, int, string, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.VideoEffects.VideoEffectDarkness class with specified parameters.
public VideoEffectDarkness(bool enabled, int value, int valueStop = 0, string name = "Darkness", TimeSpan startTime = default, TimeSpan stopTime = default)Parameters
enabledbool-
trueto enable the effect immediately;falseto create the effect in a disabled state. valueint-
The initial darkness value (0-255). 0 leaves the image unchanged; larger values move each color channel toward black, and 255 produces a black image.
valueStopint-
The ending darkness 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 "Darkness".
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 darkness adjustment, only set the value parameter.
For animated darkness changes (fade effects), set both value and
valueStop along with appropriate time values.
Properties
Value
Gets or sets the darkness adjustment value.
public int Value { get; set; }Property Value
Remarks
The darkness value controls how far the image travels toward black:
- 0: No change (original image)
- 1-127: Mild to moderate darkening
- 128: Half-way to black (already heavily darkened)
- 200-254: Strong darkening
- 255: Black image
When combined with VisioForge.Core.Types.VideoEffects.VideoEffectDarkness.ValueStop, the darkness will smoothly animate from this value to the stop value over the effect's time range, creating fade effects.
Values near 255 clip detail in shadows, because every channel is pushed toward black.
ValueStop
Gets or sets the ending darkness value for animated darkness transitions.
public int ValueStop { get; set; }Property Value
Remarks
When VisioForge.Core.Types.VideoEffects.VideoEffectDarkness.ValueStop is set to a non-zero value different from VisioForge.Core.Types.VideoEffects.VideoEffectDarkness.Value, the darkness will smoothly transition from VisioForge.Core.Types.VideoEffects.VideoEffectDarkness.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 darkness remains constant at VisioForge.Core.Types.VideoEffects.VideoEffectDarkness.Value throughout the effect.
Common uses:
- Fade to black: Value=0, ValueStop=255
- Day to night transition: Value=100, ValueStop=180
Because 0 means "no animation", a transition that ends at the unchanged image cannot be expressed by a single effect instance; animate to a small non-zero value instead.
Methods
GetEffectType()
Gets the specific type of this video effect.
public VideoEffectType GetEffectType()Returns
- VideoEffectType
-
Returns VisioForge.Core.Types.VideoEffects.VideoEffectType.Darkness to identify this as a darkness adjustment effect.
Remarks
This method is used by the video processing pipeline to route the effect to the appropriate darkness adjustment processor.