Search code examples
firefoxcanvasfirefox-addonfirefox-addon-sdkgetpixel

firefox drawWindow() canvas function using the add-on sdk


I've exactly the same issue : How do I use the canvas drawWindow function in an addon created using the addon sdk?

But the solution doesn't work.

If drawWindow can't be use with the firefox add-on sdk, there is an other solution to put a clicked pixel to a canvas ?


Solution

  • Get a privileged canvas

    var chromewin = require('sdk/windows/utils').getHiddenWindow();
    var canvas = chromewin.document.createElementNS('http://www.w3.org/1999/xhtml',
                                                    'canvas');
    

    and work with it from main.js, not a content script.