SlideShare a Scribd company logo
Skia 
Date : 2014/10/8 
Author : Ryan Chou 
Copyright © 2014 Realtek Semiconductor Corp.
Outline 
 What is Skia 
 Skia in Android 
 Reference 
 Q & A
Outline 
 What is Skia 
 Skia in Android 
 Reference 
 Q & A
What is Skia 
 A 2D graphic engine for drawing Text, Geometries, and Images 
 A compact open source graphics library written in C++, and licensed 
under New BSD free software license 
 Developed by Skia Inc., which was acquired by Google in 2005 
 Used in Chrome browser, Chrome OS, Firefox browser, Firefox OS, 
and Android 
 Back-ends 
 CPU-based software rasterization, PDF output, GPU-accelerated 
OpenGL 
 Front-ends 
 SVG, PostScript, PDF, SWF and Adobe illustrator files 
 Its competitor is also well-known : Cairo 
 Open source library under GNU Lesser General Public License (LGPL) 
 Written in C 
 Skia is more compatible in mobile device
Outline 
 What is Skia 
 Skia in Android 
 Reference 
 Q & A
Skia in Android 
 The source is located in external/skia, which major serves as 
 Image decoder and encoder 
 2D graphic render
File system 
 src/animator: implement animation effect 
 src/core : implement core of Skia, which is graphic rendering 
 src/gl : implement graphic library. The engine is OpenGL or OpenGL 
ES. 
 src/images : implement image related part and support decoding 
and encoding of images of some common image format (bmp, gif, 
png, jpg…) 
 src/ports : defines the porting layer, including Font, Event, File, 
Thread, Time, XMLParser 
 src/svg : support of SVG 
 src/utils : assistant tools 
 src/views : UI (Not adopted in Android) 
 src/xml : implement XML DOM and Parser
Architecture of Image Decoder 
APP (MediaBrowser/RealtekGallery2) 
Framework (BitmapFactory) 
Skia 
DecodReg 
jpeg png gif webp bmp 
libjpeg libpng libgif 
JNI
Architecture of Image Encoder 
JNI 
APP 
Framework (Bitmap::Compress) 
Skia 
EncodeReg 
jpeg png gif webp bmp 
libjpeg libpng libgif
Skia Drawing Primitive API 
Overview 
 Drawing basic primitives include rectangles, rounded rectangles, ovals, 
circles, arcs, paths, lines, text, bitmaps, and sprites. Paths allow for the 
creation of more advanced shapes. Each path can be made up for multiple 
contours (or continuous sections), each consisting of linear, quadratic, and 
cubic segments. 
 A Canvas encapsulates all of the state about drawing into a device (bitmap). 
 A reference to the device 
 A stack of matrix/clip values 
 While the Canvas holds the state of the drawing device, the state (style) of 
the object being drawn is held by the Paint, which is provided as a 
parameter to each of the draw() methods. The Paint holds attributes such as 
color, typeface, textSize, strokeWidth, shader (e.g. gradients, patterns), etc
Example: Skia API
Skia Rendering Pipeline 
Source: 
http://www.xenomachina.com/2011/05/androids-2d-canvas-rendering-pipeline.html
Skia back-end 
 Render in software 
1) Create a native window and then 
2) Wrap a pointer to its buffer as an SkBitmap 
3) Initialize an SkCanvas with the bitmap 
 Render in hardware acceleration 
1) Create a GLES2 window or framebufffer 
2) Create the appropriate GrContext, SkGpuDevice and SkGpuCanvas
How Views are Drawn in 
Android pre 3.0 
Source: http://developer.android.com/guide/topics/ui/how-android-draws.html
Why New Drawing Model in 
Android post-3.0?
Hardware-accelerated 2D 
Rendering 
 Since Android 3.x, more complex than before 
 Major idea : transform the implementation of 2D Graphics APIs into 
OpenGL ES requests 
 Textures, Shader, GLContext, pipeline, … 
 Major parts for hardware-accelerated 2D Rendering 
 Primitive Drawing: Shape, Text, Image 
 Layer/Surface Compositing
Control hardware accelerations 
 Application level 
 <application android:hardwareAccelerated=“true”> 
 Default value 
 False in Android 3.x; True in Android 4.x 
 Activity 
 <activity android:hardwareAccelerated=“true”> 
 Window 
 getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDW 
ARE_ACCELERATED,WindowManager.LayoutParams.FLAG_HARDW 
ARE_ACCELERATED) 
 CANNOT disable hardware acceleration at the window level 
 View 
 setLayerType(View.LAYER_TYPE_SOFTWARE, null) 
 CANNOT disable hardware acceleration at the view level
How Views are Drawn (Since 
3.0)
Display List 
 A display list is a series of graphics commands that define an output 
image. The image is created (rendered) by executing the command. 
 A display list can represent both two-and three-dimensional scenes. 
Systems that make use of a display list to store the scene are called 
retained mode systems as opposed to immediate mode systems. 
(From Wikipedia) 
http://en.wikipedia.org/wiki/Display_list 
http://developer.android.com/guide/topics/graphics/hardware-accel.html
Display List in Android (Since 
3.0) 
 A display list records a series of graphics related operation and can replay them later. 
Display lists usually built by recording operations on a android.graphics.Canvas. 
Replaying the operations from a display list avoids executing views drawing code on 
every frame, and is thus much more efficient.
How Views are Drawn (Since 
3.0)
Display List Properties (Since 
4.1)
Android 2D Graphics 
Architecture
Android 2D Graphics Libraries
Outline 
 What is Skia 
 Skia in Android 
 Reference 
 Q & A
Reference 
 Bezier Curve, http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Quadratic_B.C3.A9zier_curves 
 Android Skia和2D圖形系統, ailyanlu, Mar. 16, 2012, 
http://wenku.baidu.com/view/3a915fe94afe04a1b071dee6.html 
 Android圖片編碼解碼實現方案(skia), Arrow, Jan 25, 2013, 
http://blog.csdn.net/myarrow/article/details/8540990 
 Android 3.0 Hardware Acceleration, Romain Guy, Mar. 2011, 
http://android-developers.blogspot.kr/2011/03/android-30-hardware-acceleration.html 
 Android 4.0 Graphics and Animations, Romain Guy, Nov. 2011, 
http://android-developers.blogspot.kr/2011/11/android-40-graphics-and-animations.html 
 iOS vs. Android ICS : Hardware Accelerated Graphics Pipelines, Nathan De Vries, Nov. 2011, 
http://atnan.com/blog/2011/11/10/ios-vs-android-ics-hardware-accelerated-graphics-pipelines 
 Learning about Android Graphics Subsystem, MIPS Developer Team, Apr. 2012, 
http://blog.imgtec.com/news/learning-about-the-android-graphics-subsystem 
 Hardware Accelerated 2D Rendering for Android, Jim Huang, Feb 19, 2013, 
http://www.slideshare.net/jserv/accel2drendering?related=1 
 Skia & FreeType Android 2D Graphics Essentials, Kyungmin Lee, 2012, 
http://www.slideshare.net/snailee/skia-freetype-android-2d-graphics-essentials?related=2 
 Hardware Acceleration, http://developer.android.com/guide/topics/graphics/hardware-accel.html 
 Android Skia圖形渲染, http://www.3g-edu.org/news/art045.htm 
 Android SKia 渲染概述, http://www.3g-edu.org/news/art044.htm
Q & A

More Related Content

What's hot

GraalVM Native and Spring Boot 3.0
GraalVM Native and Spring Boot 3.0GraalVM Native and Spring Boot 3.0
GraalVM Native and Spring Boot 3.0MoritzHalbritter
 
Overview of Android binder IPC implementation
Overview of Android binder IPC implementationOverview of Android binder IPC implementation
Overview of Android binder IPC implementationChethan Pchethan
 
Understaing Android EGL
Understaing Android EGLUnderstaing Android EGL
Understaing Android EGLSuhan Lee
 
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...ijafrc
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UIOpersys inc.
 
Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)Egor Elizarov
 
Approaching zero driver overhead
Approaching zero driver overheadApproaching zero driver overhead
Approaching zero driver overheadCass Everitt
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in AndroidOpersys inc.
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)Nanik Tolaram
 
Android Automotive
Android AutomotiveAndroid Automotive
Android AutomotiveOpersys inc.
 
NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017Mark Kilgard
 
Android Chromium Rendering Pipeline
Android Chromium Rendering PipelineAndroid Chromium Rendering Pipeline
Android Chromium Rendering PipelineHyungwook Lee
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessNanik Tolaram
 
Android internals By Rajesh Khetan
Android internals By Rajesh KhetanAndroid internals By Rajesh Khetan
Android internals By Rajesh KhetanRajesh Khetan
 
Gnome on wayland at a glance
Gnome on wayland at a glanceGnome on wayland at a glance
Gnome on wayland at a glancegnomekr
 
NVidia CUDA Tutorial - June 15, 2009
NVidia CUDA Tutorial - June 15, 2009NVidia CUDA Tutorial - June 15, 2009
NVidia CUDA Tutorial - June 15, 2009Randall Hand
 

What's hot (20)

GraalVM Native and Spring Boot 3.0
GraalVM Native and Spring Boot 3.0GraalVM Native and Spring Boot 3.0
GraalVM Native and Spring Boot 3.0
 
Overview of Android binder IPC implementation
Overview of Android binder IPC implementationOverview of Android binder IPC implementation
Overview of Android binder IPC implementation
 
Understaing Android EGL
Understaing Android EGLUnderstaing Android EGL
Understaing Android EGL
 
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UI
 
Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)Android internals 07 - Android graphics (rev_1.1)
Android internals 07 - Android graphics (rev_1.1)
 
Approaching zero driver overhead
Approaching zero driver overheadApproaching zero driver overhead
Approaching zero driver overhead
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in Android
 
Low Level View of Android System Architecture
Low Level View of Android System ArchitectureLow Level View of Android System Architecture
Low Level View of Android System Architecture
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Android Automotive
Android AutomotiveAndroid Automotive
Android Automotive
 
NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017NVIDIA OpenGL 4.6 in 2017
NVIDIA OpenGL 4.6 in 2017
 
Android Chromium Rendering Pipeline
Android Chromium Rendering PipelineAndroid Chromium Rendering Pipeline
Android Chromium Rendering Pipeline
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Binder: Android IPC
Binder: Android IPCBinder: Android IPC
Binder: Android IPC
 
Android internals By Rajesh Khetan
Android internals By Rajesh KhetanAndroid internals By Rajesh Khetan
Android internals By Rajesh Khetan
 
Gnome on wayland at a glance
Gnome on wayland at a glanceGnome on wayland at a glance
Gnome on wayland at a glance
 
NVidia CUDA Tutorial - June 15, 2009
NVidia CUDA Tutorial - June 15, 2009NVidia CUDA Tutorial - June 15, 2009
NVidia CUDA Tutorial - June 15, 2009
 
Android IPC Mechanism
Android IPC MechanismAndroid IPC Mechanism
Android IPC Mechanism
 

Viewers also liked

A Detailed Look at Cairo's OpenGL Spans Compositor Performance
A Detailed Look at Cairo's OpenGL Spans Compositor PerformanceA Detailed Look at Cairo's OpenGL Spans Compositor Performance
A Detailed Look at Cairo's OpenGL Spans Compositor PerformanceSamsung Open Source Group
 
Why your Android Apps Suck
Why your Android Apps SuckWhy your Android Apps Suck
Why your Android Apps Suckrogeryi
 
Animation production schedule
Animation production scheduleAnimation production schedule
Animation production schedulewillsharp9795
 
[1D6]RE-view of Android L developer PRE-view
[1D6]RE-view of Android L developer PRE-view[1D6]RE-view of Android L developer PRE-view
[1D6]RE-view of Android L developer PRE-viewNAVER D2
 
Precise Android Text Drawing
Precise Android Text DrawingPrecise Android Text Drawing
Precise Android Text DrawingRichard Creamer
 
LCE13: Android Graphics Upstreaming
LCE13: Android Graphics UpstreamingLCE13: Android Graphics Upstreaming
LCE13: Android Graphics UpstreamingLinaro
 
On Beyond OWL: challenges for ontologies on the Web
On Beyond OWL: challenges for ontologies on the WebOn Beyond OWL: challenges for ontologies on the Web
On Beyond OWL: challenges for ontologies on the WebJames Hendler
 
Mobile Browser Internal (Blink Rendering Engine)
Mobile Browser Internal (Blink Rendering Engine)Mobile Browser Internal (Blink Rendering Engine)
Mobile Browser Internal (Blink Rendering Engine)Hyungwook Lee
 

Viewers also liked (10)

Duel of Two Libraries: Cairo & Skia
Duel of Two Libraries: Cairo & SkiaDuel of Two Libraries: Cairo & Skia
Duel of Two Libraries: Cairo & Skia
 
A Detailed Look at Cairo's OpenGL Spans Compositor Performance
A Detailed Look at Cairo's OpenGL Spans Compositor PerformanceA Detailed Look at Cairo's OpenGL Spans Compositor Performance
A Detailed Look at Cairo's OpenGL Spans Compositor Performance
 
Why your Android Apps Suck
Why your Android Apps SuckWhy your Android Apps Suck
Why your Android Apps Suck
 
Animation production schedule
Animation production scheduleAnimation production schedule
Animation production schedule
 
[1D6]RE-view of Android L developer PRE-view
[1D6]RE-view of Android L developer PRE-view[1D6]RE-view of Android L developer PRE-view
[1D6]RE-view of Android L developer PRE-view
 
Precise Android Text Drawing
Precise Android Text DrawingPrecise Android Text Drawing
Precise Android Text Drawing
 
LCE13: Android Graphics Upstreaming
LCE13: Android Graphics UpstreamingLCE13: Android Graphics Upstreaming
LCE13: Android Graphics Upstreaming
 
On Beyond OWL: challenges for ontologies on the Web
On Beyond OWL: challenges for ontologies on the WebOn Beyond OWL: challenges for ontologies on the Web
On Beyond OWL: challenges for ontologies on the Web
 
Mobile Browser Internal (Blink Rendering Engine)
Mobile Browser Internal (Blink Rendering Engine)Mobile Browser Internal (Blink Rendering Engine)
Mobile Browser Internal (Blink Rendering Engine)
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 

Similar to Introduction to Skia by Ryan Chou @20141008

Remote Graphical Rendering
Remote Graphical RenderingRemote Graphical Rendering
Remote Graphical RenderingJoel Isaacson
 
Minko stage3d 20130222
Minko stage3d 20130222Minko stage3d 20130222
Minko stage3d 20130222Minko3D
 
Shape12 6
Shape12 6Shape12 6
Shape12 6pslulli
 
Ha4 displaying 3 d polygon animations
Ha4   displaying 3 d polygon animationsHa4   displaying 3 d polygon animations
Ha4 displaying 3 d polygon animationsJordanSmith96
 
ED CONNOR RESUME 2013
ED CONNOR RESUME 2013ED CONNOR RESUME 2013
ED CONNOR RESUME 2013Edward Connor
 
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdfJIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdfSamiraKids
 
lecture-2-android-dev.pdf
lecture-2-android-dev.pdflecture-2-android-dev.pdf
lecture-2-android-dev.pdfjakjak36
 
FrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteFrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteElectronic Arts / DICE
 
android_project
android_projectandroid_project
android_projectAdit Ghosh
 
Kisters 3DViewStation - CAD viewer for PLM and stand alone
Kisters 3DViewStation - CAD viewer for PLM and stand aloneKisters 3DViewStation - CAD viewer for PLM and stand alone
Kisters 3DViewStation - CAD viewer for PLM and stand aloneGermar Nikol
 
Alternatives to Java for Android development
Alternatives to Java for Android developmentAlternatives to Java for Android development
Alternatives to Java for Android developmentttogrul
 
Digital Fabrication Studio.03 _Software @ Aalto Media Factory
Digital Fabrication Studio.03 _Software @ Aalto Media FactoryDigital Fabrication Studio.03 _Software @ Aalto Media Factory
Digital Fabrication Studio.03 _Software @ Aalto Media FactoryMassimo Menichinelli
 
Alternatives to Java for Android development
Alternatives to Java for Android developmentAlternatives to Java for Android development
Alternatives to Java for Android developmentttogrul
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaFarhad
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaFarhad
 
A Tutorial On Ip 2
A Tutorial On Ip 2A Tutorial On Ip 2
A Tutorial On Ip 2ankuredkie
 
Droidcon 2013 automotive quality dunca_czol_garmin
Droidcon 2013 automotive quality dunca_czol_garminDroidcon 2013 automotive quality dunca_czol_garmin
Droidcon 2013 automotive quality dunca_czol_garminDroidcon Berlin
 

Similar to Introduction to Skia by Ryan Chou @20141008 (20)

Remote Graphical Rendering
Remote Graphical RenderingRemote Graphical Rendering
Remote Graphical Rendering
 
Minko stage3d 20130222
Minko stage3d 20130222Minko stage3d 20130222
Minko stage3d 20130222
 
Shape12 6
Shape12 6Shape12 6
Shape12 6
 
Ha4 displaying 3 d polygon animations
Ha4   displaying 3 d polygon animationsHa4   displaying 3 d polygon animations
Ha4 displaying 3 d polygon animations
 
ED CONNOR RESUME 2013
ED CONNOR RESUME 2013ED CONNOR RESUME 2013
ED CONNOR RESUME 2013
 
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdfJIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
 
lecture-2-android-dev.pdf
lecture-2-android-dev.pdflecture-2-android-dev.pdf
lecture-2-android-dev.pdf
 
FrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteFrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in Frostbite
 
Task 2
Task 2Task 2
Task 2
 
android_project
android_projectandroid_project
android_project
 
Kisters 3DViewStation - CAD viewer for PLM and stand alone
Kisters 3DViewStation - CAD viewer for PLM and stand aloneKisters 3DViewStation - CAD viewer for PLM and stand alone
Kisters 3DViewStation - CAD viewer for PLM and stand alone
 
Alternatives to Java for Android development
Alternatives to Java for Android developmentAlternatives to Java for Android development
Alternatives to Java for Android development
 
Digital Fabrication Studio.03 _Software @ Aalto Media Factory
Digital Fabrication Studio.03 _Software @ Aalto Media FactoryDigital Fabrication Studio.03 _Software @ Aalto Media Factory
Digital Fabrication Studio.03 _Software @ Aalto Media Factory
 
Alternatives to Java for Android development
Alternatives to Java for Android developmentAlternatives to Java for Android development
Alternatives to Java for Android development
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
 
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırmaToğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
Toğrul Tağıyev - Müxtəlif dillərdə Android proqramlaşdırma
 
A Tutorial On Ip 2
A Tutorial On Ip 2A Tutorial On Ip 2
A Tutorial On Ip 2
 
Kunal bhatia resume mass
Kunal bhatia   resume massKunal bhatia   resume mass
Kunal bhatia resume mass
 
Getting Started With Android
Getting Started With AndroidGetting Started With Android
Getting Started With Android
 
Droidcon 2013 automotive quality dunca_czol_garmin
Droidcon 2013 automotive quality dunca_czol_garminDroidcon 2013 automotive quality dunca_czol_garmin
Droidcon 2013 automotive quality dunca_czol_garmin
 

Recently uploaded

AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAlluxio, Inc.
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessWSO2
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandIES VE
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAlluxio, Inc.
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILNatan Silnitsky
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...Alluxio, Inc.
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisNeo4j
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAlluxio, Inc.
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfmbmh111980
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Krakówbim.edu.pl
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEJelle | Nordend
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockSkilrock Technologies
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1KnowledgeSeed
 

Recently uploaded (20)

AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by Skilrock
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 

Introduction to Skia by Ryan Chou @20141008

  • 1. Skia Date : 2014/10/8 Author : Ryan Chou Copyright © 2014 Realtek Semiconductor Corp.
  • 2. Outline  What is Skia  Skia in Android  Reference  Q & A
  • 3. Outline  What is Skia  Skia in Android  Reference  Q & A
  • 4. What is Skia  A 2D graphic engine for drawing Text, Geometries, and Images  A compact open source graphics library written in C++, and licensed under New BSD free software license  Developed by Skia Inc., which was acquired by Google in 2005  Used in Chrome browser, Chrome OS, Firefox browser, Firefox OS, and Android  Back-ends  CPU-based software rasterization, PDF output, GPU-accelerated OpenGL  Front-ends  SVG, PostScript, PDF, SWF and Adobe illustrator files  Its competitor is also well-known : Cairo  Open source library under GNU Lesser General Public License (LGPL)  Written in C  Skia is more compatible in mobile device
  • 5. Outline  What is Skia  Skia in Android  Reference  Q & A
  • 6. Skia in Android  The source is located in external/skia, which major serves as  Image decoder and encoder  2D graphic render
  • 7. File system  src/animator: implement animation effect  src/core : implement core of Skia, which is graphic rendering  src/gl : implement graphic library. The engine is OpenGL or OpenGL ES.  src/images : implement image related part and support decoding and encoding of images of some common image format (bmp, gif, png, jpg…)  src/ports : defines the porting layer, including Font, Event, File, Thread, Time, XMLParser  src/svg : support of SVG  src/utils : assistant tools  src/views : UI (Not adopted in Android)  src/xml : implement XML DOM and Parser
  • 8. Architecture of Image Decoder APP (MediaBrowser/RealtekGallery2) Framework (BitmapFactory) Skia DecodReg jpeg png gif webp bmp libjpeg libpng libgif JNI
  • 9. Architecture of Image Encoder JNI APP Framework (Bitmap::Compress) Skia EncodeReg jpeg png gif webp bmp libjpeg libpng libgif
  • 10. Skia Drawing Primitive API Overview  Drawing basic primitives include rectangles, rounded rectangles, ovals, circles, arcs, paths, lines, text, bitmaps, and sprites. Paths allow for the creation of more advanced shapes. Each path can be made up for multiple contours (or continuous sections), each consisting of linear, quadratic, and cubic segments.  A Canvas encapsulates all of the state about drawing into a device (bitmap).  A reference to the device  A stack of matrix/clip values  While the Canvas holds the state of the drawing device, the state (style) of the object being drawn is held by the Paint, which is provided as a parameter to each of the draw() methods. The Paint holds attributes such as color, typeface, textSize, strokeWidth, shader (e.g. gradients, patterns), etc
  • 12. Skia Rendering Pipeline Source: http://www.xenomachina.com/2011/05/androids-2d-canvas-rendering-pipeline.html
  • 13. Skia back-end  Render in software 1) Create a native window and then 2) Wrap a pointer to its buffer as an SkBitmap 3) Initialize an SkCanvas with the bitmap  Render in hardware acceleration 1) Create a GLES2 window or framebufffer 2) Create the appropriate GrContext, SkGpuDevice and SkGpuCanvas
  • 14. How Views are Drawn in Android pre 3.0 Source: http://developer.android.com/guide/topics/ui/how-android-draws.html
  • 15. Why New Drawing Model in Android post-3.0?
  • 16. Hardware-accelerated 2D Rendering  Since Android 3.x, more complex than before  Major idea : transform the implementation of 2D Graphics APIs into OpenGL ES requests  Textures, Shader, GLContext, pipeline, …  Major parts for hardware-accelerated 2D Rendering  Primitive Drawing: Shape, Text, Image  Layer/Surface Compositing
  • 17. Control hardware accelerations  Application level  <application android:hardwareAccelerated=“true”>  Default value  False in Android 3.x; True in Android 4.x  Activity  <activity android:hardwareAccelerated=“true”>  Window  getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDW ARE_ACCELERATED,WindowManager.LayoutParams.FLAG_HARDW ARE_ACCELERATED)  CANNOT disable hardware acceleration at the window level  View  setLayerType(View.LAYER_TYPE_SOFTWARE, null)  CANNOT disable hardware acceleration at the view level
  • 18. How Views are Drawn (Since 3.0)
  • 19. Display List  A display list is a series of graphics commands that define an output image. The image is created (rendered) by executing the command.  A display list can represent both two-and three-dimensional scenes. Systems that make use of a display list to store the scene are called retained mode systems as opposed to immediate mode systems. (From Wikipedia) http://en.wikipedia.org/wiki/Display_list http://developer.android.com/guide/topics/graphics/hardware-accel.html
  • 20. Display List in Android (Since 3.0)  A display list records a series of graphics related operation and can replay them later. Display lists usually built by recording operations on a android.graphics.Canvas. Replaying the operations from a display list avoids executing views drawing code on every frame, and is thus much more efficient.
  • 21. How Views are Drawn (Since 3.0)
  • 22. Display List Properties (Since 4.1)
  • 23. Android 2D Graphics Architecture
  • 24. Android 2D Graphics Libraries
  • 25. Outline  What is Skia  Skia in Android  Reference  Q & A
  • 26. Reference  Bezier Curve, http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Quadratic_B.C3.A9zier_curves  Android Skia和2D圖形系統, ailyanlu, Mar. 16, 2012, http://wenku.baidu.com/view/3a915fe94afe04a1b071dee6.html  Android圖片編碼解碼實現方案(skia), Arrow, Jan 25, 2013, http://blog.csdn.net/myarrow/article/details/8540990  Android 3.0 Hardware Acceleration, Romain Guy, Mar. 2011, http://android-developers.blogspot.kr/2011/03/android-30-hardware-acceleration.html  Android 4.0 Graphics and Animations, Romain Guy, Nov. 2011, http://android-developers.blogspot.kr/2011/11/android-40-graphics-and-animations.html  iOS vs. Android ICS : Hardware Accelerated Graphics Pipelines, Nathan De Vries, Nov. 2011, http://atnan.com/blog/2011/11/10/ios-vs-android-ics-hardware-accelerated-graphics-pipelines  Learning about Android Graphics Subsystem, MIPS Developer Team, Apr. 2012, http://blog.imgtec.com/news/learning-about-the-android-graphics-subsystem  Hardware Accelerated 2D Rendering for Android, Jim Huang, Feb 19, 2013, http://www.slideshare.net/jserv/accel2drendering?related=1  Skia & FreeType Android 2D Graphics Essentials, Kyungmin Lee, 2012, http://www.slideshare.net/snailee/skia-freetype-android-2d-graphics-essentials?related=2  Hardware Acceleration, http://developer.android.com/guide/topics/graphics/hardware-accel.html  Android Skia圖形渲染, http://www.3g-edu.org/news/art045.htm  Android SKia 渲染概述, http://www.3g-edu.org/news/art044.htm
  • 27. Q & A

Editor's Notes

  1. In actual Android AOSP: HardwareCanvas真正的實體是GLES20Canvas.java