Class GPUVideoEffectInvert
- Namespace
- VisioForge.Core.Types.VideoEffects
- Assembly
- VisioForge.Core.dll
GPU-accelerated color inversion effect that creates photographic negatives by inverting all RGB values using DirectX hardware acceleration.
public class GPUVideoEffectInvert : GPUVideoEffect, IGPUVideoEffectInvert, IGPUVideoEffectInheritance
Implements
Inherited Members
Remarks
Available in: VideoCaptureCore, MediaPlayerCore, VideoEditCore (Windows only)
GPU-accelerated version using DirectX. Significantly faster than CPU equivalent for real-time processing of high-resolution video streams.
The invert effect transforms each pixel by subtracting its RGB components from 255 (the maximum color value), creating a color-negative image similar to photographic film negatives. In the inverted image, black becomes white, white becomes black, and all colors transform to their complementary opposites on the color wheel (red↔cyan, green↔magenta, blue↔yellow). The effect uses DirectX compute shaders to perform the inversion per-pixel using the formula: OutputRGB = 255 - InputRGB, enabling real-time processing with minimal CPU overhead even at 4K resolutions.
Common use cases include: creating artistic negative effects for stylized cinematography, improving visibility and contrast of certain image content (particularly useful for technical analysis or document viewing), creating high-contrast effects for computer vision and image analysis, achieving retro or experimental visual styles, simulating X-ray or thermal imaging appearances, creating psychedelic or surreal visual effects, enhancing edge detection in computer vision pipelines, and artistic music video or experimental film effects. The effect is particularly effective when applied to specific time ranges for dramatic transitions or emphasis.
Performance characteristics: GPU acceleration provides near-instantaneous inversion, processing full 4K frames in under 0.5ms on modern GPUs. The operation is extremely simple and compute-efficient, consisting of a single subtraction per color channel. One of the lightest GPU effects available, it can be combined with any number of other effects without impacting performance. Ideal for real-time applications including live streaming, recording, and playback.
Technical notes: The effect has no adjustable parameters—it performs complete color inversion on all RGB channels independently, preserving alpha/transparency if present. The inversion is perfectly reversible: applying the effect twice returns to the original colors. Unlike grayscale or other color manipulations, invert preserves all tonal information—no data is lost, only transformed. The effect operates in RGB color space; for other color space inversions (HSL, HSV), use specialized effects. Complementary color relationships: Red (255,0,0) → Cyan (0,255,255), Green (0,255,0) → Magenta (255,0,255), Blue (0,0,255) → Yellow (255,255,0). Neutral gray (128,128,128) inverts to itself.
Cross-reference to CPU equivalent: See VisioForge.Core.Types.VideoEffects.VideoEffectInvert for CPU-based alternative.
Constructors
GPUVideoEffectInvert(bool, string, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.VideoEffects.GPUVideoEffectInvert class with specified parameters.
public GPUVideoEffectInvert(bool enabled, string name = "Invert", TimeSpan startTime = default, TimeSpan stopTime = default)Parameters
enabledbool-
Whether the effect is enabled. Set to
trueto apply immediately,falseto create in disabled state. namestring-
Optional effect name for identification and retrieval. Default is "Invert".
startTimeTimeSpan-
Start time for timed effects. Default is zero (apply from beginning).
stopTimeTimeSpan-
Stop time for timed effects. Default is zero (apply until end).
Remarks
When both start and stop times are zero, the effect applies for the entire video duration. The effect type is automatically set to VisioForge.Core.Types.VideoEffects.GPUVideoEffectType.Invert. No additional configuration needed—color inversion is automatically applied using formula: OutputRGB = 255 - InputRGB for each channel.
Methods
GetEffectType()
Gets the specific type of this GPU video effect.
public GPUVideoEffectType GetEffectType()Returns
- GPUVideoEffectType
-
Returns VisioForge.Core.Types.VideoEffects.GPUVideoEffectType.Invert to identify this as a GPU-accelerated color inversion effect.
Remarks
Used by the video processing pipeline to select the appropriate DirectX shader for color inversion processing.