title: How to drawing a path with a bitmap?
body: <p>I have a little drawing app and want to use "complex" shapes as brushes, i.e. a star.
  Drawing with a simple brush already works with this code:</p>
  
  <pre><code>remotePath.reset();
  remotePath.moveTo(start_x, start_y);
  
  float dx = Math.abs(end_x - start_x);
  float dy = Math.abs(end_y - start_y);
  if (dx &gt;= TOUCH_TOLERANCE || dy &gt;= TOUCH_TOLERANCE) {
          remotePath.quadTo(start_x, start_y, (end_x + start_x) / 2, (end_y + start_y) / 2);
  }
  
  remotePath.lineTo(end_x, end_y);
  // commit the path to our offscreen
  mCanvas.drawPath(remotePath, remotePaint);
  // kill this so we don't double draw
  remotePath.reset();
  invalidate();
  </code></pre>
  
  <p>I basically want the same functionality using this bitmap:</p>
  
  <pre><code>Bitmap myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.brush_star);
  </code></pre>
  
  <p>My solution currently is using a list of points (coordinates) to draw the bitmap. The problem with that solution is that it only draws bitmaps at the given points resulting in having gaps between each drawn bitmap. I rather would like to get a smooth line while drawing like with a simple brush without any gaps in between.</p>
  
  <p>Current code for the bitmap drawing:</p>
  
  <pre><code>        protected void onDraw(Canvas canvas) {
  
          // Make canvas white
          canvas.drawColor(Color.WHITE);
  
          // Paintable area
          canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
  
          canvas.drawPath(mPath, mPaint);
  
          for (Point point : points) {
              canvas.drawBitmap(complexBrush, point.x, point.y, p);
          }
      }
  </code></pre>
  
  <p>What's the best way to do so?
  Thanks for any help!</p>