From b91fcfd11cea058a55ea588a7820469762efb35b Mon Sep 17 00:00:00 2001 From: WizzardMaker Date: Mon, 17 Aug 2020 23:16:55 +0200 Subject: [PATCH 1/4] Quick and dirty fix for adding files to a collection --- S4GFX/Program.cs | 16 +++++++------- S4GFXInterface/ImageGrid.cs | 4 ++-- S4GFXInterface/MainWindow.xaml | 4 ++-- S4GFXLibrary/FileReader/GfxFileReader.cs | 28 +++++++++++++++++++----- S4GFXLibrary/FileReader/GilFileReader.cs | 11 +++++++--- S4GFXLibrary/GFX/ImageData.cs | 6 ++++- S4GFXLibrary/GFX/Palette.cs | 4 ++++ 7 files changed, 51 insertions(+), 22 deletions(-) diff --git a/S4GFX/Program.cs b/S4GFX/Program.cs index b07e323..e89e029 100644 --- a/S4GFX/Program.cs +++ b/S4GFX/Program.cs @@ -369,10 +369,10 @@ private static ImageData[] LoadFromBitmap(string path, int i, ICollectionFileRea ImageData data = new ImageData(map.Height, map.Width); - image.Width = map.Width; - image.Height = map.Height; + //image.Width = map.Width; + //image.Height = map.Height; - BitmapData d = map.LockBits(new Rectangle(0, 0, map.Width, map.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + BitmapData d = map.LockBits(new Rectangle(0, 0, map.Width, map.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); int size = map.Height * map.Width * 4; @@ -386,11 +386,11 @@ private static ImageData[] LoadFromBitmap(string path, int i, ICollectionFileRea int index = 0; for (int y = 0; y < map.Height; y++) { for (int x = 0; x < map.Width; x++) { - - data.data[index + 0] = argb[index + 1];//r - data.data[index + 1] = argb[index + 2];//g - data.data[index + 2] = argb[index + 3];//b - data.data[index + 3] = argb[index + 0];//a + //so LockBits stores the data as bgra, because fuck you, thats why... + data.data[index + 0] = argb[index + 2];//g1 + data.data[index + 1] = argb[index + 1];//r2 + data.data[index + 2] = argb[index + 0];//a3 + data.data[index + 3] = argb[index + 3];//b0 index += 4; } diff --git a/S4GFXInterface/ImageGrid.cs b/S4GFXInterface/ImageGrid.cs index 5cd0957..ac313f5 100644 --- a/S4GFXInterface/ImageGrid.cs +++ b/S4GFXInterface/ImageGrid.cs @@ -30,9 +30,9 @@ public class ImageView : IDisposable { DirectBitmap bitmap; private ExportedBitmap gridElement; - private bool removeAlpha = true; + private bool removeAlpha; private bool onlyShadows; - private bool removeShadows = true; + private bool removeShadows; ImageData data; diff --git a/S4GFXInterface/MainWindow.xaml b/S4GFXInterface/MainWindow.xaml index a417357..a226f6e 100644 --- a/S4GFXInterface/MainWindow.xaml +++ b/S4GFXInterface/MainWindow.xaml @@ -16,7 +16,7 @@ - + @@ -86,7 +86,7 @@ - + -