title: Create or cut 6 equal parts from a bitmap not working
body: <p>In my app I am having a method which cuts the 6 equal parts from a bitmap given to it. It works fine with the bitmap in square but does not work with rectangle bitmaps.</p>
  
  <p>Here is the method.</p>
  
  <pre><code>public Bitmap[] splitBitmap6(Bitmap picture) {
      int w = picture.getWidth();
      int h = picture.getHeight();
      Bitmap scaledBitmap = null;
  
      int widthofmainBitMap  = screenWidth ;
      int heightofmainBitMap = widthofmainBitMap*h/w;
  
      scaledBitmap = Bitmap.createScaledBitmap(picture, widthofmainBitMap, heightofmainBitMap, true);
  
      Bitmap[] imgs = new Bitmap[];
  
      imgs[0] = Bitmap.createBitmap(scaledBitmap, 0, 0, picture.getWidth()/3 , picture.getHeight()/2);
      imgs[1] = Bitmap.createBitmap(scaledBitmap, picture.getWidth()/3, 0, picture.getWidth()/3,picture.getHeight()/2);
  // i get the error at this line
  
      imgs[2] = Bitmap.createBitmap(scaledBitmap,((picture.getWidth()/3)+(picture.getWidth()/3)), 0, picture.getWidth()/3,picture.getHeight()/2);
      imgs[3] = Bitmap.createBitmap(scaledBitmap, 0, (picture.getHeight()/2), picture.getWidth()/3, picture.getHeight()/2);
      imgs[4] = Bitmap.createBitmap(scaledBitmap, picture.getWidth()/3, picture.getHeight()/2, picture.getWidth()/3,picture.getHeight()/2);
      imgs[5] = Bitmap.createBitmap(scaledBitmap, (picture.getWidth()/3)+(picture.getWidth()/3), picture.getHeight()/2,picture.getWidth()/3,picture.getHeight()/2);
  
      return imgs;
  }
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>java.lang.illegalargumentexception: x + width must be &lt;= bitmap.width.
  </code></pre>