Pixastic javascript library is returning false in

2019-09-04 06:48发布

问题:

I am trying to use Pixastic JavaScript library for image manipulation in Windows 8 Metry Style app using JavaScript as language. I am passing canvas as input parameter and trying to get image and binging again to canvas but the image value that i am getting all the time is FALSE. CODE:

 // First, draw it into the backing canvas
    context.drawImage(video, 0, 0, width, height);

    // change brightness and contrast
    Pixastic.Client.isIE = false;
    Pixastic.process(canvas, 'brightness',
        {
            'brightness': 2,
            'contrast': 0.0,
            'leaveDOM': true
        },
        function (img) {

            if (img) {
                context.putImageData(img, 0, 0);
            }
        }
    );

I tried to find the reason and its said that this class returns false only if there is an internal error or some other problem occurs. when i debugged the code its runs fine no issue with my written code. But when i check inside Pixastic library i found that on one condition check its returning false

if(imageIsCanvas&&Pixastic.Client.isIE()){if(Pixastic.debug)writeDebug("Tried to process a canvas element but browser is IE.");return false;

I don't know how can i use Pixastic in my Windows 8 app. Can anyone suggest a way to use pixastic library in Windows 8 app?

回答1:

It seems that Pixastic doesn't support IE. From their website:

The methods are currently only fully supported by Firefox, Opera and Safari with a recent WebKit nightly build.

You could change your isIE workaround to either be a function (as below) or change the implementation in the library.

Pixastic.Client.isIE  = function(){ return false; };

Though no doubt other things could be broken.