CHAPTER 5 Graphics Drawing Audio. Chapter objectives: Learn to draw to a canvas Examine the process of adding drawn elements and UI controls to a layout.

Slides:



Advertisements
Similar presentations
Importing and Modifying Graphics
Advertisements

© 2010 Delmar, Cengage Learning Chapter 7: Importing and Modifying Graphics.
Adobe Flash CS4 – Illustrated Unit E: Optimizing and Publishing a Movie.
Chapter 6 Preparing and Publishing Applications. Chapter 6 Lessons 1.Publish movies 2.Reduce file size to optimize a movie 3.Create a preloader 4.Publish.
Macromedia Director 8 Intermediate Level Course. Ink Masks Using the Ink Mask feature will allow you to create parts of a bitmap cast member to become.
Creating Animations – Lesson 71 Creating Animations Lesson 7.
Chapter 6 Photoshop and ImageReady: Part II The Web Warrior Guide to Web Design Technologies.
Adobe Photoshop CS Design Professional FOR THE WEB CREATING IMAGES.
Chapter 17 Creating Images for the Web. Chapter Lessons Learn about Web features Optimize images for Web use Create a button for a Web page Create slices.
Foundation Level Course
Multimedia for the Web: Creating Digital Excitement Multimedia Element -- Graphics.
Macromedia Flash MX 2004 – Design Professional Macromedia Flash MX GETTING STARTED WITH.
Chapter 8 – Part I Interactive Multimedia Authoring with Flash: Animation “Computers and Creativity” Richard D. Webster, COSC 109 Instructor Office: 7800.
Android 4: Creating Contents Kirk Scott 1. Outline 4.1 Planning Contents 4.2 GIMP and Free Sound Recorder 4.3 Using FlashCardMaker to Create an XML File.
© 2010 Delmar, Cengage Learning Chapter 6: Preparing and Publishing Movies.
Graphics: Creating Images Chapter 8, Exploring the Digital Domain.
MULTIMEDIA TECHNOLOGY SMM 3001 MEDIA - GRAPHICS. In this chapter how the computer creates, stores, and displays graphic images how the computer creates,
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Chapter 11 Adding Media and Interactivity. Flash is a software program that allows you to create low-bandwidth, high-quality animations and interactive.
Basic Drawing Techniques
Chapter 10: Move! Creating Animation
Business and Computing Deanery Multimedia Week 6 Animation.
6-2 2D Graphics CSNB544 Mobile Application Development Thanks to Utexas Austin.
Tutorial 6 Working with Bitmaps and Gradients, and Publishing Flash Files.
Advanced Level Course. Site Extras Site Extras consist of four categories: Stationeries Site Trash Designs Components.
Tutorial 2 Drawing Text, Adding Shapes, and Creating Symbols.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 8 This presentation © 2004, MacAvon Media Productions Animation.
1-1 OBJ Copyright 2003, Paradigm Publishing Inc. Dr. Joseph Otto Silvia Castaneda Christopher deCastro CSULA Macromedia Flash MX Introduction.
CHAPTER FOUR COMPUTER SOFTWARE.
Chapter 10 Fireworks: Part II The Web Warrior Guide to Web Design Technologies.
Adobe Flash CS3 Revealed Chapter 1 - GETTING STARTED WITH FLASH.
CHAPTER TEN AUTHORING.
Tutorial 1 Introducing Adobe Flash CS3 Professional
Flash Adobe Flash Introduction Kyungeun Park. Bitmap vs. Vector based  Bitmap –Bitmaps are made up of single pixels  Vector based –Vector graphics are.
 The creation of moving pictures one frame at a time Literally 'to bring to life' e.g. make a sequence of drawings on paper, in which a character's position.
M404 Multimedia Elements Form 4.
Animation. History Photography around since the 19th century Realistic animation began in 1872 when Eadweard Muybridge settled a bet about a flying horse.
Adobe Flash CS3 Revealed
Flash Flash. It’s components and usage. New generation of web- design  Definition Multimedia technology developed by Macromedia to allow much interactivity.
Macromedia Studio 8 Step-by-Step MACROMEDIA FLASH 8 Introduction.
Motion Tweening – Lesson 81 Motion Tweening Lesson 8.
Introduction to Flash Animation CS 318. Topics Introduction to Flash and animation The Flash development environment Creating Flash animations  Layers.
Android Graphics Library. Color Android colors are represented with four numbers, one each for alpha, red, green, and blue (ARGB). Each component can.
Adobe Photoshop CS3 Revealed – Chapter 16 FOR THE WEB CREATING IMAGES.
Flash CS 5 Interface BY NSCHEWCZYK | ©2012. MENU BAR A bar at the top of the window. It lists menu options including: File, Edit, View, Insert, Modify,
“ Animation Through the Ages” Camelia McCallion. Main tasks What is computer animation? Hand drawn (cel) Flick books Animated cartoon Animation process.
Introduction to Interactive Media Interactive Media Tools: Authoring Applications.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
11 Writing Text Session 5.1. Session Overview  Show how fonts are managed in computers  Discover the difference between bitmap fonts and vector fonts.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Motion Graphics & Animation.
Building User Interfaces Basic Applications
Basic 2D Graphics in Android. Android Graphics Programming There are many ways to do graphics programming in Android – 2D vs. 3D – static vs. dynamic.
Animation in flash. Frame-by-Frame Animation An animation is made from a series of framed images displayed one after the other to create the motion. Flash.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 10: Move! Creating Animation 1 Android.
By: Eliav Menachi.  Android custom 2D graphics library  OpenGL ES 1.0 for high performance 3D graphics.
Adobe Flash Professional CS5 – Illustrated Unit E: Optimizing and Publishing a Movie.
CHAPTER 4 Fragments ActionBar Menus. Explore how to build applications that use an ActionBar and Fragments Understand the Fragment lifecycle Learn to.
Efficient Game Graphics From Flash MX 2004 Game Design Demystified.
Introducing Macromedia Flash 8
Android Application 2D Graphics cs.
Lecture 3: Animation & Graphics
Animation Part I: Interactive Multimedia Authoring with Flash
Lecture 3: Animation & Graphics
Lecture 8: Graphics By: Eliav Menachi.
Flash Interface, Commands and Functions
Lecture 3: Animation & Graphics
Lecture 8: Graphics By: Eliav Menachi.
Exercise 64 Use the Flash Movie Explorer to examine the contents of an application to quickly locate specific elements such as instances. Use the Movie.
Presentation transcript:

CHAPTER 5 Graphics Drawing Audio

Chapter objectives: Learn to draw to a canvas Examine the process of adding drawn elements and UI controls to a layout Understand how to programmatically add and manipulate ImageViews Build frame-by-frame animations Explore a turn-based game containing animation Understand the Android Animate library Explore the MediaPlayer for audio

5.1 Graphics in Android Two general techniques for adding graphics to an Android application are placing an existing image into an ImageView or drawing custom graphics in real-time ImageViews are populated with resources from drawables Images can also be read from a file on a device or downloaded from a URL

Parent views are responsible for editing the attributes of their child ImageViews, which can be done dynamically The ability to modify an ImageView dynamically means that a graphic object can adjust to a changing environment When the majority of an application’s interface is fixed, it is practical to render the interface in advance using ImageViews and inflate those images at runtime

5.2 Adding and Manipulating ImageViews Android supports three image file types: PNG, JPG, and GIF PNG is established as the preferred format for an image file in Android It is also acceptable to use a JPG GIF bitmaps should always be avoided. Bitmap files placed in res/drawable/ may be automatically optimized with lossless image compression during the build process Typically, an image resource is added to the res/drawable/ folder before it can be referenced in an XML layout file and from an Activity

A drawable resource is a general concept for a graphic that can be drawn to the screen In addition to bitmaps, Android supports XML graphics, which are drawable resources defined in XML

5.3 Drawing and the Canvas Class When an application requires specialized drawing, or the control of animated graphics, a Canvas can be used A Canvas provides an interface to the actual surface upon which graphics will be drawn The purpose of the canvas is to hold the results of the "draw" calls By using the Canvas, a drawing is actually performed on an underlying Bitmap, which is placed into the window

Drawing custom graphics can be performed in two ways Graphics can be drawn into a View object or they can be drawn directly to a Canvas Drawing to a View is a good choice when simple static graphics are needed Game applicationsneed dynamic visuals that require the application to regularly re- draw itself to a canvas

To draw something, four basic components are needed: A Bitmap to hold the pixels, A Canvas to host the draw calls (writing into the bitmap) A drawing primitive (e.g. Rect, Path, text, Bitmap) Paint (to describe the colors and styles for the drawing).

If an application does not require a significant amount of processing or frame-rate speed, such as a turn based game, then a custom View component can be created specifically for drawing Drawing with a Canvas on a view is performed with View.onDraw(). By using a View component, the Android framework will provide a pre-defined Canvas to hold the drawing calls. This requires an extension of the View class and a definition of the onDraw() callback method The onDraw() method will be called by the Android framework to request that the View draw itself Within this method, you can perform calls to draw through the Canvas.

The Android framework will only call onDraw() as necessary Each time your application is prepared to be redraw a canvas, you must request your View be invalidated by calling invalidate() invalidate() indicates that the entire view will be drawn again. Android will then call the onDraw() method

A ShapeDrawable is a good option when dynamically drawn graphics are needed for an application Primitive shapes, such as ovals, rectangles, and lines, and simple styles can be programmatically built easily CustomView is an extension of the View class that draws a primitive oval shape.

A ShapeDrawable is an extension of Drawable This is convenient because it can be used anywhere a Drawable is expected, such as the background of a View A drawable can also be built as its own custom View and then added to a layout.

5.4 Recursive Drawing One area that heavily relies on drawing is the generation of fractal terrain The terrain in an environment can be a crucial user interface element, particularly in a game application. Fractals are inherent to the development of terrain drawings, mainly due to the fact that fractal-based terrain is simple to implement and scales well Recursive drawing algorithms are often used to produce landscape fractal images.

The key concept behind any fractal is self-similarity An object is said to be self-similar when magnified subsets of the object are identical to the whole and to each other Landscape terrain falls into the "self- similar" category Recursively generating a tree, such as those found in Figure 5-12, still looks like a tree, regardless of the scale in which it is displayed

5.5 Frame-by-Frame and Film Loop Animations A film loop is an animated sequence that you can use like a single View object For example, to create an animation of a character dancing on the stage, a set of bitmaps is placed in the Drawable directory and the images are displayed on the screen within a View To create a film loop, the sequence of bitmaps that shows the character dancing is created as a View object that can be animated across the screen

Any Drawable subclass that supports the inflate() method can be used to create an animation An animated element can be defined in XML and instantiated in an application’s source code If a Drawable animation uses properties that will change during the runtime of the application, these values can be initialized once the object is instantiated

Animations in Android are Drawable animations They require a set of drawable items, such as res/drawable/open_close.xml. A frame-by-frame animation is prepared as a series of timeline frames to be displayed in an ordered sequence with a time delay Frame and film loop animations fall under the category of View animations because the ordered sequence of images will appear within an ImageView

Film loops and frame-by-frame animations are only suited to cases where you either have the frame images already created or are planning to implement them as drawables For more detailed control over animations, property, or tween animations are best

5.6 Animate Library The transitions framework allows the definition of scene animations These are typically view hierarchies that describe how to animate or custom transform a scene based on specific properties, such as layout bounds, or visibility There is also an abstraction for an animation that can be applied to Views, Surfaces, or other objects. To generate simple tweened animations, Android provides a packaged called android.view.animation

The following are a collection of classes that support basic animations: AlphaAnimation:Animates the changing transparency of an object RotateAnimation:Rotation animation of an object. ScaleAnimation:Animates the scaling of an object. TranslateAnimation:Moves an object

There are four standard animation attributes used when generating tweens. android:startOffset android:duration android:fillafter android:fillBefore:

5.7 Audio An audio file is characterized by its file format (audio container) and its data format (audio encoding) The data format of an audio file refers to the content and how it has been encoded WAV is a file format that can contain audio that is encoded in PCM PCM describes the technique used to convert analog sound data into a digital format

AAC stands for “Advanced Audio Coding”, and it was designed to be the successor of MP3. As you would guess, it compresses the original sound, resulting in disk savings but lower quality HE-AAC is a superset of AAC, where the HE stands for “high efficiency.” HE-AAC is optimized for low bit rate audio such as streaming audio

AMR stands for “Adaptive Multi-Rate” and is another encoding optimized for speech, featuring very low bit rates MP3 is still a very popular format after all of these years, and is supported by the iPhone. PCM This stands for linear pulse code modulation, and describes the technique used to convert analog sound data into a digital format.

FLAC stands for Free Lossless Audio Codec. This audio format is similar to MP3, but lossless, meaning that audio is compressed in FLAC without any loss in quality. FLAC is non-proprietary and has an open-source reference implementation

There are several ways to play audio in an Android application Android uses two API’s for this purpose: SoundPool and MediaPlayer SoundPool provides an easy way to play short audio files MediaPlayer provides the resources for handling media playback

There are several ways to play audio in an Android application Android uses two API’s for this purpose: SoundPool and MediaPlayer SoundPool provides an easy way to play short audio files MediaPlayer provides the resources for handling media playback