Class VideoEffectContrast
- Namespace
- VisioForge.Core.Types.VideoEffects
- Assembly
- VisioForge.Core.dll
Represents a contrast adjustment effect that modifies the difference between light and dark areas in the video.
public class VideoEffectContrast : VideoEffect, IVideoEffectContrast, IVideoEffectInheritance
Implements
Inherited Members
Remarks
Contrast adjustment increases or decreases the visual separation between bright and dark regions of the image. Increasing contrast makes bright areas brighter and dark areas darker, creating more dramatic images. Decreasing contrast reduces the tonal range, creating flatter, less dramatic images.
This effect supports animated contrast changes through the VisioForge.Core.Types.VideoEffects.VideoEffectContrast.ValueStop property, which enables smooth transitions from one contrast level to another over the effect duration.
A value of 128 represents neutral contrast (no change). Values above 128 increase contrast, while values below 128 decrease it.
For GPU-accelerated contrast adjustment with better performance on high-resolution video, consider using VisioForge.Core.Types.VideoEffects.GPUVideoEffectContrast.
Constructors
VideoEffectContrast(bool, int, int, string, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.VideoEffects.VideoEffectContrast class with specified parameters.
public VideoEffectContrast(bool enabled, int value, int valueStop = 0, string name = "Contrast", TimeSpan startTime = default, TimeSpan stopTime = default)Parameters
enabledbool-
trueto enable the effect immediately;falseto create the effect in a disabled state. valueint-
The initial contrast adjustment value (0-255). A value of 128 represents neutral (no change). Values above 128 increase contrast, values below decrease it.
valueStopint-
The ending contrast 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 "Contrast".
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 contrast adjustment, only set the value parameter.
For animated contrast changes, set both value and valueStop
along with appropriate startTime and stopTime values.
Properties
Value
Gets or sets the contrast adjustment value.
public int Value { get; set; }Property Value
Remarks
The contrast value controls the tonal range of the image:
- 0: Minimum contrast (completely flat/gray image)
- 1-127: Reduced contrast (flatter appearance)
- 128: Neutral (original contrast, no change)
- 129-200: Increased contrast (more dramatic)
- 201-255: Very high contrast (may cause clipping)
When combined with VisioForge.Core.Types.VideoEffects.VideoEffectContrast.ValueStop, the contrast will smoothly animate from this value to the stop value over the effect's time range.
Extreme contrast values may cause loss of detail in highlights or shadows due to clipping at the minimum (0) or maximum (255) color values.
ValueStop
Gets or sets the ending contrast value for animated contrast transitions.
public int ValueStop { get; set; }Property Value
Remarks
When VisioForge.Core.Types.VideoEffects.VideoEffectContrast.ValueStop is set to a non-zero value different from VisioForge.Core.Types.VideoEffects.VideoEffectContrast.Value, the contrast will smoothly transition from VisioForge.Core.Types.VideoEffects.VideoEffectContrast.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 contrast remains constant at VisioForge.Core.Types.VideoEffects.VideoEffectContrast.Value throughout the effect.
This enables creating dynamic contrast effects such as gradual enhancement or reduction, fade-in/fade-out effects, or dramatic reveals.
Methods
GetEffectType()
Gets the specific type of this video effect.
public VideoEffectType GetEffectType()Returns
- VideoEffectType
-
Returns VisioForge.Core.Types.VideoEffects.VideoEffectType.Contrast to identify this as a contrast adjustment effect.
Remarks
This method is used by the video processing pipeline to route the effect to the appropriate contrast adjustment processor.