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结构如图:

     其实主要涉及到的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实现部分效果。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值