daily update on 20240610 by nitload youmu

This commit is contained in:
Nitload
2024-06-10 15:11:01 +08:00
parent c0093f7b5c
commit f6963b8e00
96 changed files with 2927 additions and 2290 deletions
+4 -35
View File
@@ -43,7 +43,7 @@ using System.Threading.Tasks;
namespace StgSharp.Graphics
{
public class Image : SSDSerializable, IImageProvider
public class Image : ISSDSerializable, IImageProvider
{
internal byte[] data;
internal ImageInfo info;
@@ -74,7 +74,7 @@ namespace StgSharp.Graphics
get => (info.Width, info.Height);
}
public override SerializableTypeCode SSDTypeCode => SerializableTypeCode.PixelImage;
public SerializableTypeCode SSDTypeCode => SerializableTypeCode.PixelImage;
public int Width => info.Width;
public static unsafe Image FromFile(string route, ImageLoader loader)
@@ -111,7 +111,7 @@ namespace StgSharp.Graphics
return new glArrayHandle(data);
}
public override unsafe byte[] GetBytes()
public unsafe byte[] GetBytes()
{
if (data == null)
{
@@ -139,40 +139,9 @@ namespace StgSharp.Graphics
return data;
}
public override unsafe byte[] GetBytes(out int length)
public void FromBytes(byte[] stream)
{
if (data == null)
{
int size = Width * Height * ChannelCount;
data = new byte[size];
int i = 0;
fixed (byte* bptr = data)
{
byte* pptr = bptr;
for (; i < size; i += 16)
{
*(M128*)(pptr + i) = *(M128*)(info.StreamPtr + i);
}
for (; i < size; i++)
{
*(pptr + i) = *(byte*)(info.StreamPtr + i);
}
}
fixed (ImageInfo* pptr = &info)
{
InternalIO.InternalUnloadImage(pptr);
}
info.StreamPtr = IntPtr.Zero;
}
length = data.Length;
return data;
}
internal override unsafe void BuildFromByteStream(byte[] stream)
{
throw new NotSupportedException(
$"{($"{typeof(Image).Name} does not support BuildFromByteStream,")}{($"please use Image.FromMemory instead.")}"
);
}
public Image ProvideImage()