Class OverlayManagerBlock
- Assembly
- VisioForge.Core.dll
Overlay manager block for dynamic multi-layer video overlay composition and management. This block provides a centralized system for managing multiple overlay elements on video content, supporting various overlay types including images, text, shapes, and animated graphics. Features include layer ordering, opacity control, positioning, blending modes, and real-time overlay updates. Essential for broadcast graphics, live production, watermarking, subtitles, and any application requiring dynamic overlay composition with runtime management capabilities. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class OverlayManagerBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
OverlayManagerBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.OverlayManagerBlock class for managing multiple video overlays.
public OverlayManagerBlock()Properties
Input
Gets the input.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the outputs.
public override MediaBlockPad[] Outputs { get; }Property Value
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Constructs and initializes the overlay manager filter and its associated GStreamer elements. This method creates the filter, establishes input and output pads, and prepares the block for managing multiple overlay layers on video content.
public override bool Build()Returns
- bool
-
trueif the filter was successfully built and configured;falseif initialization failed.
CleanUp()
Releases all resources and performs cleanup operations for this overlay manager block. This method resets the build state but does not dispose of the GStreamer elements.
public void CleanUp()Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets the core BaseElement wrapper that provides additional functionality around the GStreamer overlay manager filter element.
public BaseElement GetCore()Returns
- BaseElement
-
The BaseElement wrapper instance that encapsulates the GStreamer overlay manager filter.
GetElement()
Gets the underlying GStreamer element that performs the overlay management.
public Element GetElement()Returns
- Element
-
The GStreamer Element instance representing the overlay manager filter.
IsAvailable()
Determines whether this media block is available. Correct NuGet SDK redist should be included into your project.
public static bool IsAvailable()Returns
- bool
-
trueif this media block is available; otherwise,false.
Video_Overlay_Add(IOverlayManagerElement)
Adds a new overlay element to the video composition. The overlay will be rendered on top of the video content according to its properties.
public void Video_Overlay_Add(IOverlayManagerElement overlay)Parameters
overlayIOverlayManagerElement-
The overlay element to add to the composition.
Video_Overlay_AddBackground(string, string)
Adds a background image that fills the entire frame. The image is drawn behind all other overlays (ZIndex = -1000).
public OverlayManagerImage Video_Overlay_AddBackground(string filename, string name = "Background")Parameters
Returns
- OverlayManagerImage
-
The created image element for later modification or removal.
Video_Overlay_AddFade(OverlayManagerFadeType, TimeSpan, TimeSpan, (byte R, byte G, byte B)?, OverlayManagerPanEasing, string)
Adds a custom fade effect with full control over parameters.
public OverlayManagerFade Video_Overlay_AddFade(OverlayManagerFadeType fadeType, TimeSpan startTime, TimeSpan endTime, (byte R, byte G, byte B)? fadeColor = null, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear, string name = "Fade")Parameters
fadeTypeOverlayManagerFadeType-
The type of fade (FadeIn or FadeOut).
startTimeTimeSpan-
The fade start time.
endTimeTimeSpan-
The fade end time.
fadeColor(byte R, byte G, byte B)?-
Optional fade color (default is black).
easingOverlayManagerPanEasing-
The easing function for smooth animation.
namestring-
Optional name for the fade effect.
Returns
- OverlayManagerFade
-
The created fade element for later modification or removal.
Video_Overlay_AddFadeIn(TimeSpan, TimeSpan?, OverlayManagerPanEasing, string)
Adds a fade-in effect from black (or specified color) to video.
public OverlayManagerFade Video_Overlay_AddFadeIn(TimeSpan duration, TimeSpan? startTime = null, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear, string name = "FadeIn")Parameters
durationTimeSpan-
The duration of the fade-in effect.
startTimeTimeSpan?-
Optional start time (default is TimeSpan.Zero for immediate start).
easingOverlayManagerPanEasing-
The easing function for smooth animation.
namestring-
Optional name for the fade effect.
Returns
- OverlayManagerFade
-
The created fade element for later modification or removal.
Video_Overlay_AddFadeOut(TimeSpan, TimeSpan, OverlayManagerPanEasing, string)
Adds a fade-out effect from video to black (or specified color).
public OverlayManagerFade Video_Overlay_AddFadeOut(TimeSpan startTime, TimeSpan duration, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear, string name = "FadeOut")Parameters
startTimeTimeSpan-
The start time of the fade-out effect.
durationTimeSpan-
The duration of the fade-out effect.
easingOverlayManagerPanEasing-
The easing function for smooth animation.
namestring-
Optional name for the fade effect.
Returns
- OverlayManagerFade
-
The created fade element for later modification or removal.
Video_Overlay_AddImage(string, int, int, int, int, string)
Adds an image overlay at the specified position.
public OverlayManagerImage Video_Overlay_AddImage(string filename, int x, int y, int width = 0, int height = 0, string name = "Image")Parameters
filenamestring-
The image filename (full path).
xint-
The X position.
yint-
The Y position.
widthint-
The width (0 for original size).
heightint-
The height (0 for original size).
namestring-
Optional name for the image overlay.
Returns
- OverlayManagerImage
-
The created image element for later modification or removal.
Video_Overlay_AddPan(int, int, int, int, int, int, int, int, TimeSpan, TimeSpan, string)
public OverlayManagerPan Video_Overlay_AddPan(int startX, int startY, int startWidth, int startHeight, int stopX, int stopY, int stopWidth, int stopHeight, TimeSpan startTime, TimeSpan endTime, string name = "Pan")Parameters
startXintstartYintstartWidthintstartHeightintstopXintstopYintstopWidthint-
The stop rectangle width (0 for full width).
stopHeightint-
The stop rectangle height (0 for full height).
startTimeTimeSpan-
The animation start time.
endTimeTimeSpan-
The animation end time.
namestring-
Optional name for the pan effect.
Returns
- OverlayManagerPan
-
The created pan element for later modification or removal.
Video_Overlay_AddPan((int X, int Y, int Width, int Height), (int X, int Y, int Width, int Height), TimeSpan, TimeSpan, OverlayManagerPanEasing, string)
Adds a simple pan effect from one rectangle to another using the element's start/end time.
public OverlayManagerPan Video_Overlay_AddPan((int X, int Y, int Width, int Height) startRect, (int X, int Y, int Width, int Height) stopRect, TimeSpan startTime, TimeSpan endTime, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear, string name = "Pan")Parameters
startRect(int X, int Y, int Width, int Height)-
The start rectangle (X, Y, Width, Height). Use 0 for width/height to use full video dimensions.
stopRect(int X, int Y, int Width, int Height)-
The stop rectangle (X, Y, Width, Height). Use 0 for width/height to use full video dimensions.
startTimeTimeSpan-
The animation start time.
endTimeTimeSpan-
The animation end time.
easingOverlayManagerPanEasing-
The easing function for smooth animation.
namestring-
Optional name for the pan effect.
Returns
- OverlayManagerPan
-
The created pan element for later modification or removal.
Video_Overlay_AddSqueezeback(string, Rect, Rect, string)
Adds a squeezeback effect that scales the video to a custom rectangle and draws an overlay image on top with alpha transparency support. This creates the classic "squeezeback" effect used in broadcast where video is shown in a smaller area with graphics/branding surrounding it.
public OverlayManagerSqueezeback Video_Overlay_AddSqueezeback(string backgroundImageFilename, Rect videoRect, Rect backgroundRect = null, string name = "Squeezeback")Parameters
backgroundImageFilenamestring-
The overlay image filename (PNG with alpha recommended).
videoRectRect-
The video rectangle (position and size where video is scaled).
backgroundRectRect-
The overlay image rectangle (null for full frame).
namestring-
Optional name for the squeezeback element.
Returns
- OverlayManagerSqueezeback
-
The created squeezeback element for later modification or removal.
Remarks
By default, the video is drawn first at the specified videoRect, then the overlay image is drawn on top. Use a PNG image with transparent areas where you want the scaled video to show through.
Video_Overlay_AddZoom(double, double, int, int, string)
Adds a zoom effect to the overlay manager. The zoom effect will scale and shift the video content.
public OverlayManagerZoom Video_Overlay_AddZoom(double zoomX, double zoomY, int shiftX = 0, int shiftY = 0, string name = "Zoom")Parameters
zoomXdouble-
The horizontal zoom ratio (1.0 = 100%).
zoomYdouble-
The vertical zoom ratio (1.0 = 100%).
shiftXint-
The horizontal shift in pixels.
shiftYint-
The vertical shift in pixels.
namestring-
Optional name for the zoom effect.
Returns
- OverlayManagerZoom
-
The created zoom element for later modification or removal.
Video_Overlay_AnimateImage(string, int, int, int, int, TimeSpan, TimeSpan, OverlayManagerPanEasing)
Starts an animation on an image overlay to move/resize it to a target rectangle.
public bool Video_Overlay_AnimateImage(string name, int targetX, int targetY, int targetWidth, int targetHeight, TimeSpan startTime, TimeSpan duration, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear)Parameters
namestring-
The name of the image overlay.
targetXint-
The target X position.
targetYint-
The target Y position.
targetWidthint-
The target width (0 to keep current).
targetHeightint-
The target height (0 to keep current).
startTimeTimeSpan-
The animation start time.
durationTimeSpan-
The animation duration.
easingOverlayManagerPanEasing-
The easing function.
Returns
- bool
-
trueif the image was found and animation started; otherwise,false.
Video_Overlay_BringToFront(string)
Brings an overlay element to the front (highest Z-Index).
public bool Video_Overlay_BringToFront(string name)Parameters
namestring-
The name of the overlay.
Returns
- bool
-
trueif the overlay was found and updated; otherwise,false.
Video_Overlay_Clear()
Removes all overlay elements from the video composition.
public void Video_Overlay_Clear()Video_Overlay_Count()
Gets the total number of overlays currently in the composition.
public int Video_Overlay_Count()Returns
- int
-
The number of overlay elements in the composition.
Video_Overlay_Get(int)
Gets the overlay element at the specified index in the overlay list.
public IOverlayManagerElement Video_Overlay_Get(int index)Parameters
indexint-
The zero-based index of the overlay to retrieve.
Returns
- IOverlayManagerElement
-
The overlay element at the specified index.
Exceptions
- ArgumentOutOfRangeException
-
Thrown when index is out of range.
Video_Overlay_GetByName(string)
Gets an overlay element by its name.
public IOverlayManagerElement Video_Overlay_GetByName(string name)Parameters
namestring-
The name of the overlay to find.
Returns
- IOverlayManagerElement
-
The overlay element with the specified name, or null if not found.
Video_Overlay_ImageFadeIn(string, TimeSpan, TimeSpan, OverlayManagerPanEasing)
Starts a fade-in animation on an image overlay.
public bool Video_Overlay_ImageFadeIn(string name, TimeSpan startTime, TimeSpan duration, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear)Parameters
namestring-
The name of the image overlay.
startTimeTimeSpan-
The fade start time.
durationTimeSpan-
The fade duration.
easingOverlayManagerPanEasing-
The easing function.
Returns
- bool
-
trueif the image was found and fade started; otherwise,false.
Video_Overlay_ImageFadeOut(string, TimeSpan, TimeSpan, OverlayManagerPanEasing)
Starts a fade-out animation on an image overlay.
public bool Video_Overlay_ImageFadeOut(string name, TimeSpan startTime, TimeSpan duration, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear)Parameters
namestring-
The name of the image overlay.
startTimeTimeSpan-
The fade start time.
durationTimeSpan-
The fade duration.
easingOverlayManagerPanEasing-
The easing function.
Returns
- bool
-
trueif the image was found and fade started; otherwise,false.
Video_Overlay_Remove(IOverlayManagerElement)
Removes a specific overlay element from the video composition.
public void Video_Overlay_Remove(IOverlayManagerElement overlay)Parameters
overlayIOverlayManagerElement-
The overlay element to remove from the composition.
Video_Overlay_RemoveAt(int)
Removes an overlay element at the specified index in the overlay list.
public void Video_Overlay_RemoveAt(int index)Parameters
indexint-
The zero-based index of the overlay to remove.
Video_Overlay_RemoveByName(string)
Removes an overlay element by its name.
public bool Video_Overlay_RemoveByName(string name)Parameters
namestring-
The name of the overlay to remove.
Returns
- bool
-
trueif the overlay was found and removed; otherwise,false.
Video_Overlay_SendToBack(string)
Sends an overlay element to the back (lowest Z-Index).
public bool Video_Overlay_SendToBack(string name)Parameters
namestring-
The name of the overlay.
Returns
- bool
-
trueif the overlay was found and updated; otherwise,false.
Video_Overlay_SetZIndex(string, int)
Sets the Z-Index of an overlay element.
public bool Video_Overlay_SetZIndex(string name, int zIndex)Parameters
Returns
- bool
-
trueif the overlay was found and updated; otherwise,false.
Video_Overlay_Squeezeback_AnimateBackground(string, Rect, TimeSpan, TimeSpan, OverlayManagerPanEasing)
Starts an animation for the background rectangle of a squeezeback element.
public bool Video_Overlay_Squeezeback_AnimateBackground(string name, Rect targetRect, TimeSpan startTime, TimeSpan duration, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear)Parameters
namestring-
The name of the squeezeback element.
targetRectRect-
The target rectangle.
startTimeTimeSpan-
The animation start time.
durationTimeSpan-
The animation duration.
easingOverlayManagerPanEasing-
The easing function.
Returns
- bool
-
trueif the squeezeback was found and animation started; otherwise,false.
Video_Overlay_Squeezeback_AnimateVideo(string, Rect, TimeSpan, TimeSpan, OverlayManagerPanEasing)
Starts an animation for the video rectangle of a squeezeback element.
public bool Video_Overlay_Squeezeback_AnimateVideo(string name, Rect targetRect, TimeSpan startTime, TimeSpan duration, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear)Parameters
namestring-
The name of the squeezeback element.
targetRectRect-
The target rectangle.
startTimeTimeSpan-
The animation start time.
durationTimeSpan-
The animation duration.
easingOverlayManagerPanEasing-
The easing function.
Returns
- bool
-
trueif the squeezeback was found and animation started; otherwise,false.
Video_Overlay_Squeezeback_BackgroundFadeIn(string, TimeSpan, TimeSpan, OverlayManagerPanEasing)
Starts a fade-in animation for the background of a squeezeback element.
public bool Video_Overlay_Squeezeback_BackgroundFadeIn(string name, TimeSpan startTime, TimeSpan duration, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear)Parameters
namestring-
The name of the squeezeback element.
startTimeTimeSpan-
The fade start time.
durationTimeSpan-
The fade duration.
easingOverlayManagerPanEasing-
The easing function.
Returns
- bool
-
trueif the squeezeback was found and fade started; otherwise,false.
Video_Overlay_Squeezeback_BackgroundFadeOut(string, TimeSpan, TimeSpan, OverlayManagerPanEasing)
Starts a fade-out animation for the background of a squeezeback element.
public bool Video_Overlay_Squeezeback_BackgroundFadeOut(string name, TimeSpan startTime, TimeSpan duration, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear)Parameters
namestring-
The name of the squeezeback element.
startTimeTimeSpan-
The fade start time.
durationTimeSpan-
The fade duration.
easingOverlayManagerPanEasing-
The easing function.
Returns
- bool
-
trueif the squeezeback was found and fade started; otherwise,false.
Video_Overlay_Squeezeback_SetBackgroundOnTop(string)
Sets the background layer to be on top in a squeezeback element.
public bool Video_Overlay_Squeezeback_SetBackgroundOnTop(string name)Parameters
namestring-
The name of the squeezeback element.
Returns
- bool
-
trueif the squeezeback was found and updated; otherwise,false.
Video_Overlay_Squeezeback_SetVideoOnTop(string)
Sets the video layer to be on top in a squeezeback element.
public bool Video_Overlay_Squeezeback_SetVideoOnTop(string name)Parameters
namestring-
The name of the squeezeback element.
Returns
- bool
-
trueif the squeezeback was found and updated; otherwise,false.
Video_Overlay_Squeezeback_SwapLayers(string)
Swaps the layers in a squeezeback element (video on top / background on top).
public bool Video_Overlay_Squeezeback_SwapLayers(string name)Parameters
namestring-
The name of the squeezeback element.
Returns
- bool
-
trueif the squeezeback was found and layers swapped; otherwise,false.
Video_Overlay_Squeezeback_UpdateBackgroundImage(string, string, Rect)
Updates the background image of a squeezeback element.
public bool Video_Overlay_Squeezeback_UpdateBackgroundImage(string name, string filename, Rect backgroundRect = null)Parameters
namestring-
The name of the squeezeback element.
filenamestring-
The new background image filename.
backgroundRectRect-
The new background rectangle (null to keep current).
Returns
- bool
-
trueif the squeezeback was found and updated; otherwise,false.
Video_Overlay_Squeezeback_UpdateVideoPosition(string, Rect)
Updates the video position of a squeezeback element.
public bool Video_Overlay_Squeezeback_UpdateVideoPosition(string name, Rect videoRect)Parameters
Returns
- bool
-
trueif the squeezeback was found and updated; otherwise,false.
Video_Overlay_Squeezeback_VideoFadeIn(string, TimeSpan, TimeSpan, OverlayManagerPanEasing)
Starts a fade-in animation for the video of a squeezeback element.
public bool Video_Overlay_Squeezeback_VideoFadeIn(string name, TimeSpan startTime, TimeSpan duration, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear)Parameters
namestring-
The name of the squeezeback element.
startTimeTimeSpan-
The fade start time.
durationTimeSpan-
The fade duration.
easingOverlayManagerPanEasing-
The easing function.
Returns
- bool
-
trueif the squeezeback was found and fade started; otherwise,false.
Video_Overlay_Squeezeback_VideoFadeOut(string, TimeSpan, TimeSpan, OverlayManagerPanEasing)
Starts a fade-out animation for the video of a squeezeback element.
public bool Video_Overlay_Squeezeback_VideoFadeOut(string name, TimeSpan startTime, TimeSpan duration, OverlayManagerPanEasing easing = OverlayManagerPanEasing.Linear)Parameters
namestring-
The name of the squeezeback element.
startTimeTimeSpan-
The fade start time.
durationTimeSpan-
The fade duration.
easingOverlayManagerPanEasing-
The easing function.
Returns
- bool
-
trueif the squeezeback was found and fade started; otherwise,false.
Video_Overlay_Update(IOverlayManagerElement)
Updates an existing overlay element by removing and re-adding it with new properties. This method is used to refresh an overlay after modifying its properties.
public void Video_Overlay_Update(IOverlayManagerElement overlay)Parameters
overlayIOverlayManagerElement-
The overlay element to update with its new properties.
Video_Overlay_UpdateImageFile(string, string)
Updates the filename of an image overlay.
public bool Video_Overlay_UpdateImageFile(string name, string newFilename)Parameters
Returns
- bool
-
trueif the image was found and updated; otherwise,false.
Video_Overlay_UpdateImagePosition(string, int, int, int, int)
Updates the position of an image overlay.
public bool Video_Overlay_UpdateImagePosition(string name, int x, int y, int width = 0, int height = 0)Parameters
namestring-
The name of the image overlay.
xint-
The new X position.
yint-
The new Y position.
widthint-
The new width (0 to keep current).
heightint-
The new height (0 to keep current).
Returns
- bool
-
trueif the image was found and updated; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Associates this overlay manager block with a pipeline and initializes its internal context. This method is called internally when the block is added to a pipeline.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline instance that will manage this block.