summaryrefslogtreecommitdiff
path: root/dyecmd
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-05 03:36:30 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-05 03:36:30 +0300
commit173233eee80dbb3a69b3bcf4215834f79ac7d663 (patch)
treed8daf5afda0f12d3c57437db7293def9bf93d000 /dyecmd
parenta6e169e2d7259745203d20c5124d3ab911e60e63 (diff)
downloadevol-tools-173233eee80dbb3a69b3bcf4215834f79ac7d663.tar.gz
evol-tools-173233eee80dbb3a69b3bcf4215834f79ac7d663.tar.bz2
evol-tools-173233eee80dbb3a69b3bcf4215834f79ac7d663.tar.xz
evol-tools-173233eee80dbb3a69b3bcf4215834f79ac7d663.zip
Add debug info to dye tool.
Diffstat (limited to 'dyecmd')
-rwxr-xr-xdyecmd/src/dye.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/dyecmd/src/dye.cpp b/dyecmd/src/dye.cpp
index 323c173..760ff23 100755
--- a/dyecmd/src/dye.cpp
+++ b/dyecmd/src/dye.cpp
@@ -82,8 +82,8 @@ Palette::Palette(const std::string &description)
void Palette::getColor(int intensity, int color[3]) const
{
printf ("---------------------------------------------\n");
- printf ("intensity=%d\n", intensity);
- printf ("image color: %d, %d, %d\n", color[0], color[1], color[2]);
+ printf ("intensity=%x\n", intensity);
+ printf ("image color: %x, %x, %x\n", color[0], color[1], color[2]);
// Return implicit black
if (intensity == 0)
@@ -113,13 +113,14 @@ void Palette::getColor(int intensity, int color[3]) const
g2 = mColors[j].value[1],
b2 = mColors[j].value[2];
- printf ("r2 = mColors[j].value[0]=%d\n", r2);
- printf ("g2 = mColors[j].value[1]=%d\n", g2);
- printf ("b2 = mColors[j].value[2]=%d\n", b2);
+ printf ("read from palate at j (%d)\n", j);
+ printf ("r2 = mColors[j].value[0]=%x\n", r2);
+ printf ("g2 = mColors[j].value[1]=%x\n", g2);
+ printf ("b2 = mColors[j].value[2]=%x\n", b2);
if (t == 0)
{
- printf ("t == 0, return rgb = %d, %d, %d\n", r2, g2,b2);
+ printf ("t == 0, return rgb = %x, %x, %x\n", r2, g2, b2);
// Exact color.
color[0] = r2;
color[1] = g2;
@@ -135,9 +136,10 @@ void Palette::getColor(int intensity, int color[3]) const
r1 = mColors[i - 1].value[0];
g1 = mColors[i - 1].value[1];
b1 = mColors[i - 1].value[2];
- printf ("r1 = mColors[i - 1].value[0] = %d\n", r1);
- printf ("g1 = mColors[i - 1].value[1] = %d\n", g1);
- printf ("b1 = mColors[i - 1].value[2] = %d\n", b1);
+ printf ("read from palate at i-1 (%d)\n", i - 1);
+ printf ("r1 = mColors[i - 1].value[0] = %x\n", r1);
+ printf ("g1 = mColors[i - 1].value[1] = %x\n", g1);
+ printf ("b1 = mColors[i - 1].value[2] = %x\n", b1);
}
// Perform a linear interpolation.
@@ -145,9 +147,9 @@ void Palette::getColor(int intensity, int color[3]) const
color[1] = ((255 - t) * g1 + t * g2) / 255;
color[2] = ((255 - t) * b1 + t * b2) / 255;
printf ("result color:\n");
- printf ("color[0] = ((255 - t) * r1 + t * r2) / 255 = %d\n", color[0]);
- printf ("color[1] = ((255 - t) * g1 + t * g2) / 255 = %d\n", color[1]);
- printf ("color[2] = ((255 - t) * b1 + t * b2) / 255 = %d\n", color[2]);
+ printf ("color[0] = ((255 - t) * r1 + t * r2) / 255 = %d * %d + %d * %d = %x\n", 255 - t, r1, t, r2, color[0]);
+ printf ("color[1] = ((255 - t) * g1 + t * g2) / 255 = %d * %d + %d * %d = %x\n", 255 - t, g1, t, g2, color[1]);
+ printf ("color[2] = ((255 - t) * b1 + t * b2) / 255 = %d * %d + %d * %d = %x\n", 255 - t, b1, t, b2, color[2]);
}
Dye::Dye(const std::string &description)