Using system agnostic image processing
This commit is contained in:
+5
-9
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace fxl.codes.kisekae.Models
|
||||
@@ -6,6 +7,7 @@ namespace fxl.codes.kisekae.Models
|
||||
public class CelModel
|
||||
{
|
||||
public const string Regex = "#([0-9]*)[\\.]?([0-9]*?)\\s([a-zA-Z\\-0-9]*\\.[cCeElL]+)\\s[\\*]?([0-9]*)?\\s?:([0-9\\s]*);(.*)";
|
||||
public Dictionary<int, string> ImageByPalette = new();
|
||||
|
||||
public CelModel(string line)
|
||||
{
|
||||
@@ -15,7 +17,7 @@ namespace fxl.codes.kisekae.Models
|
||||
foreach (var group in matcher.GetGroupNames())
|
||||
{
|
||||
if (group == "0") continue;
|
||||
|
||||
|
||||
match.Groups.TryGetValue(group, out var value);
|
||||
if (string.IsNullOrEmpty(value?.Value)) continue;
|
||||
|
||||
@@ -34,10 +36,7 @@ namespace fxl.codes.kisekae.Models
|
||||
PaletteId = int.Parse(value.Value);
|
||||
break;
|
||||
case "5":
|
||||
foreach (var id in value.Value.Split(' ', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
Sets[int.Parse(id)] = true;
|
||||
}
|
||||
foreach (var id in value.Value.Split(' ', StringSplitOptions.RemoveEmptyEntries)) Sets[int.Parse(id)] = true;
|
||||
break;
|
||||
case "6":
|
||||
Comment = value.Value;
|
||||
@@ -52,9 +51,6 @@ namespace fxl.codes.kisekae.Models
|
||||
public int PaletteId { get; }
|
||||
public bool[] Sets { get; } = new bool[10];
|
||||
public string Comment { get; }
|
||||
|
||||
public int CurrentPaletteId { get; set; }
|
||||
public Point[] InitialPositions { get; set; } = new Point[10];
|
||||
public Point[] CurrentPositions { get; set; } = new Point[10];
|
||||
public Point[] InitialPositions { get; } = new Point[10];
|
||||
}
|
||||
}
|
||||
+2
-18
@@ -1,3 +1,4 @@
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace fxl.codes.kisekae.Models
|
||||
@@ -32,23 +33,6 @@ namespace fxl.codes.kisekae.Models
|
||||
|
||||
public string FileName { get; }
|
||||
public string Comment { get; }
|
||||
public Color[] Colors { get; set; }
|
||||
}
|
||||
|
||||
public class Color
|
||||
{
|
||||
public Color(int red, int green, int blue, int group, int depth)
|
||||
{
|
||||
var multiplier = depth == 12 ? 16 : 1;
|
||||
Red = red * multiplier;
|
||||
Green = green * multiplier;
|
||||
Blue = blue * multiplier;
|
||||
Group = group;
|
||||
}
|
||||
|
||||
public int Red { get; }
|
||||
public int Green { get; }
|
||||
public int Blue { get; }
|
||||
public int Group { get; }
|
||||
internal Color[] Colors { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,5 @@ namespace fxl.codes.kisekae.Models
|
||||
public List<PaletteModel> Palettes { get; } = new();
|
||||
public List<CelModel> Cels { get; } = new();
|
||||
public int[] CurrentPalettes = new int[10];
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
foreach (var cel in Cels)
|
||||
{
|
||||
cel.CurrentPositions = cel.InitialPositions;
|
||||
cel.CurrentPaletteId = cel.PaletteId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user