diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2020-11-08 18:28:26 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2020-11-08 18:28:26 +0300 |
commit | f8b7349e7b6de6b393c0c8c771c6fd5f3f6b749e (patch) | |
tree | 6a1e7ccece05edde0ee93825e8fe78a2dbf7e74f /Palette.cs | |
parent | 178dc330a7cd04f6e8ad3900274311db05b7ebed (diff) |
Optimization
Diffstat (limited to 'Palette.cs')
-rw-r--r-- | Palette.cs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -30,7 +30,7 @@ namespace com.clusterrr.Famicom.NesTiler // Empty palette
}
- public Palette(Image image, int leftX, int topY, int width, int height, Color bgColor)
+ public Palette(FastBitmap image, int leftX, int topY, int width, int height, Color bgColor)
{
Dictionary<Color, int> colorCounter = new Dictionary<Color, int>();
colorCounter[bgColor] = 0;
@@ -38,7 +38,7 @@ namespace com.clusterrr.Famicom.NesTiler {
for (int x = leftX; x < leftX + width; x++)
{
- var color = ((Bitmap)image).GetPixel(x, y);
+ var color = image.GetPixel(x, y);
if (!colorCounter.ContainsKey(color)) colorCounter[color] = 0;
colorCounter[color]++;
}
@@ -66,14 +66,14 @@ namespace com.clusterrr.Famicom.NesTiler if (colorsList.Count >= 3) this[3] = colorsList[2];
}
- public double GetTileDelta(Image image, int leftX, int topY, int width, int height, Color bgColor)
+ public double GetTileDelta(FastBitmap image, int leftX, int topY, int width, int height, Color bgColor)
{
double delta = 0;
for (int y = topY; y < topY + height; y++)
{
for (int x = leftX; x < leftX + width; x++)
{
- var color = ((Bitmap)image).GetPixel(x, y);
+ var color = image.GetPixel(x, y);
delta += GetMinDelta(color, bgColor).delta;
}
}
|