title: How to create jigsaw puzzle pieces without using mask?
body: <p>I am trying to create a jigsaw puzzle game, and I would like to know of alternative ways of creating puzzle pieces without using mask. Currently I have jigsaw pieces by taking a full image, breaking that image up into four pieces (lets say the puzzle is 2x2) and then storing and applying a mask to each piece. It looks like the below</p>
  
  <pre><code>    // create standard puzzle pieces
      arryPieceEndPos = new int[mCols][mRows];
      arryPieceImg = new Bitmap[mCols * mRows];
      arryIsPieceLocked = new boolean[mCols * mRows];
  
      int pos = 0;
      for (int c = 0; c &lt; mCols; c++) {
          for (int r = 0; r &lt; mRows; r++) {
              arryPieceImg[pos] = Bitmap.createBitmap(mBitmap,
              c * mPieceWidth, r * mPieceHeight,
              mPieceWidth, mPieceHeight);
  
              arryIsPieceLocked[pos] = false;
              arryPieceEndPos[c][r] = pos;
              pos++;
          }
      }
  </code></pre>
  
  <p>I then use a helper method to apply a mask to each piece</p>
  
  <pre><code>private Bitmap maskMethod(Bitmap bmpOriginal, Bitmap bmpMask) {
  
      // adjust mask bitmap if size is not the size of the puzzle piece
      if (bmpMask.getHeight() != mPieceHeight ||
          bmpMask.getWidth() != mPieceWidth) {
          Log.e("TEST", "Resize Error :: H (mask): " + bmpMask.getHeight() + " // W (mask): " +
              bmpMask.getWidth());
          Log.d("TEST", "Resize Error :: H (norm): " + mPieceHeight + " // W (norm): " +
              mPieceWidth);
  
      }
  
      Canvas canvas = new Canvas();
      Bitmap combine = Bitmap.createBitmap(bmpOriginal.getWidth(), bmpOriginal.getHeight(), Bitmap.Config.ARGB_8888);
      canvas.setBitmap(combine);
      Paint paint = new Paint();
      paint.setFilterBitmap(false);
  
      canvas.drawBitmap(bmpOriginal, 0, 0, paint);
      paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
      canvas.drawBitmap(bmpMask, 0, 0, paint);
      paint.setXfermode(null);
  
      return combine;
  }
  </code></pre>
  
  <p>I saw this post > <a href="http://java.dzone.com/news/connect-pictures-android" rel="noreferrer">http://java.dzone.com/news/connect-pictures-android</a> for connecting pieces together, however, this does not go over generating pieces programmatically without masks. Can anyone provide code examples of how this can be accomplished? The only clue I have is that I should be using Path, however, I am still not sure how. Thanks in advance!</p>