Class SqueezebackBlockV2
- Assembly
- VisioForge.Core.dll
Simple squeezeback effect block with one video input and one background image. This Windows-specific block uses VideoMixerBlock to create a picture-in-picture effect with a background image and a video overlay. The video can be positioned, resized, and have its opacity adjusted. Supports z-order swapping between video and image. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class SqueezebackBlockV2 : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
SqueezebackBlockV2(MediaBlocksPipeline, VideoFrameInfoX, string, Rect, Rect, bool)
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.SqueezebackBlockV2 class with specified pipeline, video information, background image with custom position, and video position.
public SqueezebackBlockV2(MediaBlocksPipeline pipeline, VideoFrameInfoX videoInfo, string backgroundImageFile, Rect imageRect, Rect videoRect, bool videoOnTop = true)Parameters
pipelineMediaBlocksPipeline-
The media blocks pipeline that will contain this block.
videoInfoVideoFrameInfoX-
The video frame information including dimensions and format.
backgroundImageFilestring-
Path to the background image file.
imageRectRect-
Rectangle defining the image position and size.
videoRectRect-
Rectangle defining the video overlay position and size.
videoOnTopbool-
If true, video is on top of image; if false, image is on top.
Properties
Input
Gets the video input pad.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads (just the video input).
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
AnimateImage(Rect, TimeSpan, double?, double?)
Animates the image layer's position and opacity.
public void AnimateImage(Rect rect, TimeSpan duration, double? startAlpha = null, double? endAlpha = null)Parameters
rectRect-
The target rectangle for the image.
durationTimeSpan-
The duration of the animation.
startAlphadouble?-
Optional starting opacity value (0.0-1.0).
endAlphadouble?-
Optional ending opacity value (0.0-1.0).
AnimateVideo(Rect, TimeSpan, double?, double?)
Animates the video layer's position and opacity.
public void AnimateVideo(Rect rect, TimeSpan duration, double? startAlpha = null, double? endAlpha = null)Parameters
rectRect-
The target rectangle for the video.
durationTimeSpan-
The duration of the animation.
startAlphadouble?-
Optional starting opacity value (0.0-1.0).
endAlphadouble?-
Optional ending opacity value (0.0-1.0).
Build()
Constructs and initializes the squeezeback effect components.
public override bool Build()Returns
- bool
-
Returns
trueif successful.
CleanUp()
Resets this squeezeback block to a re-buildable state after the pipeline is stopped.
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. Returns null as this is a composite block.
public BaseElement GetCore()Returns
- BaseElement
-
Always returns null for this composite block.
GetElement()
Gets the underlying GStreamer element. Returns null as this is a composite block.
public Element GetElement()Returns
- Element
-
Always returns null for this composite block.
Input_Move(Rect, TimeSpan, double?, double?)
Animates the video position and opacity within the squeezeback layout. This method provides compatibility with the original SqueezebackBlock API.
public void Input_Move(Rect rect, TimeSpan duration, double? startAlpha, double? endAlpha)Parameters
rectRect-
The target rectangle for the video position and size.
durationTimeSpan-
The duration of the animation.
startAlphadouble?-
Optional starting opacity value (0.0-1.0).
endAlphadouble?-
Optional ending opacity value (0.0-1.0).
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.
IsVideoOnTop()
Gets the current z-order status.
public bool IsVideoOnTop()Returns
- bool
-
True if video is on top, false if image is on top.
SetImageOnTop()
Sets the image layer on top.
public void SetImageOnTop()SetVideoOnTop()
Sets the video layer on top.
public void SetVideoOnTop()StartFadeIn(TimeSpan)
Starts a fade-in animation on the background image overlay. This method provides compatibility with the original SqueezebackBlock API.
public void StartFadeIn(TimeSpan duration)Parameters
durationTimeSpan-
The duration of the fade-in effect.
StartFadeOut(TimeSpan)
Starts a fade-out animation on the background image overlay. This method provides compatibility with the original SqueezebackBlock API.
public void StartFadeOut(TimeSpan duration)Parameters
durationTimeSpan-
The duration of the fade-out effect.
StartVideoFadeIn(TimeSpan)
Starts a fade-in animation for the video layer.
public void StartVideoFadeIn(TimeSpan duration)Parameters
durationTimeSpan-
The duration of the fade-in effect.
StartVideoFadeOut(TimeSpan)
Starts a fade-out animation for the video layer.
public void StartVideoFadeOut(TimeSpan duration)Parameters
durationTimeSpan-
The duration of the fade-out effect.
SwapLayers()
Swaps the z-order of video and image layers.
public void SwapLayers()Update()
Updates the image overlay settings and refreshes the visual composition. Call this method after modifying image settings to apply changes. This method provides compatibility with the original SqueezebackBlock API.
public void Update()UpdateImageAlpha(double)
Updates the opacity of the background image overlay. This method provides compatibility with the original SqueezebackBlock API.
public void UpdateImageAlpha(double alpha)Parameters
alphadouble-
The new alpha value (0.0-1.0) for the background image.
UpdateImageAsync(string, Rect)
Updates the background image with a new file and video rectangle. This method provides compatibility with the original SqueezebackBlock API.
public Task UpdateImageAsync(string filename, Rect videoRect)Parameters
Returns
UpdateImageAsync(string, Rect?, Rect?)
Updates the background image with a new file, image position, and video rectangle asynchronously.
public Task UpdateImageAsync(string filename, Rect? imageRect, Rect? videoRect)Parameters
filenamestring-
The new background image filename.
imageRectRect?-
The new image rectangle position (null to keep current position).
videoRectRect?-
The new video rectangle position (null to keep current position).
Returns
UpdateImageFile(string)
Updates the background image filename while keeping the current position.
public void UpdateImageFile(string filename)Parameters
filenamestring-
The new background image filename.
UpdateImagePosition(Rect)
Updates the image position and size.
public void UpdateImagePosition(Rect rect)Parameters
rectRect-
The new rectangle for the image.
UpdateVideoAlpha(double)
Updates the video opacity.
public void UpdateVideoAlpha(double alpha)Parameters
alphadouble-
The new alpha value (0.0-1.0).
UpdateVideoPosition(Rect)
Updates the video position and size.
public void UpdateVideoPosition(Rect rect)Parameters
rectRect-
The new rectangle for the video overlay.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Associates this squeezeback 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.