首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FlashCanvas drawImage NotWorking

FlashCanvas drawImage NotWorking
EN

Stack Overflow用户
提问于 2012-11-30 23:19:24
回答 2查看 646关注 0票数 1

我在IE8中运行的Windows7 IE9上。这只能在IE9中工作,因为我可以使用canvas,但是在IE8中,它应该回退到flash canvas。这是我的源码http://blog.jackadam.net/2010/alpha-jpegs/,现在看来我在IE中遇到了context.drawImage不能绘制图像的问题?我已经在flashcanvas google组上发表了帖子,但他们似乎需要一些时间才能回复,所以我希望这里可能有一个flashcanvas大师。

代码语言:javascript
复制
;(function() {

var create_alpha_jpeg = function(img) {

    var alpha_path = img.getAttribute('data-alpha-src')
    if(!alpha_path) return

    // Hide the original un-alpha'd
    img.style.visiblity = 'hidden'

    // Preload the un-alpha'd image
    var image = document.createElement('img')
    image.src = img.src + '?' + Math.random()
    console.log(image.src);
    image.onload = function () {
        console.log('image.onload');

        // Then preload alpha mask
        var alpha = document.createElement('img')
        alpha.src = alpha_path + '?' + Math.random()
        alpha.onload = function () {
            console.log('alpha.onload');
            var canvas = document.createElement('canvas')
            canvas.width = image.width
            canvas.height = image.height
            img.parentNode.replaceChild(canvas, img)

            // For IE7/8
            if(typeof FlashCanvas != 'undefined') FlashCanvas.initElement(canvas)

            // Canvas compositing code
            var context = canvas.getContext('2d')
            context.clearRect(0, 0, image.width, image.height)
            context.drawImage(image, 0, 0, image.width, image.height)
            //context.globalCompositeOperation = 'xor'
            //context.drawImage(alpha, 0, 0, image.width, image.height)

        }

    }

}

// Apply this technique to every image on the page once DOM is ready
// (I just placed it at the bottom of the page for brevity)
var imgs = document.getElementsByTagName('img')
for(var i = 0; i < imgs.length; i++)
create_alpha_jpeg(imgs[i])

})();
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-07-18 00:19:08

这个问题的解决方案是它只适用于旧版本的flashcanvas,而且它只适用于flashcanvas pro。如网站的第二个页脚所示

此技术使用globalCompositeOperation操作,这需要FlashCanvas专业版。非营利性使用免费,商业许可只需31美元。

票数 0
EN

Stack Overflow用户

发布于 2015-04-14 07:31:32

我用flashcanvaspro让它工作了。根据目标flash播放器的不同,最大图像大小也会有所不同。Flash Player 10将位图的最大大小增加到最大像素计数16,777,215。Flash Player 9限制(2880 x 2880像素)。

https://helpx.adobe.com/flash-player/kb/size-limits-swf-bitmap-files.html

我需要有人更新flashcanvas到最新的flash播放器

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13648012

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档