update nugets & code optimization

This commit is contained in:
2024-06-11 08:11:40 +02:00
parent 79d9eed045
commit 3615fc109a
58 changed files with 337 additions and 290 deletions

View File

@@ -9,7 +9,7 @@ public class TextureFormats
{
public static Bitmap createColorTexture(Color color)
{
Bitmap tex = new Bitmap(1, 1);
Bitmap tex = new(1, 1);
Graphics.FromImage(tex).Clear(color);
return tex;
}
@@ -306,7 +306,7 @@ public class TextureFormats
public static Bitmap decode1BPP(byte[] data, int width, int height)
{
Bitmap tex = new Bitmap(width, height);
Bitmap tex = new(width, height);
if (data.Length >= (width * height) / 8) // Sanity Check
{
int len = (width * height) / 8;
@@ -332,7 +332,7 @@ public class TextureFormats
{
Console.WriteLine("Texture size = (" + width + "x" + height + ")");
Console.WriteLine("data.Length = (" + data.Length + ")");
Bitmap tex = new Bitmap(width, height);
Bitmap tex = new(width, height);
if (data.Length >= width * height * 4) // Sanity Check
{
@@ -358,7 +358,7 @@ public class TextureFormats
public static Bitmap decodeRGBA16(byte[] data, int width, int height)
{
Bitmap tex = new Bitmap(width, height);
Bitmap tex = new(width, height);
if (data.Length >= width * height * 2) // Sanity Check
{
BitmapData bitmapData = tex.LockBits(new Rectangle(0, 0, width, height),
@@ -385,7 +385,7 @@ public class TextureFormats
public static Bitmap decodeIA16(byte[] data, int width, int height)
{
Bitmap tex = new Bitmap(width, height);
Bitmap tex = new(width, height);
if (data.Length >= width * height * 2) // Sanity Check
{
BitmapData bitmapData = tex.LockBits(new Rectangle(0, 0, width, height),
@@ -410,7 +410,7 @@ public class TextureFormats
public static Bitmap decodeIA8(byte[] data, int width, int height)
{
Bitmap tex = new Bitmap(width, height);
Bitmap tex = new(width, height);
if (data.Length >= width * height) // Sanity Check
{
BitmapData bitmapData = tex.LockBits(new Rectangle(0, 0, width, height),
@@ -435,7 +435,7 @@ public class TextureFormats
}
public static Bitmap decodeIA4(byte[] data, int width, int height)
{
Bitmap tex = new Bitmap(width, height);
Bitmap tex = new(width, height);
if (data.Length >= (width * height) / 2) // Sanity Check
{
@@ -469,7 +469,7 @@ public class TextureFormats
}
public static Bitmap decodeI8(byte[] data, int width, int height)
{
Bitmap tex = new Bitmap(width, height);
Bitmap tex = new(width, height);
if (data.Length >= width * height) // Sanity Check
{
@@ -496,7 +496,7 @@ public class TextureFormats
}
public static Bitmap decodeI4(byte[] data, int width, int height)
{
Bitmap tex = new Bitmap(width, height);
Bitmap tex = new(width, height);
if (data.Length >= (width * height) / 2) // Sanity Check
{
@@ -531,7 +531,7 @@ public class TextureFormats
public static Bitmap decodeCI4(byte[] data, int width, int height, ushort[] palette)
{
Bitmap tex = new Bitmap(width, height);
Bitmap tex = new(width, height);
if (data.Length >= (width * height) / 2) // Sanity Check
{
@@ -565,7 +565,7 @@ public class TextureFormats
public static Bitmap decodeCI8(byte[] data, int width, int height, ushort[] palette)
{
Bitmap tex = new Bitmap(width, height);
Bitmap tex = new(width, height);
if (data.Length >= width * height) // Sanity Check
{