Table of Contents

Class VideoEffectDarkness

Namespace
VisioForge.Core.Types.VideoEffects
Assembly
VisioForge.Core.dll

Represents a darkness adjustment effect that controls the overall darkness/lightness of the video image.

public class VideoEffectDarkness : VideoEffect, IVideoEffectDarkness, IVideoEffect

Inheritance

Implements

Inherited Members

Remarks

The darkness effect uniformly adjusts the brightness of all pixels in the video by subtracting or adding a constant value from their RGB components. Unlike brightness which adds light, darkness reduces the luminance creating darker or lighter images depending on the value.

A value of 128 represents neutral (no change). Values above 128 darken the image, while values below 128 lighten it. This effect is the inverse of brightness adjustment.

This effect supports animated darkness transitions through the VisioForge.Core.Types.VideoEffects.VideoEffectDarkness.ValueStop property, enabling smooth fade-to-black or fade-from-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

enabled bool

true to enable the effect immediately; false to create the effect in a disabled state.

value int

The initial darkness adjustment value (0-255). A value of 128 represents neutral (no change). Values above 128 darken the image, values below lighten it.

valueStop int

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.

name string

An optional name identifier for this effect instance. Default is "Darkness".

startTime TimeSpan

The time at which the effect should start being applied. Default is zero (from beginning).

stopTime TimeSpan

The time at which the effect should stop being applied. Default is zero (until end). Required when using valueStop to 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

int

Remarks

The darkness value controls the overall luminance of the image:

  • 0: Maximum lightening (near white)
  • 1-127: Lightening effect (brighter image)
  • 128: Neutral (original darkness, no change)
  • 129-200: Darkening effect (darker image)
  • 201-255: Maximum darkening (approaching black)

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.

Extreme values may cause loss of detail due to clipping. Very high values push pixels toward black, while very low values push toward white.

ValueStop

Gets or sets the ending darkness value for animated darkness transitions.

public int ValueStop { get; set; }

Property Value

int

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=128, ValueStop=255
  • Fade from black: Value=255, ValueStop=128
  • Day to night transition: Value=100, ValueStop=180

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.