【问题标题】:Feathers / Starling / AS3 / Air - Texture too big (max is 2048x2048) - Camera Roll羽毛 / Starling / AS3 / Air - 纹理太大(最大为 2048x2048) - 相机胶卷
【发布时间】:2014-01-05 08:04:59
【问题描述】:

当我尝试从相机胶卷加载照片时。我收到以下消息:

Error #3683: Texture too big (max is 2048x2048).

以下代码是我在 Feathers/Starling 中使用的代码:

var Image_Loader:ImageLoader = new ImageLoader();
Image_Loader.source = url;
addChild(Image_Loader);

我一直在阅读,我需要将照片转换为位图,然后调整它的大小。这是我需要帮助的时候。为了完成这项工作,我对位图或位图数据一无所知。谁能指出我正确的方向或为此建议一些好的教程/链接。

【问题讨论】:

    标签: actionscript-3 bitmap bitmapdata starling-framework camera-roll


    【解决方案1】:

    我找到了一篇帖子,并弄清楚了我想要完成的工作。加载对于我正在使用的当前尺寸屏幕来说太大的图像/照片,然后将其缩小以免出错。而不是使用 ImageLoader。只需将纹理直接添加到舞台,但先调整它的大小。

            var URLReq:URLRequest = new URLRequest("Image URL");
            var imageLoader:Loader = new Loader();
    
            imageLoader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, loadBit);
    
            imageLoader.load(URLReq);
            var myBitmap:Bitmap = new Bitmap();
    
            function loadBit(event:flash.events.Event):void
            {
                myBitmap = Bitmap(imageLoader.content);
    
                var texture:Texture = Texture.fromBitmap(myBitmap);
                var image:Image = new Image(texture);
                image.width = image.height = 300;
                addChild(image);}
    

    【讨论】:

      【解决方案2】:

      您的问题似乎是您尝试加载的位图大小太大。

      当 Flash 加载文件时,它会将其在 bitmapDataObject 中写入的内容限制为任何形状的 2048x2048 像素。这意味着总共有 4194304 个像素。您的 x/y 尺寸并不重要。您必须确保您的图像小于导入前的图像(使用 Windows 资源管理器查看您的图像文件或在 OSX 上预览,它会告诉您像素尺寸)将这两个数字相乘,看看您得到的数字是高于还是低于 4194304 . 如果它在上面,并且可能是由于您的错误,您必须使用预览、photoshop、paint 等工具手动编辑它,使其尺寸等于或小于 4194304。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-15
      • 1970-01-01
      • 2020-07-20
      • 1970-01-01
      • 1970-01-01
      • 2018-08-22
      相关资源
      最近更新 更多