Graphics in android
Download
1 / 4

Graphics in Android - PowerPoint PPT Presentation


  • 93 Views
  • Uploaded on

Graphics in Android. Canvas. Class android.graphics.Canvas represents a surface on which to draw Some of the useful drawing methods drawArc draws an arc of a circle. Can be used for 'pie segments' as well. drawBitmap draws an image represented as a bitmap drawCircle drawOval

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Graphics in Android' - hallie


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Graphics in android

Graphics in Android

Fall 2012 CS2302: Programming Principles


Canvas
Canvas

  • Class android.graphics.Canvas represents a surface on which to draw

  • Some of the useful drawing methods

    • drawArc draws an arc of a circle. Can be used for 'pie segments' as well.

    • drawBitmap draws an image represented as a bitmap

    • drawCircle

    • drawOval

    • drawRect

    • drawText

    • drawColor fills the background of the canvas with a color

Fall 2012 CS2302: Programming Principles


Path

  • A Pathcan, for example, be used to build up a polygon.

  • 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.

  • 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.

  • 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.

Fall 2012 CS2302: Programming Principles


Paint
Paint

  • In Android, the android.graphics.Paintclass is used to contain many details of how drawing should be done. Most drawing methods require a Paint object be provided as an argument.

  • 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.

Fall 2012 CS2302: Programming Principles


ad