Android Canvas Demonstrations
A familiarity with graphics covered in other sections of the website will be useful. You can refer back to applets and Graphics2D in particular to see what functionality to expect in Android graphics. Canvas Demonstration 1 illustrates transformations and the use of a path. We found out the hard way that we should not use the moveTo method except at the start of a path. The first demonstration illustrates the use of the Canvas methods drawCircle, drawOval, drawRect, drawRoundRect and drawLine, the Paint methods setColor, setStyle and setPathEffect and the Path methods moveTo, lineTo and quadTo.
Most of the code to display the Mandelbrot set in Canvas Demonstrations 2a and 2b is taken from our applets. Both programs use the setAlpha and drawPoint methods.
In the following section on game development, Android Game Framework shows the use of a thread for motion graphics in a way that should suffice for basic games. The motion of an image across the screen is controlled both by code in a thread and by handling events created by button presses. The program introduces the Canvas methods drawBitmap and drawText.
Emulators
- Target: Android 4.2.2
- API Level: 17
- CPU/ABI: ARM(armeabi-v7a)
- Screen: 4.0" 480 x 800, Normal hdpi
- RAM: 343 MiB
- Density: High(240)