Basic Image Scaling and Rotating

We'll start our exploration of image editing and processing with learning how we can perform spatial transformations such as changing scale and rotating images.

Enter the Matrix

The Android API has a Matrix class, which can be used when drawing on existing Bitmap objects or creating a Bitmap object from another Bitmap object. This class allows us to apply a spatial transformation to an image. A transformation of this type would be rotating, cropping, scaling, or otherwise altering the coordinate space of the image.

The Matrix class represents transformations with an array of nine numbers. In many cases, these can be generated by a formula that mathematically represents the transformation that should occur. For ...

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.