Presentation is loading. Please wait.

Presentation is loading. Please wait.

Graphics in Android 1 CS7030: Mobile App Development.

Similar presentations


Presentation on theme: "Graphics in Android 1 CS7030: Mobile App Development."— Presentation transcript:

1 Graphics in Android 1 CS7030: Mobile App Development

2 Canvas  Class android.graphics.Canvas represents a surface on which to drawandroid.graphics.Canvas  Some of the useful drawing methods 1. drawArc draws an arc of a circle. Can be used for 'pie segments' as well. drawArc 2. drawBitmap draws an image represented as a bitmap drawBitmap 3. drawCircle drawCircle 4. drawOval drawOval 5. drawRect drawRect 6. drawText drawText 7. drawColor fills the background of the canvas with a color drawColor 2 CS7030: Mobile App Development

3 Path 3  A Path can, for example, be used to build up a polygon.Path  A path is understood as being drawn by a pen. When the pen is touching the drawing surface, a visible trace is left. However, the pen can also be moved without leaving a visible mark.  At any stage during the construction of a path, there is a current point. This is the current position of the pen.  The lineTo moves the pen to a new point, drawing a straight line from the previous current point to the point given by the parameters to the method call. The end point of the line becomes the new current point.lineTo  By contrast, the moveTo method moves the pen, changing the current point, but does not leave a trace. The path should begin with a moveTo call so that the path can start at a well determined position.moveTo  The close adds a line segment from the current point back to the first point on the path. This signals that the path is closed and, therefore, can be filled with color.close CS7030: Mobile App Development

4 Paint 4  In Android, the android.graphics.Paint class is used to contain many details of how drawing should be done. Most drawing methods require a Paint object be provided as an argument.android.graphics.Paint  The color of the drawing is one property.  The style property is specified by a value of class Paint.Style. The three values specify whether the shape is to be outlined, filled or both filled and outlined.Paint.Style CS7030: Mobile App Development


Download ppt "Graphics in Android 1 CS7030: Mobile App Development."

Similar presentations


Ads by Google