From f21eb7915611f7147c79aa1daed06f2267c5d28d Mon Sep 17 00:00:00 2001 From: Stephen Monaco Date: Wed, 14 Oct 2020 20:48:58 -0400 Subject: [PATCH 01/38] Fix a crash when AssociatePalette was used without any project palette resources --- .../Arranger Editors/ScatteredArrangerEditorViewModel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TileShop.WPF/Features/Arranger Editors/ScatteredArrangerEditorViewModel.cs b/TileShop.WPF/Features/Arranger Editors/ScatteredArrangerEditorViewModel.cs index c70a64e5..3d388d3b 100644 --- a/TileShop.WPF/Features/Arranger Editors/ScatteredArrangerEditorViewModel.cs +++ b/TileShop.WPF/Features/Arranger Editors/ScatteredArrangerEditorViewModel.cs @@ -422,7 +422,8 @@ public void AssociatePalette() var projectTree = _projectService.GetContainingProject(Resource); var palettes = projectTree.Tree.EnumerateDepthFirst() .Where(x => x.Value is Palette) - .Select(x => new AssociatePaletteModel(x.Value as Palette, x.PathKey)); + .Select(x => new AssociatePaletteModel(x.Value as Palette, x.PathKey)) + .Concat(_projectService.GlobalResources.OfType().Select(x => new AssociatePaletteModel(x, x.Name))); var model = new AssociatePaletteViewModel(palettes); From 20d18a5ce04bcf0a9175d2442959f5f91ecc8174 Mon Sep 17 00:00:00 2001 From: Stephen Monaco Date: Wed, 14 Oct 2020 20:55:12 -0400 Subject: [PATCH 02/38] Import image now automatically updates the associated Scattered Arranger, if one is open --- TileShop.WPF/Features/Project/ProjectTreeViewModel.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TileShop.WPF/Features/Project/ProjectTreeViewModel.cs b/TileShop.WPF/Features/Project/ProjectTreeViewModel.cs index 44bafd71..ee6c6120 100644 --- a/TileShop.WPF/Features/Project/ProjectTreeViewModel.cs +++ b/TileShop.WPF/Features/Project/ProjectTreeViewModel.cs @@ -228,7 +228,11 @@ public void ImportImageAs(ResourceNodeViewModel nodeModel) if (nodeModel is ArrangerNodeViewModel arrNodeModel && arrNodeModel.Node.Value is ScatteredArranger arranger) { var model = new ImportImageViewModel(arranger, _paletteService, _fileSelect); - _windowManager.ShowDialog(model); + if (_windowManager.ShowDialog(model) is true) + { + var changeEvent = new ArrangerChangedEvent(arranger, ArrangerChange.Pixels); + _events.PublishOnUIThread(changeEvent); + } } } From 4fe0c9bded8136cef49771e633fa52f045191a6d Mon Sep 17 00:00:00 2001 From: Stephen Monaco Date: Thu, 15 Oct 2020 09:11:44 -0400 Subject: [PATCH 03/38] Fix a node drag+drop null reference exception --- ImageMagitek/Project/ProjectTree.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ImageMagitek/Project/ProjectTree.cs b/ImageMagitek/Project/ProjectTree.cs index 3e1caffd..b46d7c29 100644 --- a/ImageMagitek/Project/ProjectTree.cs +++ b/ImageMagitek/Project/ProjectTree.cs @@ -114,10 +114,13 @@ public MagitekResult AddResource(ResourceNode parentNode, IProject public MagitekResult CanMoveNode(ResourceNode node, ResourceNode parentNode) { if (node is null) - throw new ArgumentNullException($"{nameof(CanMoveNode)} parameter '{node}' was null"); + throw new ArgumentNullException($"{nameof(CanMoveNode)} parameter '{nameof(node)}' was null"); if (parentNode is null) - throw new ArgumentNullException($"{nameof(CanMoveNode)} parameter '{parentNode}' was null"); + throw new ArgumentNullException($"{nameof(CanMoveNode)} parameter '{nameof(parentNode)}' was null"); + + if (node.Parent is null) + return new MagitekResult.Failed($"{node.Name} has no parent"); if (ReferenceEquals(node, parentNode)) return new MagitekResult.Failed($"Cannot move {node.Name} onto itself"); From 61a423493c9238d61be11c167c4fa1168332696b Mon Sep 17 00:00:00 2001 From: Stephen Monaco Date: Thu, 15 Oct 2020 09:12:38 -0400 Subject: [PATCH 04/38] Improve dialog layouts --- .../Features/Dialogs/AddPaletteView.xaml | 132 +++++++++--------- .../Dialogs/AddScatteredArrangerView.xaml | 11 +- 2 files changed, 76 insertions(+), 67 deletions(-) diff --git a/TileShop.WPF/Features/Dialogs/AddPaletteView.xaml b/TileShop.WPF/Features/Dialogs/AddPaletteView.xaml index c81a56f8..a5a754b5 100644 --- a/TileShop.WPF/Features/Dialogs/AddPaletteView.xaml +++ b/TileShop.WPF/Features/Dialogs/AddPaletteView.xaml @@ -8,8 +8,8 @@ xmlns:s="https://github.com/canton7/Stylet" xmlns:ui="http://schemas.modernwpf.com/2019" Title="Add a New Palette" - Width="440" - Height="320" + Width="400" + Height="400" MinWidth="220" ui:ThemeManager.IsThemeAware="True" ui:WindowHelper.UseModernWindowStyle="True" @@ -19,75 +19,79 @@ - - - + + - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - + MinWidth="150" + ui:ControlHelper.Header="Color Model" + ItemsSource="{Binding ColorModels}" + SelectedIndex="1" + SelectedItem="{Binding SelectedColorModel}" + ToolTip="Palette Color Model" /> + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TileShop.WPF/Features/Palette Editor/TablePaletteEditorViewModel.cs b/TileShop.WPF/Features/Palette Editor/TablePaletteEditorViewModel.cs new file mode 100644 index 00000000..6ba803b8 --- /dev/null +++ b/TileShop.WPF/Features/Palette Editor/TablePaletteEditorViewModel.cs @@ -0,0 +1,122 @@ +using System; +using Stylet; +using ImageMagitek.Colors; +using ImageMagitek.Services; +using TileShop.Shared.EventModels; +using TileShop.WPF.Models; +using GongSolutions.Wpf.DragDrop; +using System.Linq; + +namespace TileShop.WPF.ViewModels +{ + class TablePaletteEditorViewModel : ResourceEditorBaseViewModel, IDropTarget + { + private readonly Palette _palette; + private readonly IPaletteService _paletteService; + private readonly IColorFactory _colorFactory; + private readonly IEventAggregator _events; + + private BindableCollection _workingColors = new BindableCollection(); + public BindableCollection WorkingColors + { + get => _workingColors; + set => SetAndNotify(ref _workingColors, value); + } + + private BindableCollection _availableColors = new BindableCollection(); + public BindableCollection AvailableColors + { + get => _availableColors; + set => SetAndNotify(ref _availableColors, value); + } + + public TablePaletteEditorViewModel(Palette palette, IPaletteService paletteService, IEventAggregator events) + { + Resource = palette; + _palette = palette; + _paletteService = paletteService; + _colorFactory = _paletteService.ColorFactory; + _events = events; + events.Subscribe(this); + + DisplayName = Resource?.Name ?? "Unnamed Palette"; + + for (int i = 0; i < _palette.Entries; i++) + { + WorkingColors.Add(new ValidatedTableColorModel((ITableColor)_palette.GetForeignColor(i), i, _paletteService.ColorFactory)); + } + + for (int i = 0; i < 64; i++) + { + var nesColor = new ValidatedTableColorModel(new ColorNes((uint)i), i, _colorFactory); + AvailableColors.Add(nesColor); + } + } + + public override void SaveChanges() + { + for (int i = 0; i < WorkingColors.Count; i++) + { + var color = _colorFactory.CreateColor(_palette.ColorModel, WorkingColors[i].WorkingColor.Color); + _palette.SetForeignColor(i, color); + } + + _palette.SavePalette(); + IsModified = false; + + var changeEvent = new PaletteChangedEvent(_palette); + _events.PublishOnUIThread(changeEvent); + } + + public override void DiscardChanges() + { + _palette.Reload(); + IsModified = false; + } + + public void MouseOver(ValidatedTableColorModel model) + { + string notifyMessage = $"Palette Index: {model.Index}"; + var notifyEvent = new NotifyStatusEvent(notifyMessage, NotifyStatusDuration.Indefinite); + _events.PublishOnUIThread(notifyEvent); + } + + public override void Undo() + { + throw new NotImplementedException(); + } + + public override void Redo() + { + throw new NotImplementedException(); + } + + public override void ApplyHistoryAction(HistoryAction action) + { + throw new NotImplementedException(); + } + + public void DragOver(IDropInfo dropInfo) + { + if (dropInfo.Data is ValidatedTableColorModel model) + { + dropInfo.Effects = System.Windows.DragDropEffects.Copy; + dropInfo.DropTargetAdorner = DropTargetAdorners.Highlight; + } + } + + public void Drop(IDropInfo dropInfo) + { + if (dropInfo.Data is ValidatedTableColorModel dropModel && dropInfo.TargetItem is ValidatedTableColorModel targetModel) + { + var index = targetModel.Index; + var color = new ColorNes(dropModel.WorkingColor.Color); + WorkingColors[index] = new ValidatedTableColorModel(color, index, _colorFactory); + + IsModified = Enumerable + .Range(0, WorkingColors.Count) + .Any(x => WorkingColors[x].WorkingColor.Color != _palette.GetForeignColor(x).Color); + } + } + } +} diff --git a/TileShop.WPF/Features/Shell/EditorsViewModel.cs b/TileShop.WPF/Features/Shell/EditorsViewModel.cs index 954a6b8d..da17096a 100644 --- a/TileShop.WPF/Features/Shell/EditorsViewModel.cs +++ b/TileShop.WPF/Features/Shell/EditorsViewModel.cs @@ -128,9 +128,12 @@ public void ActivateEditor(IProjectResource resource) switch (resource) { - case Palette pal: + case Palette pal when pal.ColorModel != ColorModel.Nes: newDocument = new PaletteEditorViewModel(pal, _paletteService, _events); break; + case Palette pal when pal.ColorModel == ColorModel.Nes: + newDocument = new TablePaletteEditorViewModel(pal, _paletteService, _events); + break; case ScatteredArranger scatteredArranger: newDocument = new ScatteredArrangerEditorViewModel(scatteredArranger, _events, _windowManager, _paletteService, _projectService); break; diff --git a/TileShop.WPF/Models/ValidatedColorModel.cs b/TileShop.WPF/Models/ValidatedColor32Model.cs similarity index 96% rename from TileShop.WPF/Models/ValidatedColorModel.cs rename to TileShop.WPF/Models/ValidatedColor32Model.cs index b90b58fc..8e83cc63 100644 --- a/TileShop.WPF/Models/ValidatedColorModel.cs +++ b/TileShop.WPF/Models/ValidatedColor32Model.cs @@ -4,7 +4,7 @@ namespace TileShop.WPF.Models { - public class ValidatedColorModel : PropertyChangedBase + public class ValidatedColor32Model : PropertyChangedBase { private IColor32 _foreignColor; private readonly IColorFactory _colorFactory; @@ -110,7 +110,7 @@ public int Index set => SetAndNotify(ref _index, value); } - public ValidatedColorModel(IColor32 foreignColor, int index, IColorFactory colorFactory) + public ValidatedColor32Model(IColor32 foreignColor, int index, IColorFactory colorFactory) { _foreignColor = foreignColor; Index = index; diff --git a/TileShop.WPF/Models/ValidatedTableColorModel.cs b/TileShop.WPF/Models/ValidatedTableColorModel.cs new file mode 100644 index 00000000..9c4c55c6 --- /dev/null +++ b/TileShop.WPF/Models/ValidatedTableColorModel.cs @@ -0,0 +1,50 @@ +using System.Windows.Media; +using ImageMagitek.Colors; +using Stylet; + +namespace TileShop.WPF.Models +{ + public class ValidatedTableColorModel : PropertyChangedBase + { + private ITableColor _foreignColor; + private readonly IColorFactory _colorFactory; + + public ITableColor WorkingColor { get; set; } + + private Color _color; + public Color Color + { + get => _color; + set => SetAndNotify(ref _color, value); + } + + public bool CanSaveColor + { + get => WorkingColor.Color != _foreignColor.Color; + } + + private int _index; + public int Index + { + get => _index; + set => SetAndNotify(ref _index, value); + } + + public ValidatedTableColorModel(ITableColor foreignColor, int index, IColorFactory colorFactory) + { + _foreignColor = foreignColor; + Index = index; + _colorFactory = colorFactory; + + WorkingColor = (ITableColor)_colorFactory.CloneColor(foreignColor); + var nativeColor = _colorFactory.ToNative(foreignColor); + Color = Color.FromArgb(nativeColor.A, nativeColor.R, nativeColor.G, nativeColor.B); + } + + public void SaveColor() + { + _foreignColor = (ITableColor)_colorFactory.CloneColor(WorkingColor); + OnPropertyChanged(nameof(CanSaveColor)); + } + } +} diff --git a/TileShop.WPF/TileShopBootstrapper.cs b/TileShop.WPF/TileShopBootstrapper.cs index e4c0496f..1306eb7b 100644 --- a/TileShop.WPF/TileShopBootstrapper.cs +++ b/TileShop.WPF/TileShopBootstrapper.cs @@ -181,6 +181,7 @@ private void ReadPalettes(string palettesPath, AppSettings settings, ContainerBu var nesPaletteFileName = Path.Combine(palettesPath, $"{settings.NesPalette}.json"); var nesPalette = _paletteService.ReadJsonPalette(nesPaletteFileName); (_colorFactory as ColorFactory).SetNesPalette(nesPalette); + (_paletteService as PaletteService).SetNesPalette(nesPalette); builder.RegisterInstance(_paletteService); } diff --git a/TileShop.WPF/ViewExtenders/Selectors/DocumentHeaderTemplateSelector.cs b/TileShop.WPF/ViewExtenders/Selectors/DocumentHeaderTemplateSelector.cs index 20e5c96c..a1fc7106 100644 --- a/TileShop.WPF/ViewExtenders/Selectors/DocumentHeaderTemplateSelector.cs +++ b/TileShop.WPF/ViewExtenders/Selectors/DocumentHeaderTemplateSelector.cs @@ -28,6 +28,7 @@ public override DataTemplate SelectTemplate(object item, DependencyObject contai return content switch { PaletteEditorViewModel _ => PaletteDocumentHeaderTemplate, + TablePaletteEditorViewModel _ => PaletteDocumentHeaderTemplate, ScatteredArrangerEditorViewModel _ => ScatteredArrangerDocumentHeaderTemplate, SequentialArrangerEditorViewModel _ => SequentialArrangerDocumentHeaderTemplate, DataFileEditorViewModel _ => DataFileDocumentHeaderTemplate, diff --git a/TileShop.WPF/ViewExtenders/Selectors/EditorHostTemplateSelector.cs b/TileShop.WPF/ViewExtenders/Selectors/EditorHostTemplateSelector.cs index 5f4b1dbd..d33e3817 100644 --- a/TileShop.WPF/ViewExtenders/Selectors/EditorHostTemplateSelector.cs +++ b/TileShop.WPF/ViewExtenders/Selectors/EditorHostTemplateSelector.cs @@ -21,6 +21,7 @@ public override DataTemplate SelectTemplate(object item, DependencyObject contai return item switch { PaletteEditorViewModel _ => PaletteEditorTemplate, + TablePaletteEditorViewModel _ => PaletteEditorTemplate, ScatteredArrangerEditorViewModel _ => ScatteredArrangerEditorTemplate, SequentialArrangerEditorViewModel _ => SequentialArrangerEditorTemplate, DataFileEditorViewModel _ => DataFileEditorTemplate, From 9c753373aeb049a57070bf67d79091f2f39de220 Mon Sep 17 00:00:00 2001 From: Stephen Monaco Date: Tue, 3 Nov 2020 03:24:23 -0500 Subject: [PATCH 35/38] Update dependencies --- TileShop.WPF/TileShop.WPF.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TileShop.WPF/TileShop.WPF.csproj b/TileShop.WPF/TileShop.WPF.csproj index 3de9ac39..c1df3ccd 100644 --- a/TileShop.WPF/TileShop.WPF.csproj +++ b/TileShop.WPF/TileShop.WPF.csproj @@ -23,9 +23,9 @@ - - - + + + @@ -36,7 +36,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 3282478e43fb8284be621abed1a3c5a727857a4a Mon Sep 17 00:00:00 2001 From: Stephen Monaco Date: Thu, 5 Nov 2020 23:12:56 -0500 Subject: [PATCH 36/38] Remove unused code --- ImageMagitek/Image/ImageFileAdapter.cs | 91 -------------------------- 1 file changed, 91 deletions(-) diff --git a/ImageMagitek/Image/ImageFileAdapter.cs b/ImageMagitek/Image/ImageFileAdapter.cs index 35f87650..d985eccd 100644 --- a/ImageMagitek/Image/ImageFileAdapter.cs +++ b/ImageMagitek/Image/ImageFileAdapter.cs @@ -151,96 +151,5 @@ public ColorRgba32[] LoadImage(string imagePath) return outputImage; } - - - //public void SaveImage(DirectImage image, string imagePath) - //{ - // using var outputImage = new Image(image.Width, image.Height); - - // var span = outputImage.GetPixelSpan(); - - // for (int i = 0; i < span.Length; i++) - // { - // var color = image.Image[i].ToRgba32(); - // span[i] = color; - // } - - // using var outputStream = new FileStream(imagePath, FileMode.Create, FileAccess.Write, FileShare.Read); - // outputImage.SaveAsPng(outputStream); - //} - - //public void SaveImage(IndexedImage image, Palette pal, string imagePath) - //{ - // using var outputImage = new Image(image.Width, image.Height); - - // var span = outputImage.GetPixelSpan(); - - // for (int i = 0; i < span.Length; i++) - // { - // var color = pal.GetNativeColor(image.Image[i]); - // span[i] = color.ToRgba32(); - // } - - // using var outputStream = new FileStream(imagePath, FileMode.Create, FileAccess.Write, FileShare.Read); - // outputImage.SaveAsPng(outputStream); - //} - - //public void SaveImage(IndexedImage image, Arranger arranger, string imagePath) - //{ - // using var outputImage = new Image(image.Width, image.Height); - - // for (int y = 0; y < image.Height; y++) - // { - // for (int x = 0; x < image.Width; x++) - // { - // var span = outputImage.GetPixelRowSpan(y); - // var pal = arranger.GetElement(x / image.Width, y / image.Height).Palette; - // var color = pal[image.GetPixel(x, y)]; - // span[x] = color.ToRgba32(); - // } - // } - - // using var outputStream = new FileStream(imagePath, FileMode.Create, FileAccess.Write, FileShare.Read); - // outputImage.SaveAsPng(outputStream); - //} - - //public DirectImage LoadDirectImage(string imagePath) - //{ - // throw new NotImplementedException(); - // //using var image = Image.Load(imagePath); - - // //var direct = new DirectImage(image.Width, image.Height); - - // //var span = image.GetPixelSpan(); - - // //for (int i = 0; i < span.Length; i++) - // //{ - // // var color = new ColorRgba32(span[i].R, span[i].G, span[i].B, span[i].A); - // // direct.Image[i] = color; - // //} - - // //return direct; - //} - - //public IndexedImage LoadIndexedImage(string imagePath, Palette pal) - //{ - // throw new NotImplementedException(); - // //using var image = Image.Load(imagePath); - - // //var indexed = new IndexedImage(image.Width, image.Height); - - // //var span = image.GetPixelSpan(); - - // //for (int i = 0; i < span.Length; i++) - // //{ - // // var nc = new ColorRgba32(span[i].R, span[i].G, span[i].B, span[i].A); - // // if (pal.ContainsNativeColor(nc)) - // // throw new Exception($"{nameof(LoadIndexedImage)}: Image '{imagePath}' contained a color not contained by the palette '{pal.Name}'"); - - // // indexed.Image[i] = pal.GetIndexByNativeColor(nc, true); - // //} - - // //return indexed; - //} } } From ee9384b3fbd55eb047ab836f37125a6c644968e6 Mon Sep 17 00:00:00 2001 From: Stephen Monaco Date: Thu, 5 Nov 2020 23:48:43 -0500 Subject: [PATCH 37/38] Refactor ImageFileAdapter --- ImageMagitek.Benchmarks/Snes3bppDecodeToImage.cs | 4 ++-- ImageMagitek/Image/IImageFileAdapter.cs | 13 +++++++++++++ ...ImageFileAdapter.cs => ImageSharpFileAdapter.cs} | 11 +---------- ImageMagitekConsole/CommandProcessor.cs | 8 ++++---- .../Features/Dialogs/ImportImageViewModel.cs | 4 ++-- .../Features/Project/ProjectTreeViewModel.cs | 4 ++-- 6 files changed, 24 insertions(+), 20 deletions(-) create mode 100644 ImageMagitek/Image/IImageFileAdapter.cs rename ImageMagitek/Image/{ImageFileAdapter.cs => ImageSharpFileAdapter.cs} (90%) diff --git a/ImageMagitek.Benchmarks/Snes3bppDecodeToImage.cs b/ImageMagitek.Benchmarks/Snes3bppDecodeToImage.cs index 5e5deb8c..ff441f7b 100644 --- a/ImageMagitek.Benchmarks/Snes3bppDecodeToImage.cs +++ b/ImageMagitek.Benchmarks/Snes3bppDecodeToImage.cs @@ -105,7 +105,7 @@ public void DecodeNative() var outputFileName = Path.Combine(outputDirectory, $"Native.{i}.bmp"); var image = new IndexedImage(arranger); - image.ExportImage(outputFileName, new ImageFileAdapter()); + image.ExportImage(outputFileName, new ImageSharpFileAdapter()); } } @@ -117,7 +117,7 @@ public void DecodeGeneric() var outputFileName = Path.Combine(outputDirectory, $"Generic.{i}.bmp"); var image = new IndexedImage(arranger); - image.ExportImage(outputFileName, new ImageFileAdapter()); + image.ExportImage(outputFileName, new ImageSharpFileAdapter()); } } } diff --git a/ImageMagitek/Image/IImageFileAdapter.cs b/ImageMagitek/Image/IImageFileAdapter.cs new file mode 100644 index 00000000..aa7ec8b9 --- /dev/null +++ b/ImageMagitek/Image/IImageFileAdapter.cs @@ -0,0 +1,13 @@ +using ImageMagitek.Colors; + +namespace ImageMagitek +{ + public interface IImageFileAdapter + { + void SaveImage(byte[] image, Arranger arranger, string imagePath); + void SaveImage(ColorRgba32[] image, int width, int height, string imagePath); + byte[] LoadImage(string imagePath, Arranger arranger, ColorMatchStrategy matchStrategy); + MagitekResult TryLoadImage(string imagePath, Arranger arranger, ColorMatchStrategy matchStrategy, out byte[] image); + ColorRgba32[] LoadImage(string imagePath); + } +} diff --git a/ImageMagitek/Image/ImageFileAdapter.cs b/ImageMagitek/Image/ImageSharpFileAdapter.cs similarity index 90% rename from ImageMagitek/Image/ImageFileAdapter.cs rename to ImageMagitek/Image/ImageSharpFileAdapter.cs index d985eccd..2adc36a2 100644 --- a/ImageMagitek/Image/ImageFileAdapter.cs +++ b/ImageMagitek/Image/ImageSharpFileAdapter.cs @@ -5,16 +5,7 @@ namespace ImageMagitek { - public interface IImageFileAdapter - { - void SaveImage(byte[] image, Arranger arranger, string imagePath); - void SaveImage(ColorRgba32[] image, int width, int height, string imagePath); - byte[] LoadImage(string imagePath, Arranger arranger, ColorMatchStrategy matchStrategy); - MagitekResult TryLoadImage(string imagePath, Arranger arranger, ColorMatchStrategy matchStrategy, out byte[] image); - ColorRgba32[] LoadImage(string imagePath); - } - - public class ImageFileAdapter : IImageFileAdapter + public class ImageSharpFileAdapter : IImageFileAdapter { public void SaveImage(byte[] image, Arranger arranger, string imagePath) { diff --git a/ImageMagitekConsole/CommandProcessor.cs b/ImageMagitekConsole/CommandProcessor.cs index f6520008..3a4eedf3 100644 --- a/ImageMagitekConsole/CommandProcessor.cs +++ b/ImageMagitekConsole/CommandProcessor.cs @@ -50,12 +50,12 @@ public bool ExportArranger(string arrangerKey, string projectRoot) if (arranger.ColorType == PixelColorType.Indexed) { var image = new IndexedImage(arranger); - image.ExportImage(exportFileName, new ImageFileAdapter()); + image.ExportImage(exportFileName, new ImageSharpFileAdapter()); } else if (arranger.ColorType == PixelColorType.Direct) { var image = new DirectImage(arranger); - image.ExportImage(exportFileName, new ImageFileAdapter()); + image.ExportImage(exportFileName, new ImageSharpFileAdapter()); } return true; @@ -81,13 +81,13 @@ public bool ImportImage(string imageFileName, string arrangerKey) if (arranger.ColorType == PixelColorType.Indexed) { var image = new IndexedImage(arranger); - image.ImportImage(imageFileName, new ImageFileAdapter(), ColorMatchStrategy.Exact); + image.ImportImage(imageFileName, new ImageSharpFileAdapter(), ColorMatchStrategy.Exact); image.SaveImage(); } else if (arranger.ColorType == PixelColorType.Direct) { var image = new DirectImage(arranger); - image.ImportImage(imageFileName, new ImageFileAdapter()); + image.ImportImage(imageFileName, new ImageSharpFileAdapter()); image.SaveImage(); } diff --git a/TileShop.WPF/Features/Dialogs/ImportImageViewModel.cs b/TileShop.WPF/Features/Dialogs/ImportImageViewModel.cs index 80fcf400..a8a3c567 100644 --- a/TileShop.WPF/Features/Dialogs/ImportImageViewModel.cs +++ b/TileShop.WPF/Features/Dialogs/ImportImageViewModel.cs @@ -117,7 +117,7 @@ public void BrowseForImportFile() else if (_arranger.ColorType == PixelColorType.Direct) { _importedDirect = new DirectImage(_arranger); - _importedDirect.ImportImage(ImageFileName, new ImageFileAdapter()); + _importedDirect.ImportImage(ImageFileName, new ImageSharpFileAdapter()); ImportedSource = new DirectBitmapAdapter(_importedDirect); CanImport = true; } @@ -129,7 +129,7 @@ private void ImportIndexed(string fileName) var matchStrategy = UseExactMatching ? ColorMatchStrategy.Exact : ColorMatchStrategy.Nearest; _importedIndexed = new IndexedImage(_arranger); - var result = _importedIndexed.TryImportImage(fileName, new ImageFileAdapter(), matchStrategy); + var result = _importedIndexed.TryImportImage(fileName, new ImageSharpFileAdapter(), matchStrategy); result.Switch( success => diff --git a/TileShop.WPF/Features/Project/ProjectTreeViewModel.cs b/TileShop.WPF/Features/Project/ProjectTreeViewModel.cs index ab02b762..b8c27674 100644 --- a/TileShop.WPF/Features/Project/ProjectTreeViewModel.cs +++ b/TileShop.WPF/Features/Project/ProjectTreeViewModel.cs @@ -214,12 +214,12 @@ public void ExportArrangerAs(ResourceNodeViewModel nodeModel) if (arranger.ColorType == PixelColorType.Indexed) { var image = new IndexedImage(arranger); - image.ExportImage(exportFileName, new ImageFileAdapter()); + image.ExportImage(exportFileName, new ImageSharpFileAdapter()); } else if (arranger.ColorType == PixelColorType.Direct) { var image = new DirectImage(arranger); - image.ExportImage(exportFileName, new ImageFileAdapter()); + image.ExportImage(exportFileName, new ImageSharpFileAdapter()); } } } From 1a5d7d8e7e2e037b2171c499d76d973b43e93295 Mon Sep 17 00:00:00 2001 From: Stephen Monaco Date: Mon, 9 Nov 2020 21:38:38 -0500 Subject: [PATCH 38/38] Fix MoveByteDown hotkey for + input --- .../Features/Arranger Editors/SequentialArrangerEditorView.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TileShop.WPF/Features/Arranger Editors/SequentialArrangerEditorView.xaml b/TileShop.WPF/Features/Arranger Editors/SequentialArrangerEditorView.xaml index 69cd7de9..c29e16fb 100644 --- a/TileShop.WPF/Features/Arranger Editors/SequentialArrangerEditorView.xaml +++ b/TileShop.WPF/Features/Arranger Editors/SequentialArrangerEditorView.xaml @@ -17,7 +17,7 @@ - +