Skia 和 Android Paint 绘图对象及其使用或文档

发布于 2024-08-20 12:11:29 字数 509 浏览 7 评论 0原文

有谁知道 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

明明#如月 2024-08-27 12:11:29

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.

凉栀 2024-08-27 12:11:29

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文