title: What's the order of the pixel components returned by Raster.getPixels()?
body: <p>I've written image processing code that copies the pixel data into integer array like this:</p>
  
  <pre><code>void processImage(BufferedImage source) {
  
      WritableRaster raster = source.getRaster();
      int numBands = raster.getNumBands();
      int height = raster.getHeight();
      int width = raster.getWidth();
  
      int[] pixelRow = new int[width * numBands];
      for (int i = 0; i &lt; height; i++) {
          raster.getPixels(raster.getMinX(), raster.getMinY() + i, width, 1, pixelRow);
  
          // do some processing
      }
  
      // create a new image
      return newImage;
  }
  </code></pre>
  
  <p>The code works with the images I've tested so far. The <code>pixelRow</code> array seems to always receive the pixel components in the order Red, Green and Blue for images with 3 bands (no alpha channel) and in the order Red, Green, Blue and Alpha for those with 4 bands (with alpha channel).</p>
  
  <p>However, I cannot find any description that states this. Is it guaranteed that I will always get the pixel components in that order? Is there any specification that describes this?</p>