Professional Documents
Culture Documents
AndroidVG
slow!
Project history
Website:
http://code.google.com/p/androidvg/
Vector Graphics
Resized
3
Image
What is OpenVG?
OpenVG is a royalty-free,
cross-platform API by
Khronos Group
Low-level hardware
acceleration interface for
vector graphics libraries
OpenVG 1.0:
-
multi-sampled anti-aliasing
Benefits of OpenVG
Low power consumption
Seamless Transition from software to hardware
Scalability
Accelerates existing formats
Games, screen-savers, mapping, user interfaces
Portable content
Royalty free
Target Applications
Portable mapping applications
E-book readers
SVG Viewers
Games
Scalable User Interfaces
Low-level graphics device interface
vgRotate(...)
Developer Friendly
vgRotate(...)
vgTransform(...)
vgScale(...)
VG_SCUBIC_TO
VG_HLINE_TO
VG_VLINE_TO
VG_SCCWARC_TO
Single Color
VG_QUAD_TO
VG_LCWARC_TO
Linear Gradient
10
VG_CUBIC_TO
VG_SCWARD_TO
Radial Gradient
VG_SQUAD_TO
VG_LCCWARC_TO
Paint generation
Transformation
Image interpolation
Rasterization
11
Android Graphics
Application
Java
View/Widget/Canvas
Skia
2D
3D
OpenGL ES
Surface
12
It is a software render
engine.
Accelerated by OpenGL ES
Tegra 2
Google Nexus S
HTC Desire HD
Motorola Xoom
13
Goal of AndroidVG
Current
Our Goal
Application
Application
Java
View/Widget/Canvas
Java
View/Widget/Canvas
OpenGL ES
Skia
Skia
OpenGL ES
AndroidVG
Hardware
Hardware
With hardware
Without hardware
Acceleration interface
2D render engine
libhvg.so
libvg.so
14
Current AndroidVG
Application
AndroidVG
AndroidVG
OpenGL ES
3D GPU
15
3D GPU Acceleration
T1
T5
T8
Path Generation
T7
T4
Triangulation by
CPU
T3
Screen
Display on
Screen !!
T2
T6
Send to
GPU
Draw by
GPU
T1
T5
T4
T7
16
T3
T2
T6
T8
Path Generation
Works on CPU
OpenGL ES on GPU
17
18
...
Almost straight line
Push & Return!
...
Triangulation Methods
Complexity
Hardware
Accelerated
Released Date
Ear-Clipping
O(n2)
No
Oct 2010
Monotone Polygon
O(n log(n))
No
Nov 2010
Stencil Buffer
O(n)
Yes
May 2011
19
Software Triangulation
Ear Clipping
Monotone Polygon
glEnable(GL_STENCIL_TEST);
glStencilOp(GL_INVERT, ...);
Initial
123
134
145
156
167
Final
22
JNI
Java_com_example_androidvg_VG11_vgScale(
!
JNIEnv* env, jobject obj,
!
jfloat sx, jfloat sy){
! ! ! vgScale(
! ! ! (VGfloat) sx,
! ! ! (VGfloat) sy
! ! ! );
! }
23
Android API
Native C
24
25