Drawing a Bitmap onto a Bitmap

Before we get into the specific mechanisms used to alter the images, let's look at how we can create a new, empty Bitmap object and draw an existing Bitmap into that. This is the process that we will be using to create altered versions of our images.

In the foregoing example, we have a Bitmap object instantiated with an image that has been selected by the user. It has been instantiated by a call to BitmapFactory's decodeStream method, as we learned how to do in Chapter 1.

Bitmap bmp = BitmapFactory.decodeStream(getContentResolver().Image openInputStream(imageFileUri), null, bmpFactoryOptions);

In order to use this

Get Pro Android Media: Developing Graphics, Music, Video, and Rich Media Apps for Smartphones and Tablets now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.