android 的skia 图形引擎库

 一、简介:

    skia 有大概 80,000 行代码,基于 C++ 开发,主要特点包括:

  • 高度优化的软体 ->Optimised software-based rasteriser (module sgl/);
  • 选择性透过OpenGL/ES ,加速特定操作,如shader 和 textures -> Optional GL-based acceleration of certain graphics operations including shader support and textures (module gl/);
  • 动画处理能力->Animation capabilities (module animator/);
  • 内建SVG支援->Some built-in SVG support (module (svg/)
  • 內建若干 image codec,如 PNG, JPEG, GIF, BMP (modules images/) ->Built-in image decoders: PNG, JPEG, GIF, BMP, WBMP, ICO (modules images/);
  • 内建文字处理,但缺乏泰文、藏文一类复杂文字处理能力->Text capabilities (no built-in support for complex scripts);
  • Some awareness of higher-level UI toolkit constructs (platform windows, platform events): Mac, Unix (sic. X11, incomplete), Windows, wxwidgets
  • 功能特性 Performace features
    1. Copy-on-write for images and certain other data types;
    2. Extensive use of the stack, both internally and for API consumers to avoid needless allocations and memory fragmentation;
    3. Thread-safety to enable parallelisation.

The library is portable and has (optional) platform-specific backends:

  • Fonts: Android / Ascender, FreeType, Windows (GDI);
  • Threading: pthread, Windows;
  • XML: expat, tinyxml;
  • Android shared memory (ashmem) for inter-process image data references;

二、从应用层到底层对skia的调用关系

      Android对skia的调用是一个比较经典的调用过程,应用程序的几个包是在SDK中提供的;JNI放在框架的JNI目录下面的Graphic目录;skia是作为一个第三方组件放在external目录下面。skia结构如图:

      android 的skia 图形引擎库

 

     其实主要涉及到的3个库:
     libcorecg.so  包含/skia/src/core的部分内容,比如其中的Region,Rect是在SurfaceFlinger里面计算可是区域的操作基本单位;
     libsgl.so        包含/skia/src/core|effects|images|ports|utils的部分和全部内容,这个实现了skia大部分的图形效果,以及图形格式的编解码;
     libskiagl.so   包含/skia/src/gl里面的内容,主要用来调用opengl实现部分效果。

    

原文链接: https://www.cnblogs.com/Caiqinghua/archive/2010/08/04/1791752.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    android 的skia 图形引擎库

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/13399

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月7日 下午12:47
下一篇 2023年2月7日 下午12:48

相关推荐