Class DiceVideoEffect
- Namespace
- VisioForge.Core.Types.X.VideoEffects
- Assembly
- VisioForge.Core.dll
Represents a dice/pixelation effect that divides the video into a grid of square blocks with randomly shuffled positions.
public class DiceVideoEffect : BaseVideoEffect, IBaseVideoEffect, IVideoEditXVideoEffectInheritance
Implements
Inherited Members
Remarks
SDK Availability: VideoCaptureCoreX, MediaPlayerCoreX, VideoEditCoreX, Media Blocks SDK
Platforms: Windows, Linux, macOS, Android, iOS
This effect divides the video frame into a grid of square blocks (like dice) and randomly rearranges their positions, creating a chaotic, fragmented appearance. The blocks are shuffled continuously, producing a dynamic, ever-changing mosaic pattern where the original video content is recognizable but scrambled.
The dice effect is controlled by the VisioForge.Core.Types.X.VideoEffects.DiceVideoEffect.SquareBits parameter, which determines block size using a power-of-2 calculation: dice size = 2^SquareBits. For example, SquareBits=4 creates 16×16 pixel blocks.
The dice effect is commonly used for:
- Privacy/Censorship: Obscure faces or sensitive information (basic scrambling)
- Glitch Art: Create digital fragmentation effects
- Music Videos: Chaotic, energetic visual effects
- Transitions: Fragmented scene transitions
- Retro Aesthetics: Low-resolution, pixelated looks
- VJ Performances: Dynamic, randomized visuals
The random shuffling creates an unpredictable, organic effect that changes every frame, making the dice effect ideal for dynamic, attention-grabbing visuals.
This is a cross-platform effect using the dicetv element with random block shuffling.
The effect is real-time capable with efficient block-based processing.
Performance: Real-time capable on all hardware. Efficient block-based shuffling algorithm. Performance is independent of block size due to grid-based processing.
Constructors
DiceVideoEffect(string)
Initializes a new instance of the VisioForge.Core.Types.X.VideoEffects.DiceVideoEffect class with specified name.
public DiceVideoEffect(string name = "dice")Parameters
namestring-
The unique name for this effect instance. Defaults to "dice".
Fields
DefaultName
The default name for dice effects.
public static string DefaultNameField Value
Properties
SquareBits
Gets or sets the size of the square blocks as a power of 2 (dice size = 2^SquareBits).
public int SquareBits { get; set; }Property Value
Remarks
SquareBits determines the block size using exponential calculation. Smaller values create finer fragmentation with many small blocks, while larger values create coarser effects with fewer, larger blocks.
Block Size Reference:
- SquareBits 1-2: Ultra-fine (4-16 pixels), extreme fragmentation
- SquareBits 3-4: Fine to moderate (8-16 pixels), balanced effect
- SquareBits 5-6: Coarse (32-64 pixels), strong blockiness
- SquareBits 7+: Very coarse (128+ pixels), minimal fragmentation
Very small values (1-2) create thousands of tiny blocks which may be computationally intensive at very high resolutions, though the algorithm is optimized for real-time performance.
StartTime
Gets or sets the start time for the dice effect (VideoEditCoreX only).
public TimeSpan StartTime { get; set; }Property Value
Remarks
This property is only used in VideoEditCoreX for time-based effect control. In live scenarios, the effect provides continuous random block shuffling.
StopTime
Gets or sets the stop time for the dice effect (VideoEditCoreX only).
public TimeSpan StopTime { get; set; }Property Value
Remarks
This property is only used in VideoEditCoreX for time-based effect control. In live scenarios, the effect provides continuous random block shuffling.
Methods
GenerateDescription()
Generates the description.
public string GenerateDescription()Returns
- string
-
A string containing the GStreamer element description for the dice effect.