1

我想使用 camanjs 在 Phonegap 上操作我的画布,但是当我在这里使用此代码时

function applySunrise(){
    Caman("#myCanvas", function () {
    this.sunrise();
    this.render();
    });
}

它会导致这样的错误:

Uncaught TypeError: Object function () {
    var i, pixel, _i, _len, _ref;
    if (this.context == null) {
        this.context = this.canvas.getContext('2d');
    }
    this.originalWidth = this.preScaledWidth 
      = this.width = this.canvas.width;
    this.originalHeight = this.preScaledHeight 
      = this.height = this.canvas.height;
    this.hiDPIAdjustments();
    if (!this.hasId()) {
        this.assignId();
     }
     if (this.image != null) {
         this.context.drawImage(this.image, 0, 0, 
                                this.imageWidth(), this.imageHeight(), 0, 
                                0, this.preScaledWidth, this.preScaledHeight);
       }
     this.imageData = this.context.getImageData(0, 0, 
                                this.canvas.width, this.canvas.height);
     this.pixelData = this.imageData.data;
     if (Caman.allowRevert) {
         this.initializedPixelData = Util.dataArray(this.pixelData.length);
         this.originalPixelData = Util.dataArray(this.pixelData.length);
         _ref = this.pixelData;
         for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
             pixel = _ref[i];
             this.initializedPixelData[i] = pixel;
             this.originalPixelData[i] = pixel;
         }
     }
     this.dimensions = {
         width: this.canvas.width,
         height: this.canvas.height
     };
     Store.put(this.id, this);
     this.callback.call(this, this);
     return this.callback = function() {};
} has no method 'bind' at file:///android_asset/www/old/js/caman.full.js:219

我正在使用cordova 2.8.1.jsand ,如果有帮助caman.full.js,我也会使用jquery-1.8.3.min.jsand 。jquery.mobile-1.2.1.min.js

4

1 回答 1

0

从您给出的代码中很难分辨,但这可能与您在this.sunrise(); this.render();. 我看到的唯一另一件事是您可能必须调用new Caman(...);来实例化一个新对象?

于 2013-07-08T06:29:52.210 回答