Browse Source

changed getColor

Alexander Hendrich 11 years ago
parent
commit
7d76ed6f81
2 changed files with 8 additions and 3 deletions
  1. 7 2
      bbiwarg/DataSource/ColorImage.cs
  2. 1 1
      bbiwarg/Test/OutputTest.cs

+ 7 - 2
bbiwarg/DataSource/ColorImage.cs

@@ -31,8 +31,13 @@ namespace bbiwarg.DataSource
 
         public Color getColor(int x, int y)
         {
-            return Color.FromArgb(data[4 * (y * width + x) + 3], data[4 * (y * width + x) + 0], 
-                                  data[4 * (y * width + x) + 1], data[4 * (y * width + x) + 2]);
+            int offset = 4 * (y * width + x);
+            byte alpha = data[offset + 3];
+            byte red = data[offset + 0];
+            byte green = data[offset + 1];
+            byte blue = data[offset + 2];
+
+            return Color.FromArgb(alpha, red, green, blue);
         }
     }
 }

+ 1 - 1
bbiwarg/Test/OutputTest.cs

@@ -92,7 +92,7 @@ namespace bbiwarg.Test
             palmPosition.draw();
             //Console.WriteLine(palmPosition.toString());
 
-            Console.WriteLine("Palm Position: x: " + (int)palmPixel[0] + " y: " + (int)palmPixel[1] + " 3DDepth: " + palmPosition.depth + " ImageDepth: " + imageData.getDepth((int)palmPixel[0], (int)palmPixel[1]));
+            //Console.WriteLine("Palm Position: x: " + (int)palmPixel[0] + " y: " + (int)palmPixel[1] + " 3DDepth: " + palmPosition.depth + " ImageDepth: " + imageData.getDepth((int)palmPixel[0], (int)palmPixel[1]));
 
             for (int i = 0; i < triangles.Count; i++)
             {