2

複数のレイヤーを持つcamanjsで画像を操作しています。サブレイヤーの外側でコマンドを実行するとカラーチャンネルを変更できますが、レイヤーで.channelsを使用しようとすると「チャンネルは関数ではありません」というJSエラーが表示されます.

    loadImage(basetop, 'stack/yoko.jpg', w, h).done(function(){
            //Step 2: render filtered images
            var imgData=ctx.getImageData(0,0,basetop.width,basetop.height);
            basetop.getContext('2d').putImageData(imgData,0,0);
            Caman('#topFilterImage', function () {

                 //green layer
                 this.newLayer(function () {
                    // Change the blending mode
                    this.setBlendingMode("multiply");
                    this.copyParent();
                    this.channels({
                        red: -100,
                        green: 0,
                        blue: -100
                    });

                    this.saturation(-100);

                    this.colorize("#1684CA", 20);


                });
                //blue layer
                this.newLayer(function () {
                    // Change the blending mode
                    this.setBlendingMode("multiply");
                    this.copyParent();

                    this.channels({
                        red: -100,
                        green: -100,
                        blue: 0
                    });
                    this.saturation(-100);
                    this.colorize("#000080", 20);
                });

                 //red layer
                 this.newLayer(function () {
                    // Change the blending mode
                    this.setBlendingMode("multiply");
                    this.copyParent();
                    this.channels({
                        red: 0,
                        green: -100,
                        blue: -100
                    });
                    this.saturation(-100);
                    this.colorize("#ff0000", 20);

                });


                 this.render();

                });
4

0 に答える 0