add a scanner, but this seems to be a wrong solution. Change open-source head

This commit is contained in:
Youmu Liu
2026-07-07 18:20:38 +08:00
parent b053567eb7
commit 1705d7c245
276 changed files with 3468 additions and 7205 deletions
+29 -40
View File
@@ -1,33 +1,10 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Image.cs"
// -----------------------------------------------------------------------------
// file="Image"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using StgSharp.Graphics.OpenGL;
using System;
@@ -47,7 +24,9 @@ namespace StgSharp.Graphics
_rawInfo = new ImageInfo();
}
internal Image(ImageInfo information)
internal Image(
ImageInfo information
)
{
_rawInfo = information;
_data = [];
@@ -55,11 +34,7 @@ namespace StgSharp.Graphics
// int length = _rawInfo.width * _rawInfo.height * _rawInfo.channel;
}
public (int width, int height) Size
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => (_rawInfo.Width, _rawInfo.Height);
}
public (int width, int height) Size => (_rawInfo.Width, _rawInfo.Height);
public byte[] PixelBuffer
{
@@ -109,9 +84,14 @@ namespace StgSharp.Graphics
internal ref byte[] Data => ref _data;
public void FromBytes(byte[] stream) { }
public void FromBytes(
byte[] stream
) { }
public static unsafe Image FromFile(string route, ImageLoader loader)
public static unsafe Image FromFile(
string route,
ImageLoader loader
)
{
Image ret = new Image();
fixed (ImageInfo* iptr = &ret._rawInfo) {
@@ -120,7 +100,11 @@ namespace StgSharp.Graphics
return ret;
}
public static Image FromMemory((int width, int height) size, ImageChannel channel, byte[] stream)
public static Image FromMemory(
(int width, int height) size,
ImageChannel channel,
byte[] stream
)
{
ImageInfo _info = new ImageInfo
{
@@ -139,7 +123,8 @@ namespace StgSharp.Graphics
(int width, int height) size,
ImageChannel channel,
PixelChannelLayout layout,
byte[] stream)
byte[] stream
)
{
ImageInfo _info = new ImageInfo
{
@@ -173,7 +158,11 @@ namespace StgSharp.Graphics
return this;
}
internal static Image FromMemory(ImageInfo info, byte[] data, int operationCount)
internal static Image FromMemory(
ImageInfo info,
byte[] data,
int operationCount
)
{
return new Image
{