internal Context(object backend, Toolkit toolkit, ContextBackendHandler handler, bool getGlobalStyles = true) : base(backend, toolkit, handler) { this.handler = handler; if (getGlobalStyles) { styles = globalStyles; if (styles != StyleSet.Empty) handler.SetStyles (Backend, styles); } }
internal Context(object backend, Toolkit toolkit, ContextBackendHandler handler) : base(backend, toolkit, handler) { this.handler = handler; }
internal Context(object backend, Toolkit toolkit) : base(backend, toolkit, toolkit.ContextBackendHandler) { handler = ToolkitEngine.ContextBackendHandler; }
internal static void Draw(Toolkit tk, ContextBackendHandler handler, object ctx, VectorImageData cm) { int di = 0; int ci = 0; int ii = 0; int ri = 0; int oi = 0; int imi = 0; int ti = 0; for (int n=0; n<cm.Commands.Length; n++) { switch (cm.Commands [n]) { case DrawingCommand.AppendPath: var p = (VectorImageData)cm.Objects [oi++]; Draw (tk, handler, ctx, p); break; case DrawingCommand.Arc: handler.Arc (ctx, cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.ArcNegative: handler.ArcNegative (ctx, cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.Clip: handler.Clip (ctx); break; case DrawingCommand.ClipPreserve: handler.ClipPreserve (ctx); break; case DrawingCommand.ClosePath: handler.ClosePath (ctx); break; case DrawingCommand.CurveTo: handler.CurveTo (ctx, cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.DrawImage2: handler.DrawImage (ctx, cm.Images [imi++], cm.Rectangles [ri++], cm.Rectangles [ri++]); break; case DrawingCommand.DrawImage: handler.DrawImage (ctx, cm.Images [imi++], cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.DrawTextLayout: var lad = (TextLayoutData)cm.TextLayouts [ti++]; var la = new TextLayout (tk); lad.InitLayout (la); handler.DrawTextLayout (ctx, la, cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.Fill: handler.Fill (ctx); break; case DrawingCommand.FillPreserve: handler.FillPreserve (ctx); break; case DrawingCommand.LineTo: handler.LineTo (ctx, cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.MoveTo: handler.MoveTo (ctx, cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.NewPath: handler.NewPath (ctx); break; case DrawingCommand.Rectangle: handler.Rectangle (ctx, cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.RelCurveTo: handler.RelCurveTo (ctx, cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.RelLineTo: handler.RelLineTo (ctx, cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.RelMoveTo: handler.RelMoveTo (ctx, cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.Restore: handler.Restore (ctx); break; case DrawingCommand.Rotate: handler.Rotate (ctx, cm.Doubles [di++]); break; case DrawingCommand.Save: handler.Save (ctx); break; case DrawingCommand.Scale: handler.Scale (ctx, cm.Doubles [di++], cm.Doubles [di++]); break; case DrawingCommand.SetColor: handler.SetColor (ctx, cm.Colors [ci++]); break; case DrawingCommand.SetGlobalAlpha: handler.SetGlobalAlpha (ctx, cm.Doubles [di++]); break; case DrawingCommand.SetLineDash: var off = cm.Doubles [di++]; var ds = new double [cm.Ints [ii++]]; for (int i = 0; i < ds.Length; i++) ds [i] = cm.Doubles [di++]; handler.SetLineDash (ctx, off, ds); break; case DrawingCommand.SetLineWidth: handler.SetLineWidth (ctx, cm.Doubles [di++]); break; case DrawingCommand.SetPattern: handler.SetPattern (ctx, cm.Objects [oi++]); break; case DrawingCommand.Stroke: handler.Stroke (ctx); break; case DrawingCommand.StrokePreserve: handler.StrokePreserve (ctx); break; case DrawingCommand.Translate: handler.Translate (ctx, cm.Doubles [di++], cm.Doubles [di++]); break; } } }