Example #1
0
 /// <summary> Construct a new ScenicGraphics object that inherits the
 /// state of the given ScenicGraphics object.
 ///
 /// </summary>
 /// <param name="parent">the parent object
 /// </param>
 public Graphics(Graphics parent)
 {
     stateStack  = new Stack <State>();
     state       = (State)parent.state.Clone();
     state.scene = new SceneContainer();
     parent.state.scene.add(state.scene);
     path = new PathBuilder();
 }
Example #2
0
        /// <summary> Fills the current path.</summary>
        public virtual void Fill()
        {
            FilledPath shape = new FilledPath(path.createPath());

            shape.FillRule = state.fillRule;
            state.scene.add(createNode(shape, state.fillColor, state.fillBrush));

            path = new PathBuilder();
        }
Example #3
0
        /// <summary> Clips to the area inside the current path.</summary>
        public virtual void Clip()
        {
            FilledPath shape = new FilledPath(path.createPath());
            SceneClip  clip  = new SceneClip(shape);

            state.scene.add(clip);
            state.scene = clip;

            path = new PathBuilder();
        }
Example #4
0
 public Graphics(Render.IRendererCallback rendererClbks) //TODO PENDING
 {
     stateStack  = new Stack <State>();
     state       = new State();
     state.scene = new SceneContainer();
     path        = new PathBuilder();
     if (rendererClbks == null)
     {
         state.callbacks = new Render.VertexStore();
     }
     else
     {
         state.callbacks = rendererClbks;
     }
 }
Example #5
0
        /// <summary> Fills and strokes the current path.</summary>
        public virtual void FillAndStroke()
        {
            Path       p     = path.createPath();
            FilledPath shape = new FilledPath(p);

            shape.FillRule = state.fillRule;
            state.scene.add(createNode(shape, state.fillColor, state.fillBrush));

            StrokedPath r2 = new StrokedPath(p);

            r2.LineWidth  = state.lineWidth;
            r2.EndCap     = state.lineCap;
            r2.LineJoin   = state.lineJoin;
            r2.MiterLimit = state.miterLimit;

            state.scene.add(createNode(r2, state.strokeColor, state.strokeBrush));

            path = new PathBuilder();
        }
Example #6
0
        /// <summary> Strokes the current path.</summary>
        public virtual void Stroke()
        {
            StrokedPath r = new StrokedPath(path.createPath());

            r.LineWidth  = state.lineWidth;
            r.EndCap     = state.lineCap;
            r.LineJoin   = state.lineJoin;
            r.MiterLimit = state.miterLimit;
            r.DashArray  = state.lineDashLengths;
            r.DashPhase  = state.lineDashPhase;

            SceneNode node = createNode(r, state.strokeColor, state.strokeBrush);

            state.scene.add(node);

            System.Drawing.Rectangle rec = new System.Drawing.Rectangle();
            path = new PathBuilder();

            state.scene.draw(new DrawContext(state.callbacks), state.transform, ref rec);
        }
Example #7
0
 /// <summary> Constructs a new Graphics object using the given SceneContainer as
 /// the root node. The transformation matrix of the root node is also
 /// given. This matrix is used to position hinted glyphs properly.
 ///
 /// </summary>
 /// <param name="scene">The root node into which graphics is drawn.
 /// </param>
 /// <param name="transform">The transformation matrix of the root node.
 /// </param>
 public Graphics(SceneContainer scene, System.Drawing.Drawing2D.Matrix transform)
 {
     //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1156_3"'
     stateStack  = new Stack <State>();
     state       = newState();
     state.scene = scene;
     //UPGRADE_TODO: Method 'java.awt.geom.AffineTransform.clone' was converted to 'System.Drawing.Drawing2D.Matrix.Clone' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtgeomAffineTransformclone_3"'
     state.transform = (System.Drawing.Drawing2D.Matrix)transform.Clone();
     //UPGRADE_NOTE: If the given Font Name does not exist, a default Font instance is created. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1075_3"'
     //UPGRADE_TODO: Field 'java.awt.Font.PLAIN' was converted to 'System.Drawing.FontStyle.Regular' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javaawtFontPLAIN_f_3"'
     state.font                      = new System.Drawing.Font("SansSerif", 12, System.Drawing.FontStyle.Regular);
     state.strokeColor               = new ScenicColor(0, 0, 0);
     state.fillColor                 = state.strokeColor;
     state.lineWidth                 = 1.0f;
     state.lineCap                   = LineCapStyle.BUTT_CAP;
     state.lineJoin                  = LineJoinStyle.BEVEL_JOIN;
     state.miterLimit                = 10.0f;
     state.lineDashLengths           = null;
     state.lineDashPhase             = 0.0f;
     state.fillRule                  = FillRule.ODD_WINDING;
     state.usesFractionalFontMetrics = false;
     path = new PathBuilder();
 }