Skip to content
Discussion options

You must be logged in to vote

I added a new raw-pixel path for this case in ImageSource.FromBgraPixels:

public static ImageSource FromBgraPixels(int width, int height, byte[] bgra, bool hasAlpha = true)
{
ArgumentNullException.ThrowIfNull(bgra);
return new(new Bgra32PixelBuffer(width, height, bgra, hasAlpha));
}
/// <summary>
/// Copies BGRA32 pixels into a new buffer.
/// </summary>
public static ImageSource FromBgraPixels(int width, int height, ReadOnlySpan<byte> bgra, bool hasAlpha = true)
{
if (width <= 0 || height <= 0)
{
throw new ArgumentOutOfRangeException(nameof(width)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@al6uiz
Comment options

Answer selected by harry-xi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants