Canvas.drawBitmap drawing the image with a yellow tint
<p>I am trying to draw the 'Y' component as greyscale from the image I get from the Camera via onPreviewFrame.</p>

<p>I am using the version of Canvas.drawBitmap that takes an array of 'colors' as a parameter. The Android docs don't mention what format the Color is in, so I'm assuming ARGB 8888.</p>

<p>I do get an image showing up, but it is showing up with an odd Yellow tint.</p>

<p>Here is my code below:</p>

<pre><code>  public void onPreviewFrame(byte[] bytes, Camera camera) {    
    Canvas canvas = null;
    try {
      synchronized(mSurfaceHolder) {
        canvas = mSurfaceHolder.lockCanvas();

        Size size = camera.getParameters().getPreviewSize();

        int width = size.width;
        int height = size.height;
        if (mHeight * mWidth != height * width)
        {
          mColors = new int[width * height];
          mHeight = height;
          mWidth = width;
          Log.i(TAG, "prewviw size = " + width + " x " + height);
        }
        for (int x = 0; x &lt; width; x ++) {
          for (int y = 0; y &lt; height; y++) {
            int yval = bytes[x + y * width];

            mColors[x + y * width] = (0xFF &lt;&lt; 24) | (yval &lt;&lt; 16) | (yval &lt;&lt; 8) | yval;
          }
        }

        canvas.drawBitmap(mColors, 0, width, 0.f, 0.f, width, height, false, null);
      }
    }
    finally {
      if (canvas != null) {
        mSurfaceHolder.unlockCanvasAndPost(canvas);
      }
    }
  }
</code></pre>

<p>I've also tried using another version of Canvas.drawBitmap that takes a Bitmap as a parameter. I constructed the Bitmap in a similar way from the same array and I told it to use ARGB explicitly. But it still ended up being tinted Yellow!</p>

<p>What am I doing wrong here?</p>
