本文介绍了我无法使用来自Pixastic的HTML5 Canvas和Javascript过滤器处理我的图像,我做错了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Javascriptpixastic.custom(5)文件是使用核心代码和减轻过滤器从Pixastic创建的。代码用于在Mozilla Broweser中重绘画布中的图像,但它不会过滤它。 HTML5正在对画布进行编码,在画布上绘制图像,并且应该通过Javascript过滤器将图像重新绘制到画布上,然后它会变亮。这是否有意义?

The Javascript "pixastic.custom (5) file was created from Pixastic using just the core code and "lighten" filter. The code works to redraw the image in the canvas in a Mozilla Broweser, however it is not filtering it. The HTML5 is coding the canvas, drawing the image on the canvas, and supposed to be redrawing the image through the Javascript Filter on to the canvas where it would then be lightened. Does any of this make sense?

以下是我的代码:

<!DOCTYPE HTML>
<html>
<head>
    <script type="text/javascript" charset="utf-8" src="pixastic.custom  (5).js"></script>
    <style>
        body {
            margin: 0px;
            padding: 0px;
        }
        #myCanvas {
            border: 1px solid #9C9898;
        }
    </style>
    <script>
        window.onload = function() {
            var canvas = document.getElementById("myCanvas");
            var context = canvas.getContext("2d");
            var imageObj = new Image();
            imageObj.onload = function() {
                var options ={};
                Pixastic.process(imageObj, "lighten", options)
                    {amount : .5
                };
                options.resultCanvas;
                context.drawImage(imageObj, 80, 60);
            }

            imageObj.src = "IMAG8703.jpg";
        };
    </script>
</head>
<body>
    <canvas id="myCanvas" width="2000" height="4000"></canvas>
</body>
    </html>

感谢您查看我的代码...我真的不知道为什么它不工作。一切都在同一个目录中,一切都匹配。代码从PIXASTIC站点与HTML5 Canvas框架组合,一切都应该顺利运行...

Thank you for looking over my code...I really have no idea why it isn't working. Everything is in the same directory and everything matches up. The code is combined from the PIXASTIC site with HTML5 Canvas framework everything should work smoothly...

推荐答案

问题出在第7位脚本标记中的行。不确定你要做什么,但会有错误。

The problem is at the 7th line from the script tag. Not sure what you are trying to do but there's gonna be an error.

这是合法的。

Pixastic.process(imageObj, "lighten", {amount : .5});

这篇关于我无法使用来自Pixastic的HTML5 Canvas和Javascript过滤器处理我的图像,我做错了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 05:36