Class ImageOverlayBlock
- Assembly
- VisioForge.Core.dll
MediaBlock that overlays static images onto video streams with positioning, scaling, and transparency control. This block composites image files (PNG, JPEG, BMP, etc.) over video content, supporting features like alpha blending, custom positioning, rotation, scaling, and fade effects. Commonly used for watermarks, logos, brand overlays, lower thirds, and creative graphic elements in video production workflows. The overlay supports real-time updates and animation effects including fade-in and fade-out transitions. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class ImageOverlayBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
ImageOverlayBlock(string)
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.ImageOverlayBlock class with the specified image file. Creates default overlay settings with the image positioned at the top-left corner.
public ImageOverlayBlock(string filename)Parameters
filenamestring-
The path to the image file to overlay (supports PNG, JPEG, BMP, and other common formats).
ImageOverlayBlock(ImageOverlaySettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.ImageOverlayBlock class with custom overlay settings. Allows full control over positioning, scaling, transparency, and other overlay properties.
public ImageOverlayBlock(ImageOverlaySettings settings)Parameters
settingsImageOverlaySettings-
The ImageOverlaySettings instance defining the complete overlay configuration.
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
Settings
Gets or sets the image overlay settings that control the overlay behavior including image file path, position, size, transparency, rotation, and blending mode. Call the Update method after modifying settings if the pipeline is already started.
public ImageOverlaySettings Settings { get; set; }Property Value
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Constructs and initializes the image overlay filter and its associated GStreamer elements. This method creates the filter with the specified overlay settings, establishes input and output pads, and prepares the block for image compositing operations.
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 image overlay block. This method disposes of the GStreamer elements and resets the build state.
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 image overlay filter element.
public BaseElement GetCore()Returns
- BaseElement
-
The BaseElement wrapper instance that encapsulates the GStreamer image overlay filter.
GetElement()
Gets the underlying GStreamer element that performs the image overlay processing.
public Element GetElement()Returns
- Element
-
The GStreamer Element instance representing the image overlay filter.
IsAvailable()
Determines whether the image overlay filter is available on the current system. This checks if the required GStreamer video processing plugins are installed and accessible. The correct NuGet SDK redistribution package should be included in your project.
public static bool IsAvailable()Returns
- bool
-
trueif the image overlay filter is available and can be used; otherwise,false.
StartFadeIn(TimeSpan)
Initiates a smooth fade-in transition that gradually increases the overlay opacity from zero to full visibility. This creates a professional appear effect commonly used for introducing graphics or watermarks.
public void StartFadeIn(TimeSpan duration)Parameters
durationTimeSpan-
The duration of the fade-in transition. Must be a positive TimeSpan value.
StartFadeOut(TimeSpan)
Initiates a smooth fade-out transition that gradually reduces the overlay opacity to zero. This creates a professional dissolve effect commonly used in broadcast and video production.
public void StartFadeOut(TimeSpan duration)Parameters
durationTimeSpan-
The duration of the fade-out transition. Must be a positive TimeSpan value.
Update()
Updates the overlay settings in real-time while the pipeline is running. Call this method after modifying the Settings property to apply changes immediately. This allows dynamic repositioning, scaling, or changing overlay properties during playback.
public void Update()IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Associates this image overlay 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.