简体   繁体   English

在Image中显示巨大的可滚动图像?

[英]Displaying huge, scrollable images in Image?

I'm trying to show image files (jpg, png, gif) that can be larger than the available display area. 我正在尝试显示可能大于可用显示区域的图像文件(jpg,png,gif)。 I've embedded an Image inside a cCanvas (to get scrolling), but the large images are not completely displayed. 我在cCanvas中嵌入了一个Image(以进行滚动),但是没有完全显示大图像。

Very large images (eg 2480 x 3507) have the top or the top and bottom of the image clipped withing the scrolling Image. 非常大的图像(例如2480 x 3507)使用滚动图像剪切图像的顶部或顶部和底部。

What is the largest graphic one can display using the mx.controls.Image ? 使用mx.controls.Image可以显示的最大图形是什么?

Thanks 谢谢

The 2880 pixels limit is for BitmapDatas, for DisplayObjects there's a limit of 8191 pixels. 对于BitmapDatas,2880像素限制,对于DisplayObjects,限制为8191像素。 You can bypass these limits by using the BitmapDataUnlimited-class available here: http://code.google.com/p/bitmapdataunlimited/ 您可以使用此处提供的BitmapDataUnlimited类绕过这些限制: http//code.google.com/p/bitmapdataunlimited/

However, if performance is important I'd recommend letting such large images consist of multiple smaller ones instead. 但是,如果性能很重要,我建议让这些大图像由多个较小的图像组成。 Even if you don't reuse these smaller ones or take care of removing them from the displayList or setting their visible-property to false there will still be a performance gain as flash automatically detects that they're outside of the stage and wont have to be rendered. 即使你不重用这些较小的或者将它们从displayList中删除或者将它们的visible-property设置为false,仍然会有性能提升,因为flash会自动检测到它们不在舞台之外而且不必被渲染。

Edit: 编辑:

I forgot saying that the 2880px-limit only applies when manually creating BitmapDatas, images bigger than that can still be loaded in, and their BitmapDatas (which are bigger than 2880px) can be accessed and manipulated. 我忘了说2880px-limit只适用于手动创建BitmapDatas,大于的图像仍然可以加载,并且可以访问和操作它们的BitmapDatas(大于2880px)。 You could easily have a Bitmap with a bitmapData as large as the viewport, then you can set its bitmapData by doing something like: 您可以轻松地使用与视口一样大的bitmapData的Bitmap,然后您可以通过执行以下操作来设置其bitmapData:

viewportBitmapData.copyPixels(sourceBitmapData, new Rectangle(x,y,viewportWidth, viewPortHeight), new Point(0,0))

When scrolling, you could simply do the above on each frame Or if performance is important, you can when scrolling (if scrollingDistance is less than viewportSize) use viewportBitmapData.scroll(x,y) to shift the whole bitmapData, and then copy only the new pixels. 滚动时,您可以在每个帧上执行上述操作或者如果性能很重要,则可以在滚动时(如果scrollingDistance小于viewportSize)使用viewportBitmapData.scroll(x,y)移动整个bitmapData,然后仅复制新像素。

I've read that the limit is 2880 pixels per dimension in Flash 9. In Flash 10 the limit is higher. 我已经读过Flash 9中每个维度的限制是2880像素。在Flash 10中,限制更高。 Check to see which version you're compiling for. 检查您要编译的版本。

You could potentially chop the image into smaller pieces and assemble them in Flex. 您可以将图像切成小块并将它们组装成Flex。

If makes a difference which FlashPlayer you are targetting: 如果您正在针对哪个FlashPlayer产生影响:

versions VS maximum bitmapsize 版本VS最大位图

flashplayer -9 : 2880x2880 px flashplayer -9:2880x2880 px
flashplayer 10 : 4096x4096 px flashplayer 10:4096x4096 px
flashplayer 11 : unlimited flashplayer 11:无限制

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM