GWT create Image using ImageResource

血红的双手。 提交于 2019-12-06 03:46:23

First, you should not use the last two.

An ImageResource technically represents a region within a "sprited" image: it has a URL to the sprite and the coordinates of the region on that image. In many browsers, and for most images, the URL will actually be a data: URL and the region will represent the whole image. This can be controlled on a per-image basis using @ImageOptions(preventInlining=true) or globally with a set-property on your gwt.xml. In other words, your code shouldn't rely on it, and should always treat an ImageResource as a region within a sprited image.
FYI, the cases where a sprited image is actually used by default are for IE6/7 which does not support data: URLs, and for images that are too large to fit within a data: URL (all browsers).

This is however exactly what you're doing in the last two cases: use only the URL of the ImageResource, as if it weren't (potentially) a sprited image.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!