/**
 * @author Mat Groves
 * 
 * 
 */

PIXI.CanvasMaskManager = function()
{
    
};

PIXI.CanvasMaskManager.prototype.pushMask = function(maskData, context)
{
    context.save();
    
    //maskData.visible = false;
    // maskData.alpha = 0;
    
    var cacheAlpha = maskData.alpha;
    var transform = maskData.worldTransform;

    context.setTransform(transform[0], transform[3], transform[1], transform[4], transform[2], transform[5]);

    PIXI.CanvasGraphics.renderGraphicsMask(maskData, context);

    context.clip();

    maskData.worldAlpha = cacheAlpha;
};

PIXI.CanvasMaskManager.prototype.popMask = function(context)
{
    context.restore();
};