Table of Contents

Class VideoEffectRotate

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

Represents a rotation effect that rotates the video image by a specified angle around its center point.

public class VideoEffectRotate : VideoEffect, IVideoEffectRotate, IVideoEffect

Inheritance

Implements

Inherited Members

Remarks

The rotation effect applies a geometric transformation to rotate the video frame by the specified angle in degrees. Rotation can be applied in any direction (clockwise for positive angles, counter-clockwise for negative angles).

The effect supports three rendering modes:

  • Standard rotation: Rotates within the original frame bounds, with empty areas filled with black
  • Stretch mode: Stretches the rotated image to fill the entire frame, avoiding black borders
  • NoCrop mode: Expands the frame size to fit the entire rotated image without cropping

Common use cases include:

  • Correcting camera orientation (90°, 180°, 270° rotations)
  • Creating dynamic rotating effects
  • Fixing perspective issues
  • Artistic tilted camera effects

Constructors

VideoEffectRotate(bool, double, bool, string, TimeSpan, TimeSpan, bool)

Initializes a new instance of the VisioForge.Core.Types.VideoEffects.VideoEffectRotate class with specified parameters.

public VideoEffectRotate(bool enabled, double angle, bool stretch, string name = "Rotate", TimeSpan startTime = default, TimeSpan stopTime = default, bool noCrop = false)

Parameters

enabled bool

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

angle double

The rotation angle in degrees. Positive values rotate clockwise, negative values counter-clockwise. Common values: 90, 180, 270 for orientation correction; 45 for artistic tilt.

stretch bool

true to stretch/scale the rotated image to fill the frame without black borders; false to maintain aspect ratio with potential black corners.

name string

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

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).

noCrop bool

true to expand the frame to accommodate the full rotated image without cropping; false to maintain original frame dimensions. Default is false.

Remarks

For standard orientation corrections (90°, 180°, 270°), typically use stretch set to false and noCrop set to false.

For artistic effects with arbitrary angles, consider enabling stretch to avoid black corners, or noCrop to preserve all content.

Properties

Angle

Gets or sets the rotation angle in degrees.

public double Angle { get; set; }

Property Value

double

Remarks

The angle specifies the rotation in degrees:

  • Positive values: Clockwise rotation
  • Negative values: Counter-clockwise rotation
  • 0: No rotation
  • 90, 180, 270: Common orientation corrections

The angle can be any floating-point value. Values outside 0-360 will wrap around (e.g., 450° is equivalent to 90°). Fractional degrees are supported for precise control.

Note that rotation by non-standard angles (not multiples of 90°) may result in black triangular areas at the corners unless VisioForge.Core.Types.VideoEffects.VideoEffectRotate.Stretch or VisioForge.Core.Types.VideoEffects.VideoEffectRotate.NoCrop is enabled.

NoCrop

Gets or sets a value indicating whether rotation should preserve the full frame without cropping.

public bool NoCrop { get; set; }

Property Value

bool

Remarks

When enabled, the output frame size is automatically expanded to accommodate the entire rotated image without any cropping. This creates a larger frame with the complete rotated content visible, though empty corners may contain black areas.

This mode is useful when:

  • You need to preserve all image content during rotation
  • Working with subsequent processing that can handle variable frame sizes
  • Creating effects where frame size changes are acceptable

Note: This option is mutually exclusive with VisioForge.Core.Types.VideoEffects.VideoEffectRotate.Stretch. When both are enabled, NoCrop typically takes precedence depending on the implementation.

Stretch

Gets or sets a value indicating whether the rotated image should be stretched to fill the frame.

public bool Stretch { get; set; }

Property Value

bool

Remarks

When enabled, the rotated image is scaled (stretched or zoomed) to completely fill the output frame, eliminating black borders at the expense of cropping parts of the image and potentially introducing distortion.

This is particularly useful for:

  • Small rotation angles where minimal distortion occurs
  • Situations where black borders are undesirable
  • Creating full-frame dynamic rotation effects

When disabled (default), the original frame dimensions are maintained, and empty areas created by rotation are filled with black.

Methods

GetEffectType()

Gets the specific type of this video effect.

public VideoEffectType GetEffectType()

Returns

VideoEffectType

Returns VisioForge.Core.Types.VideoEffects.VideoEffectType.Rotate to identify this as a rotation effect.

Remarks

This method is used by the video processing pipeline to route the effect to the appropriate rotation transformation processor.