显示巨大的,滚动的图像在图像?图像、巨大

2023-09-08 12:52:39 作者:温暖似骄阳

我想显示图像文件(JPG,PNG,GIF),可以比现有的显示面积更大。我已经嵌入一个cCanvas内部的图像(获取滚动),但大的图像就不能完全显示出来。

I'm trying to show image files (jpg, png, gif) that can be larger than the available display area. I've embedded an Image inside a cCanvas (to get scrolling), but the large images are not completely displayed.

非常大的图像(例如2480 x 3507),由于具有图像的顶部或顶部和底部修剪withing滚动图片

Very large images (e.g. 2480 x 3507) have the top or the top and bottom of the image clipped withing the scrolling Image.

什么是最大的图形可以显示使用mx.controls.Image?

What is the largest graphic one can display using the mx.controls.Image ?

感谢

推荐答案

2880像素的限制是BitmapDatas,为的DisplayObject有8191像素的限制。 您可以绕过这些限制使用BitmapDataUnlimited级可在这里:http://$c$c.google.com/p/bitmapdataunlimited/

The 2880 pixels limit is for BitmapDatas, for DisplayObjects there's a limit of 8191 pixels. You can bypass these limits by using the BitmapDataUnlimited-class available here: http://code.google.com/p/bitmapdataunlimited/

不过,如果性能是很重要的,我建议让如此庞大的图像由多个较小的替代。即使你不重用这些小的,或采取从图像显示删除他们或他们的可见属性设置为false照顾仍然会有性能增益闪光灯会自动检测他们的舞台之外,不会有被渲染。

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.

编辑:

我忘记说,当手动创建BitmapDatas,比图像更大仍然可以在被加载2880px-限制仅适用,以及它们BitmapDatas(其是大于2880px)可以访问和操作。 你可以很容易有一个位图数据位图一样大的视口,那么你可以通过做一些像设置其位图数据:

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. You could easily have a Bitmap with a bitmapData as large as the viewport, then you can set its bitmapData by doing something like:

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

在滚动,你可以简单地做了上述的每一帧 或者,如果性能是很重要的,你可以滚动时(如果scrollingDistance小于viewportSize)使用viewportBitmapData.scroll(X,Y)却将整个位图数据,然后只复制新的像素。

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.

 
精彩推荐
图片推荐