Android Tutorial

(avery) #1
Android Tutorial 269

Matrix mirrorAndTilt30 = new Matrix();
mirrorAndTilt30.preRotate(30);
mirrorAndTilt30.preScale(-1, 1);


You can see the results of different combinations of tilt and mirror
Matrix transforms in Figure. When you’re no longer using a Bitmap,
you can free its memory using the recycle() method:

pic.recycle();


A single-source bitmap: scaled, tilted, and mirrored using
Android Bitmap classes.

There are a variety of other Bitmap effects
and utilities available as part of the
Android SDK, but they are numerous and
beyond the scope of this book. See the
android.graphics package for more
details.

Working with Shapes

You can define and draw primitive shapes such as rectangles and
ovals using the ShapeDrawable class in conjunction with a variety
of specialized Shape classes. You can define Paintable drawables as
Free download pdf