小编Par*_*thi的帖子

如何使用 SkiaSharp 找到解码位图的 PixelFormat

在 System.Drawing 中,我们从 Image 对象中检索 PixelFormat,但 SkiaSharp.SkImage 不提供 API 来查找解码图像的 PixelFormat。是否有任何其他解决方法来查找解码图像的 PixelFormat 以及我们如何创建具有 PixelFormat 值的 Image 作为 System.Drawing.Image

2d skia asp.net-core skiasharp

5
推荐指数
1
解决办法
710
查看次数

如何在 SkiaSharp 中将字节数组转换为 SKBitmap?

SKBitmap.Bytes 是只读的,关于如何 Marshal.Copy 字节数组到 SKBitmap 有什么建议吗?我正在使用下面的代码片段,但它不起作用。

代码片段:

    SKBitmap bitmap = new SKBitmap((int)Width, (int)Height);
    bitmap.LockPixels();
    byte[] array = new byte[bitmap.RowBytes * bitmap.Height];
    for (int i = 0; i < pixelArray.Length; i++)
    {
        SKColor color = new SKColor((uint)pixelArray[i]);
        int num = i % (int)Width;
        int num2 = i / (int)Width;
        array[bitmap.RowBytes * num2 + 4 * num] = color.Blue;
        array[bitmap.RowBytes * num2 + 4 * num + 1] = color.Green;
        array[bitmap.RowBytes * num2 + 4 * num + 2] = color.Red;
        array[bitmap.RowBytes …
Run Code Online (Sandbox Code Playgroud)

2d asp.net-core-mvc .net-core skiasharp .net-standard

5
推荐指数
1
解决办法
7106
查看次数