Skia 和 Android Paint 绘图对象及其使用或文档
有谁知道 Android 使用的 Skia 绘图库的好文档吗?
主 Canvas 对象几乎没有任何状态,因此我特别考虑可以嵌入 Paint 对象的对象。我通过反复试验弄清楚了如何使用一些 ColorFilters,并使用 ColorMatrixColorFilter 制作了很酷的效果。现在我也从 LinearGradient 着色器中获得了我想要的阴影。我想我了解 PathEffects 并且对 XferModes 有一些想法。 MaskFilters 和 Rasterizers 对我来说仍然完全不透明。但反复试验并不是理解复杂库的好方法。
我主要担心 Android 文档根本不讨论 2d 图形以及使用它们的方法。即使类 javadoc 也常常不解释该类正在做什么。实际的功能都是Skia C代码,我可以得到,但它也缺乏文档。我看过一些很酷的演示,但谷歌很少解释它们是如何完成的。
理解这些东西的唯一方法是实验和阅读C代码吗?效率和最佳实践怎么样? Davlik/Android VM 对内存分配很敏感,有时速度很慢,我担心我没有以最好的方式做事。
Does anyone know of good documentation for the Skia drawing library used by Android?
The main Canvas object has hardly any state, so I'm thinking especially of the objects you can embed into the Paint object. I've worked out by trial and error how to use some ColorFilters and made a cool effect with ColorMatrixColorFilter. Now I have the drop shadows I want from the LinearGradient shader also. I think I understand PathEffects and have some ideas about XferModes. MaskFilters and Rasterizers are still utterly opaque to me. But trial and error is not a good way to understand a complicated library.
Mostly I'm concerned that the Android docs don't discuss 2d graphics and the means of using them at all. Even the class javadocs often don't explain what the class is doing. The actual function is all in Skia C code, which I can get, but it also lacks documentation. I've seen some cool demos but Google explained little about how they were done.
Is the only way to understand these things experimentation and reading the C code? What about efficiency and best practices? The Davlik/Android VM is sensitive to memory allocations and sometimes slow and I'm concerned that I'm not doing things the best way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Skia 有自己的谷歌代码项目网站,您可以在其中找到一些高级概述。
可以通过项目网站中的此链接浏览内联文档
http:// skia.googlecode.com/svn/trunk/docs/html/hierarchy.html
并且您可以加入讨论邮件列表。设计师和社区将回答问题。
另一个很好的参考来自苹果公司,令人惊讶。 Apple QuickDraw GX 文档解释了许多 2D 矢量图形概念,并且可以很好地应用于 Skia。
Skia has its own google code project site where you could find some high level overview.
Inline documents could be browse by this link in the project site
http://skia.googlecode.com/svn/trunk/docs/html/hierarchy.html
And you could join the discussion mail list. Designers and community will answer questions.
Another good reference is surprising from Apple. Apple QuickDraw GX documentations explained a lot of 2D vector graphics concepts and could apply to Skia well enough.
Android canvas API确实有两种不同的实现,一种是Skia,另一种是OpenGL ES。后来的实现就是所谓的HWUI。
无论实现如何,了解绘制过程底层的管道对于了解如何使用画布 API 至关重要。
以下是迄今为止描述管道的最佳文档。您一定会发现它很有用。
http://www.xenomachina.com/2011/05 /androids-2d-canvas-rendering-pipeline.html
Android canvas API did have two difference implementation, one is Skia and another is OpenGL ES. The later implementation is so-called HWUI.
Regardless of the implementation, understanding the pipeline underlying the draw process is critical to understand how to use the canvas API.
Below are the best doc available so far describing the pipeline. You will definitely find it useful.
http://www.xenomachina.com/2011/05/androids-2d-canvas-rendering-pipeline.html