将一组形状组合成图像

将一组形状组合成图像

本文介绍了将一组形状组合成图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出一个完全由不同形状的图像组成的图像,这些图像不会移动并被分组在一起,我如何将这一组转换为具有相同图形但全部在一起的图像或类似元素?我希望将它们结合起来的原因是为了获得更好的性能,因为我假设一旦在屏幕上获得了很多这些基于形状的图形,帧速率就会呈指数下降.

Given an image composed entirely of different shapes that do not move and are grouped together, how would I convert this group into an image or similar element that has this same graphic but all together? The reason I'd like them combined is for better performance, because I assume once I get a lot of these shape-based graphics on the screen the frame rate will drop exponentially.

类似的注释:可以将应用了效果(例如轮廓和阴影)的组合并为平面图形吗?

On a similar note: could groups with effects (such as outlines and shadows) applied to them also be merged into a flat graphic?

推荐答案

buffered-rendering 属性,它或多或少地提供了您所需要的东西.您可以在< g>元素上设置buffered-rendering="static",以向浏览器提示最好缓存结果.

There is the buffered-rendering property in SVG Tiny 1.2, it provides what you are after more or less. You set buffered-rendering="static" on the <g> element to give the browser the hint that it's good to cache the results.

在当前的浏览器中,只有 Opera 支持此属性AFAIK.

Of the current generation of browsers only Opera supports this property AFAIK.

是的,效果包含在平面图形"中,最终结果应该看起来与没有缓冲渲染的效果完全一样.

Yes, effects are included in the "flat graphic", the end result should look exactly the same as if buffered-rendering wasn't there.

这篇关于将一组形状组合成图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 22:59