SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

Approaching zero driver overhead
Approaching zero driver overheadApproaching zero driver overhead
Approaching zero driver overhead
Cass Everitt
 

Mais procurados (20)

Understaing Android EGL
Understaing Android EGLUnderstaing Android EGL
Understaing Android EGL
 
Design and Concepts of Android Graphics
Design and Concepts of Android GraphicsDesign and Concepts of Android Graphics
Design and Concepts of Android Graphics
 
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)
 
FrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteFrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in Frostbite
 
Triangle Visibility buffer
Triangle Visibility bufferTriangle Visibility buffer
Triangle Visibility buffer
 
Khronos Munich 2018 - Halcyon and Vulkan
Khronos Munich 2018 - Halcyon and VulkanKhronos Munich 2018 - Halcyon and Vulkan
Khronos Munich 2018 - Halcyon and Vulkan
 
Siggraph 2016 - Vulkan and nvidia : the essentials
Siggraph 2016 - Vulkan and nvidia : the essentialsSiggraph 2016 - Vulkan and nvidia : the essentials
Siggraph 2016 - Vulkan and nvidia : the essentials
 
Five Rendering Ideas from Battlefield 3 & Need For Speed: The Run
Five Rendering Ideas from Battlefield 3 & Need For Speed: The RunFive Rendering Ideas from Battlefield 3 & Need For Speed: The Run
Five Rendering Ideas from Battlefield 3 & Need For Speed: The Run
 
Siggraph 2011: Occlusion culling in Alan Wake
Siggraph 2011: Occlusion culling in Alan WakeSiggraph 2011: Occlusion culling in Alan Wake
Siggraph 2011: Occlusion culling in Alan Wake
 
Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016
 
Applied Computer Science Concepts in Android
Applied Computer Science Concepts in AndroidApplied Computer Science Concepts in Android
Applied Computer Science Concepts in Android
 
CS 354 Vector Graphics & Path Rendering
CS 354 Vector Graphics & Path RenderingCS 354 Vector Graphics & Path Rendering
CS 354 Vector Graphics & Path Rendering
 
Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
 
Approaching zero driver overhead
Approaching zero driver overheadApproaching zero driver overhead
Approaching zero driver overhead
 
Hable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr LightingHable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr Lighting
 
Deferred rendering in Dying Light
Deferred rendering in Dying LightDeferred rendering in Dying Light
Deferred rendering in Dying Light
 
Stable SSAO in Battlefield 3 with Selective Temporal Filtering
Stable SSAO in Battlefield 3 with Selective Temporal FilteringStable SSAO in Battlefield 3 with Selective Temporal Filtering
Stable SSAO in Battlefield 3 with Selective Temporal Filtering
 
Android 10
Android 10Android 10
Android 10
 

Destaque

Animation production schedule
Animation production scheduleAnimation production schedule
Animation production schedule
willsharp9795
 

Destaque (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
 

Semelhante a Introduction to Skia by Ryan Chou @20141008

Minko stage3d 20130222
Minko stage3d 20130222Minko stage3d 20130222
Minko stage3d 20130222
Minko3D
 
Shape12 6
Shape12 6Shape12 6
Shape12 6
pslulli
 
Ha4 displaying 3 d polygon animations
Ha4   displaying 3 d polygon animationsHa4   displaying 3 d polygon animations
Ha4 displaying 3 d polygon animations
JordanSmith96
 
ED CONNOR RESUME 2013
ED CONNOR RESUME 2013ED CONNOR RESUME 2013
ED CONNOR RESUME 2013
Edward Connor
 
android_project
android_projectandroid_project
android_project
Adit Ghosh
 
Android Chromium Rendering Pipeline
Android Chromium Rendering PipelineAndroid Chromium Rendering Pipeline
Android Chromium Rendering Pipeline
Hyungwook Lee
 
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
Farhad
 
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
Farhad
 
A Tutorial On Ip 2
A Tutorial On Ip 2A Tutorial On Ip 2
A Tutorial On Ip 2
ankuredkie
 
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
Droidcon Berlin
 

Semelhante a 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
 
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
 
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
 

Último

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Último (20)

WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 

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

Notas do Editor

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