SlideShare une entreprise Scribd logo
1  sur  27
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

Contenu connexe

Tendances

Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System ServerOpersys inc.
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveBin Chen
 
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
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 
Firefox OS Graphics inside
Firefox OS Graphics insideFirefox OS Graphics inside
Firefox OS Graphics insideSotaro Ikeda
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security InternalsOpersys inc.
 
Built for performance: the UIElements Renderer – Unite Copenhagen 2019
Built for performance: the UIElements Renderer – Unite Copenhagen 2019Built for performance: the UIElements Renderer – Unite Copenhagen 2019
Built for performance: the UIElements Renderer – Unite Copenhagen 2019Unity Technologies
 
Android's Multimedia Framework
Android's Multimedia FrameworkAndroid's Multimedia Framework
Android's Multimedia FrameworkOpersys inc.
 
Overview of Android binder IPC implementation
Overview of Android binder IPC implementationOverview of Android binder IPC implementation
Overview of Android binder IPC implementationChethan Pchethan
 

Tendances (20)

Design and Concepts of Android Graphics
Design and Concepts of Android GraphicsDesign and Concepts of Android Graphics
Design and Concepts of Android Graphics
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
 
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)
 
Duel of Two Libraries: Cairo & Skia
Duel of Two Libraries: Cairo & SkiaDuel of Two Libraries: Cairo & Skia
Duel of Two Libraries: Cairo & Skia
 
Android : Deep dive into developing MobileApp using Android
Android : Deep dive into developing MobileApp using AndroidAndroid : Deep dive into developing MobileApp using Android
Android : Deep dive into developing MobileApp using Android
 
Android IPC Mechanism
Android IPC MechanismAndroid IPC Mechanism
Android IPC Mechanism
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Firefox OS Graphics inside
Firefox OS Graphics insideFirefox OS Graphics inside
Firefox OS Graphics inside
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security Internals
 
Android 10
Android 10Android 10
Android 10
 
Built for performance: the UIElements Renderer – Unite Copenhagen 2019
Built for performance: the UIElements Renderer – Unite Copenhagen 2019Built for performance: the UIElements Renderer – Unite Copenhagen 2019
Built for performance: the UIElements Renderer – Unite Copenhagen 2019
 
Android's Multimedia Framework
Android's Multimedia FrameworkAndroid's Multimedia Framework
Android's Multimedia Framework
 
Binder: Android IPC
Binder: Android IPCBinder: Android IPC
Binder: Android IPC
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Overview of Android binder IPC implementation
Overview of Android binder IPC implementationOverview of Android binder IPC implementation
Overview of Android binder IPC implementation
 

En vedette

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
 

En vedette (9)

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
 

Similaire à Skia Graphics Library in Android

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
 
Android Chromium Rendering Pipeline
Android Chromium Rendering PipelineAndroid Chromium Rendering Pipeline
Android Chromium Rendering PipelineHyungwook Lee
 
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
 

Similaire à Skia Graphics Library in Android (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
 
Android Chromium Rendering Pipeline
Android Chromium Rendering PipelineAndroid Chromium Rendering Pipeline
Android Chromium Rendering Pipeline
 
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
 

Dernier

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 

Dernier (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 

Skia Graphics Library in Android

  • 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

Notes de l'éditeur

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