Class ImageSource
Provides a media source implementation for static images using SkiaSharp. Supports loading images from streams or SKBitmap objects and rendering text overlays.
public class ImageSource : IImageSource, IMediaSource, IReferenceable, IDisposable
- Inheritance
-
ImageSource
- Implements
- Inherited Members
Constructors
ImageSource(bool, bool)
Initializes a new instance of the ImageSource class.
public ImageSource(bool useAbsoluteTimestamps = false, bool loop = true)
Parameters
useAbsoluteTimestampsboolWhether to use absolute NTP timestamps for output samples.
loopboolWhether to loop playback continuously.
Exceptions
- UnauthorizedAccessException
Thrown when the license is invalid.
Methods
SetImage(SKBitmap, bool)
Sets the image from an SKBitmap object.
public void SetImage(SKBitmap image, bool disposeImage = false)
Parameters
imageSKBitmapThe SKBitmap image to use as the source.
disposeImageboolWhether to dispose the bitmap after copying its data.
SetImage(Stream, bool)
Sets the image from a stream containing encoded image data.
public override void SetImage(Stream imageStream, bool leaveOpen = false)
Parameters
imageStreamStreamThe stream containing the encoded image data.
leaveOpenboolWhether to leave the stream open after reading.
SetImageAsync(SKBitmap, bool)
Asynchronously sets the image from an SKBitmap object.
public Task SetImageAsync(SKBitmap image, bool disposeImage = false)
Parameters
imageSKBitmapThe SKBitmap image to use as the source.
disposeImageboolWhether to dispose the bitmap after copying its data.
Returns
- Task
A task representing the asynchronous operation.
SetImageAsync(Stream, bool)
Asynchronously sets the image from a stream containing encoded image data.
public override Task SetImageAsync(Stream imageStream, bool leaveOpen = false)
Parameters
imageStreamStreamThe stream containing the encoded image data.
leaveOpenboolWhether to leave the stream open after reading.
Returns
- Task
A task representing the asynchronous operation.
SetText(OverlayText)
Renders text as an image based on the specified overlay text configuration. Supports font styling, colors, alignment, and outline rendering.
public override void SetText(OverlayText content)
Parameters
contentOverlayTextThe overlay text configuration containing text, font, and positioning settings.
SetTextAsync(OverlayText)
Asynchronously renders text as an image based on the specified overlay text configuration.
public override Task SetTextAsync(OverlayText content)
Parameters
contentOverlayTextThe overlay text configuration containing text, font, and positioning settings.
Returns
- Task
A task representing the asynchronous operation.