Graphics & Animation Radan Ganchev Astea Solutions.

Slides:



Advertisements
Similar presentations
Android architecture overview
Advertisements

Android Platform Overview (1)
ARIS The Augmented Rea l ity Studio. Outline  Background  Problem definition  Proposed solution  System design  Functionalities  Comparison with.
Charis Marangos. Games versus Most Applications  Technical implementation is hard Real-time and responsive (at least 25 frames per second) Hungry for.
CS378 - Mobile Computing 2D Graphics A Crash Course in Using (Android) 2D Graphics Libraries.
CS378 - Mobile Computing 3D Graphics.
Graphics & Animation in Android. Android rendering options The Canvas API Renderscript OpenGL wrappers NDK OpenGL
INTRODUCTION. Painting with numbers! Aspects Modeling Rendering Animation.
Fast rendering of 2D applications with text and images Combines the power of DirectX and the convenience of.NET Adopted by most triple-A titles.
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Mobile Application Development
Android Tutorial Android Written in Java Utilizes Dalvik VM – Just in time (JIT) compilation since Android 2.2.
Gearbox Software PRODUCTION PIPELINE – JOBS TITLES – JOB DESCRIPTIONS.
2D Graphics: Part 1. Android Graphics Libraries 2D Graphics –custom 2D graphics library in packages android.graphics android.graphics.drawable android.graphics.drawable.shapes.
Basic Animation. Animation 4 options – Animated.gif – Frame by Frame animation – Tweened animation This is our focus – OpenGL ES Graphics API for more.
Custom Views, Drawing, Styles, Themes, ViewProperties, Animations, oh my!
Emerging Platform#4: Android Bina Ramamurthy.  Android is an Operating system.  Android is an emerging platform for mobile devices.  Initially developed.
Programming Concepts. Derive a new class from Activity of the framework Prepare the data beforehand, e.g., vertices, colours, normal vectors, texture.
Chapter 10: Move! Creating Animation
6-2 2D Graphics CSNB544 Mobile Application Development Thanks to Utexas Austin.
Faster 2D graphics on Windows 8 Your app will run faster on Windows 8.
Copyright© Jeffrey Jongko, Ateneo de Manila University Android.
HTML5 – The Power of HTML5 – The Power of Thomas Lewis HTML5 Principal Technical Evangelist Microsoft | asimplepixel.tumblr.com.
ANDROID 응용 프로그래밍 과정 – 목차 - 안드로이드란 - 안드로이드가 만들어지게 된배경 - 안드로이드의 철학 - 안드로이드 환경설정 ( SDK download, eclipse plug-in 설정, 간단한 프로그램 실행 ) - 안드로이드 동작원리 - 안드로이드 핵심.
به نام خدا تنظیم کننده : فرانه حدادی استاد : مهندس زمانیان تابستان 92.
Working in the Background Radan Ganchev Astea Solutions.
Android Graphics Library. Color Android colors are represented with four numbers, one each for alpha, red, green, and blue (ARGB). Each component can.
CS378 - Mobile Computing Responsiveness. An App Idea From Nifty Assignments Draw a picture use randomness Pick an equation at random Operators in the.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
Java Dynamic Graphics.
CS378 - Mobile Computing 3D Graphics.
Basic Animation. Animation 4 options – Animated.gif – Frame by Frame animation – Tweened animation This is our focus – OpenGL ES Graphics API for more.
© 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.
CompSci 44.1 Game Package Introduction to Jam’s Video Game Package.
Mobile Computing Lecture#12 Graphics & Animation.
Basic 2D Graphics in Android. Android Graphics Programming There are many ways to do graphics programming in Android – 2D vs. 3D – static vs. dynamic.
Mobile & Casual Gaming OpenGL ES Intro. /red/chapter03.html.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 10: Move! Creating Animation 1 Android.
Resources & Android Manifest Калин Кадиев Astea Solutions AD.
Introduction to Android OS Димитър Н. Димитров Astea Solutions AD.
By: Eliav Menachi.  Android custom 2D graphics library  OpenGL ES 1.0 for high performance 3D graphics.
Graphics in Java Opening Discussion zDo you have any questions about the quiz? zWhat did we talk about last class? zDo you have any questions.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
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.
Efficient Game Graphics From Flash MX 2004 Game Design Demystified.
CS371m - Mobile Computing 2D Graphics A Crash Course in Using (Android) 2D Graphics Libraries.
Lecture 3: Animation & Graphics Topics: Animation, Graphics, Drawing Date: Feb 2, 2016.
Android.
Creating Visual Effects
Android Application 2D Graphics cs.
Lecture 3: Animation & Graphics
Graphics & Animation in Android
CS499 – Mobile Application Development
Lecture 3: Animation & Graphics
Instructor: Mazhar Hussain
Lecture 8: Graphics By: Eliav Menachi.
Android Layouts 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS 1.
Mobile Computing With Android ACST 4550 Android Animation
2D Graphics A Crash Course in Using (Android) 2D Graphics Libraries
INTRODUCTION TO ADOBE FLASH CS4
Graphics with Canvas.
Cannon Game App Android How to Program
One of a new Eclipse Photon feature
CS371m - Mobile Computing Responsiveness.
Animate Some more advanced concepts
Lecture 3: Animation & Graphics
Emerging Platform#3 Android & Programming an App
Lecture 8: Graphics By: Eliav Menachi.
Model, View, Controller design pattern
Presentation transcript:

Graphics & Animation Radan Ganchev Astea Solutions

Contents Basic 2D Graphics & Animation Animation Frameworks ‣ View animation ‣ Property animation 3D Graphics ‣ OpenGL ‣ RenderScript

2D Graphics

Bitmap - your drawing surface Bitmap

2D Graphics Bitmap - your drawing surface Canvas - your drawing tool Bitmap Canvas

2D Graphics Bitmap - your drawing surface Canvas - your drawing tool drawLine() Bitmap Canvas

2D Graphics Bitmap - your drawing surface Canvas - your drawing tool Drawable - something you can draw Bitmap Canvas Drawable

2D Graphics Bitmap - your drawing surface Canvas - your drawing tool Drawable - something you can draw draw() Bitmap Canvas Drawable

2D Graphics Bitmap - your drawing surface Canvas - your drawing tool Drawable - something you can draw Paint - the colors and styles for the drawing Bitmap Canvas Drawable

But how do we draw on the screen?

Same as always: use a View

Drawing on a View 1. Extend View. 2. Override onDraw(Canvas) and use the given Canvas to draw. 3. invalidate() the view when necessary (watch your thread).

Drawing on a SurfaceView A bit more technical... Basic idea: ‣ SurfaceView controls a dedicated drawing surface ‣ Extend SurfaceView and use the view’s SurfaceHolder to get a reference to the canvas ‣ Lock the canvas from a background thread; draw on it; unlock and post.

When to use which? Use a custom View when: ‣ You need to draw and update custom shapes. ‣ It is not hard to replace several smaller views with one larger view. Use SurfaceView when: ‣ You need high FPS rate. ‣ You are drawing complex objects. Remember that you can always use a regular View and manipulate its background image!

Drawables

When do we use drawables? ‣ When we have complex shapes or images to draw. ‣ When we need to draw something multiple times (reuse drawing code). ‣ When we need the functionality of one of the standard types of Drawables. ‣ When we want to implement custom functionality.

Drawables How do we use drawables? ‣ As a custom class - extend Drawable and override draw(). ‣ As a resource: ➡ Add a.png,.jpg or.gif to res/drawable/ and use it as a BitmapDrawable resource. ➡ Add a.9.png to res/drawable/ and use it as a NinePatchDrawable resource. ➡ Add a.xml to res/drawable/ and use it as the type of Drawable corresponding to its root tag.

View Animations

Translate, rotate, scale and alpha animation of Views. Affect the drawing of the View, its coordinates don’t change! Can be declared as XML resources or created programmatically. Components of an animation: ‣ Basic animations ‣ Animation sets ‣ Time interpolators

View Animations res/anim/black_hole.xml: MyActivity.java: Animation blackHole = AnimationUtils.loadAnimation(this, R.anim. black_hole ); view.startAnimation(blackHole);

Property Animations

Since Android 3.0 (API level 11). “Animate” values or properties of objects. Advantages to view animations: ‣ Actually change the property values ‣ You can animate anything (not only Views) ‣ More powerful animation sets

Property Animations ObjectAnimator anim = ObjectAnimator.ofFloat(myObj, "myProp", 0f, 1f); anim.setDuration(1000); anim.start(); ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f); animator.setDuration(1000); animator.addListener(myAnimatorUpdateListener); animator.start();

3D Graphics

OpenGL Android 1.0 supports OpenGL ES 1.0 and 1.1 ‣ Implemented in GLES10 and GLES11. ‣ javax.microedition.khronos.opengles - the standard Java ME implementation. ‣ android.opengl - the Android implementation. Optimized and faster. Android 2.2 (API level 8) supports OpenGL ES 2.0 ‣ android.opengl.GLES20

OpenGL How to use it: 1. Implement a GLSurfaceView.Renderer. 2. In onDrawFrame() use the provided GL object to draw. 3. Create a GLSurfaceView and give it an instance of your renderer.

RenderScript A high performance 3D graphics rendering and compute API at the native level. Scripts are written in C (C99 standard). Designed to run on different CPU and GPU architectures. Fast as OpenGL with NDK and as portable as the android.opengl framework. Offers less features than OpenGL.

Q & A Questions? Feedback section: ‣ Did you hear well? ‣ Was there anything you didn’t understand? ‣ What would you like changed in our next lecture?

Resources 2D Graphics Drawable Resources View Animation Property Animation OpenGL RenderScript