Task is this, we need to hang advertisement cards on the handrail of this train. But we have two types of advertisement cards say red and blue and the pattern should be like red blue red blue red, red blue red blue red.
intermediate = Bitmap.createScaledBitmap(source, dstWidth, dstHeight, filter);
target = Bitmap.createBitmap(intermidiate, x, y, width, height);
Option 2 would be:
Canvas canvas = new Canvas(target);
Matrix matrix = new Matrix();
canvas.drawBitmap(source, matrix, paint);
Sure, there are lot more examples, you can find yourself and enjoy.