Welcome to mirror list, hosted at ThFree Co, Russian Federation.

NesTiler.git/NesTiler.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2020-11-08 18:28:26 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2020-11-08 18:28:26 +0300
commitf8b7349e7b6de6b393c0c8c771c6fd5f3f6b749e (patch)
tree6a1e7ccece05edde0ee93825e8fe78a2dbf7e74f /Palette.cs
parent178dc330a7cd04f6e8ad3900274311db05b7ebed (diff)
Optimization
Diffstat (limited to 'Palette.cs')
-rw-r--r--Palette.cs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Palette.cs b/Palette.cs
index eadae0f..1e2e7ba 100644
--- a/Palette.cs
+++ b/Palette.cs
@@ -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;
}
}