title: Blending a picture with White
body: <p>Hi I have a project where I need to blend white and black with a picture. I have the black code working but I can't seem to get the white to work. Can someone please advise me on what I am doing wrong, I had the white working briefly earlier but it went away and I don't really know how... Thank you! There is a link for the picture result on the bottom!</p>
  
  <pre><code>import java.awt.Color;
  public class BlendingWithBlackAndWhite 
  {
   public static void main(String[] args)
  
  {
  FileChooser.pickMediaPath();
  BlendablePic pRef = new BlendablePic(FileChooser.pickAFile());
  double a[]= new double[3];
  a[0]=0.1;
  a[1]=0.3;
  a[2]=0.5;
  pRef.blendRectWithWhite(0, 920, 920, 920, a[0]+0.9);
  pRef.blendRectWithWhite(920, 920, 920, 1840, a[2]);
  pRef.blendRectWithWhite(1840, 920, 920, 2760, a[1]-0.3);
  pRef.blendRectWithBlack(0,0, 920, 920, a[1]);
  pRef.blendRectWithBlack(920,0, 1784, 920, a[0]);
  pRef.blendRectWithBlack(1785,0, 2600, 920, a[2]*-0.2);
  pRef.explore();
  }}
  
  public class BlendablePic extends Picture{
  public BlendablePic(String filename){
  super(filename);
   }
   public void blendRectWithWhite(int xMin, int yMin, int xMax, int yMax, double a)
    {
  int x;
  x = xMin;
  while (x&lt;= xMax)
  {
    int y;
    y = yMin;
    while(y &lt;= yMax)
    {
      Pixel refPix = this.getPixel(x,y);
      refPix.setRed((int)Math.round(refPix.getRed() * (1.0-a)+255*a));
      refPix.setGreen((int)Math.round(refPix.getGreen() * (1.0-a)+200*a));
      refPix.setBlue((int)Math.round(refPix.getBlue() * (1.0-a)+255*a));
    y= y+1;
    }
    x = x+1;
  }
  }
  public void blendRectWithBlack(int xMin, int yMin, int xMax, int yMax, double a)
  {
  int x;
  x = xMin;
  while (x&lt;= xMax)
  {
    int y;
    y = yMin;
    while(y &lt;= yMax)
    {
      Pixel refPix = this.getPixel(x,y);
      refPix.setRed((int)Math.round(refPix.getRed() * (0.2 +a)+0*a));
      refPix.setGreen((int)Math.round(refPix.getGreen() * (0.2 +a)+0*a));
      refPix.setBlue((int)Math.round(refPix.getBlue() * (0.2 +a)+0*a));
  
    y = y+1;
  }
  x = x+1;
   }
   }}
  </code></pre>
  
  <p>the first <a href="http://feathermeadows.tumblr.com/image/46611421940" rel="nofollow">image</a> is what I need to do and the second is what I get from the coding above.</p>