internal Globals(bool fast, VsaEngine engine)
 {
     this.engine = engine;
     this.callContextStack = null;
     this.scopeStack = null;
     this.caller = DBNull.Value;
     this.regExpTable = null;
     if (fast)
     {
         this.globalObject = GlobalObject.commonInstance;
     }
     else
     {
         this.globalObject = new LenientGlobalObject(engine);
     }
 }
 /// <summary>
 /// Set default values to the canvas fields
 /// </summary>
 private void SetDefaultValues()
 {
     //When the context is created, the font of the context must be set to 10px sans-serif.
     _family = new FontFamily(GenericFontFamilies.Serif);
     _parsedFont = new Font(_family, 10, FontStyle.Regular, GraphicsUnit.Pixel);
     _font = _parsedFont.ToString();
     path = new GraphicsPath();
     path.FillMode = FillMode.Winding;
     stack = new Stack<CanvasState> {};
     //_fillStyle = "rgba(0,0,0,0)";
     _transformation = new Matrix();
     _globalAlpha = 1.0;
     _globalCompositeOperation = "source-over";
     _textAlign = "start";
     _textBaseLine = "alphabetic";
     lineWidth = 1.0;
     lineCap = "butt";
     lineJoin = "miter";
     miterLimit = 10.0;
     _shadowColor = "rgba(0,0,0,0)";
     _shadowOffsetX = 0;
     _shadowOffsetY = 0;
     _shadowBlur = 0;
     surface.SmoothingMode = SmoothingMode.HighQuality;
     surface.InterpolationMode = InterpolationMode.HighQualityBicubic;
     surface.PixelOffsetMode = PixelOffsetMode.HighQuality;
     surface.PageUnit = GraphicsUnit.Pixel;
     //scale(surface.DpiX/96, surface.DpiY/96);
     //surface.PageScale = surface.DpiX * 2/96;
     _compositier = new Compositer();
 }
        public CanvasRenderingContext2D(Canvas surface, object container, bool visible)
        {
            _surface = surface;
            _path = new CanvasPath(_surface);
            _stack = new Stack<CanvasState>();
            _visible = visible;
            _container = container;
            SetDefaultValues();
            OnPartialDraw += CanvasRenderingContext2D_OnPartialDraw;

            PluginShaderFilter();
        }