public static LineStyle build(System.Drawing.Brush paint, System.Drawing.Pen thickness) { LineStyle ls = new LineStyle(); if (paint != null && paint is System.Drawing.Color) { //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'" ls.color = SwfUtils.colorToInt(ref new System.Drawing.Color[]{(System.Drawing.Color) paint}[0]); } if (thickness != null && thickness is System.Drawing.Pen) { //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" ls.width = (int) (System.Math.Round((double) (((System.Drawing.Pen) thickness).Width * flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL))); } return ls; }
//UPGRADE_TODO: Interface 'java.awt.Shape' was converted to 'System.Drawing.Drawing2D.GraphicsPath' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" private void init(System.Drawing.Drawing2D.GraphicsPath shape, Point origin, FillStyle fs, LineStyle ls, bool fill) { builder = new ShapeBuilder(origin); linestyles = new System.Collections.ArrayList(2); fillstyles = new System.Collections.ArrayList(2); if (fill && fs != null) { builder.UseFillStyle0 = true; builder.CurrentFillStyle0 = addFillStyle(fs); } if (ls != null) builder.CurrentLineStyle = addLineStyle(ls); //UPGRADE_TODO: Method 'java.awt.Shape.getPathIterator' was converted to 'System.Drawing.Drawing2D.GraphicsPathIterator.GraphicsPathIterator' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtShapegetPathIterator_javaawtgeomAffineTransform'" builder.processShape(new PathIteratorWrapper(new System.Drawing.Drawing2D.GraphicsPathIterator(shape))); }
public static LineStyle build(System.Drawing.Brush paint, System.Drawing.Pen thickness) { LineStyle ls = new LineStyle(); if (paint != null && paint is System.Drawing.Color) { //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'" ls.color = SwfUtils.colorToInt(ref new System.Drawing.Color[] { (System.Drawing.Color)paint }[0]); } if (thickness != null && thickness is System.Drawing.Pen) { //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" ls.width = (int)(System.Math.Round((double)(((System.Drawing.Pen)thickness).Width * flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL))); } return(ls); }
//UPGRADE_TODO: Interface 'java.awt.Shape' was converted to 'System.Drawing.Drawing2D.GraphicsPath' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" public ShapeWithStyleBuilder(System.Drawing.Drawing2D.GraphicsPath shape, GraphicContext graphicContext, bool outline, bool fill) { Point origin = new Point((double)graphicContext.getPen().X, (double)graphicContext.getPen().Y); System.Drawing.Brush paint = graphicContext.Paint; System.Drawing.Pen stroke = graphicContext.Stroke; FillStyle fs = null; LineStyle ls = null; if (fill && paint != null) { System.Drawing.RectangleF tempAux = shape.GetBounds(); //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'" fs = FillStyleBuilder.build(paint, ref tempAux, graphicContext.Transform); } if (outline && stroke != null) { ls = LineStyleBuilder.build(paint, stroke); } init(shape, origin, fs, ls, fill); }
public virtual void linestyle(SaxAttributesSupport attributes) { DefineShape defineShape = (DefineShape) stack[stack.Count - 1]; LineStyle linestyle = new LineStyle(); if (defineShape.code == flash.swf.TagValues_Fields.stagDefineShape3) { linestyle.color = parseRGBA(getAttribute(attributes, "color")); } else { linestyle.color = parseRGB(getAttribute(attributes, "color")); } linestyle.width = parseInt(getAttribute(attributes, "width")); linestyles.Add(linestyle); }
//UPGRADE_TODO: Interface 'java.awt.Shape' was converted to 'System.Drawing.Drawing2D.GraphicsPath' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" public ShapeWithStyleBuilder(System.Drawing.Drawing2D.GraphicsPath shape, Point origin, FillStyle fs, LineStyle ls, bool fill) { init(shape, origin, fs, ls, fill); }
/// <summary> Adds a new fill style to the <code>LineStyleArray</code></summary> /// <param name="ls">the new <code>LineStyle</code> /// </param> /// <returns> index pointing to this line style in the <code>LineStyleArray</code> /// </returns> public int addLineStyle(LineStyle ls) { //UPGRADE_TODO: The equivalent in .NET for method 'java.util.List.add' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" return linestyles.Add(ls) >= 0?((System.Collections.ArrayList) linestyles).LastIndexOf(ls) + 1:0; //Index in a 1-based array, 0 = none }
private void encodeLineStyle(LineStyle lineStyle, SwfEncoder w, int shape) { w.writeUI16(lineStyle.width); if (shape == flash.swf.TagValues_Fields.stagDefineShape6) { w.writeUI16(lineStyle.flags); if (lineStyle.hasMiterJoint()) w.writeUI16(lineStyle.miterLimit); } if (shape == flash.swf.TagValues_Fields.stagDefineShape6 && lineStyle.hasFillStyle()) { encodeFillStyle(lineStyle.fillStyle, w, shape); } else if ((shape == flash.swf.TagValues_Fields.stagDefineShape3) || (shape == flash.swf.TagValues_Fields.stagDefineShape6)) { encodeRGBA(lineStyle.color, w); } else { encodeRGB(lineStyle.color, w); } }
//UPGRADE_TODO: Interface 'java.awt.Shape' was converted to 'System.Drawing.Drawing2D.GraphicsPath' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" public DefineShapeBuilder(System.Drawing.Drawing2D.GraphicsPath shape, Point origin, FillStyle fs, LineStyle ls, bool fill):this() { sws = new ShapeWithStyleBuilder(shape, origin, fs, ls, fill); }
//UPGRADE_TODO: Interface 'java.awt.Shape' was converted to 'System.Drawing.Drawing2D.GraphicsPath' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" private void init(System.Drawing.Drawing2D.GraphicsPath shape, Point origin, FillStyle fs, LineStyle ls, bool fill) { builder = new ShapeBuilder(origin); linestyles = new System.Collections.ArrayList(2); fillstyles = new System.Collections.ArrayList(2); if (fill && fs != null) { builder.UseFillStyle0 = true; builder.CurrentFillStyle0 = addFillStyle(fs); } if (ls != null) { builder.CurrentLineStyle = addLineStyle(ls); } //UPGRADE_TODO: Method 'java.awt.Shape.getPathIterator' was converted to 'System.Drawing.Drawing2D.GraphicsPathIterator.GraphicsPathIterator' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtShapegetPathIterator_javaawtgeomAffineTransform'" builder.processShape(new PathIteratorWrapper(new System.Drawing.Drawing2D.GraphicsPathIterator(shape))); }
/// <summary> Adds a new fill style to the <code>LineStyleArray</code></summary> /// <param name="ls">the new <code>LineStyle</code> /// </param> /// <returns> index pointing to this line style in the <code>LineStyleArray</code> /// </returns> public int addLineStyle(LineStyle ls) { //UPGRADE_TODO: The equivalent in .NET for method 'java.util.List.add' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" return(linestyles.Add(ls) >= 0?((System.Collections.ArrayList)linestyles).LastIndexOf(ls) + 1:0); //Index in a 1-based array, 0 = none }
/// <summary> Utility method that calculates the minimum bounding rectangle that encloses a list /// of ShapeRecords, taking into account the possible maximum stroke width of any of the /// supplied linestyles. /// </summary> /// <param name="records"> /// </param> /// <param name="lineStyles"> /// </param> /// <returns> /// </returns> public static Rect getBounds(System.Collections.IList records, System.Collections.IList lineStyles) { if (records == null || records.Count == 0) { return(new Rect()); } else { int x1 = 0; int y1 = 0; int x2 = 0; int y2 = 0; int x = 0; int y = 0; bool firstMove = true; System.Collections.IEnumerator it = records.GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'" while (it.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'" ShapeRecord r = (ShapeRecord)it.Current; if (r == null) { continue; } if (r is StyleChangeRecord) { StyleChangeRecord scr = (StyleChangeRecord)r; x = scr.moveDeltaX; y = scr.moveDeltaY; if (firstMove) { x1 = x; y1 = y; x2 = x; y2 = y; firstMove = false; } } else if (r is StraightEdgeRecord) { StraightEdgeRecord ser = (StraightEdgeRecord)r; x = x + ser.deltaX; y = y + ser.deltaY; } else if (r is CurvedEdgeRecord) { CurvedEdgeRecord cer = (CurvedEdgeRecord)r; x = x + cer.controlDeltaX + cer.anchorDeltaX; y = y + cer.controlDeltaY + cer.anchorDeltaY; } if (x < x1) { x1 = x; } if (y < y1) { y1 = y; } if (x > x2) { x2 = x; } if (y > y2) { y2 = y; } } if (lineStyles != null && lineStyles.Count > 0) { it = lineStyles.GetEnumerator(); int width = flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL; //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'" while (it.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'" LineStyle ls = (LineStyle)it.Current; if (ls == null) { continue; } else { if (width < ls.width) { width = ls.width; } } } //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" double stroke = (int)System.Math.Round((double)(width * 0.5)); //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" x1 = (int)System.Math.Round((double)(x1 - stroke)); //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" y1 = (int)System.Math.Round((double)(y1 - stroke)); //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" x2 = (int)System.Math.Round((double)(x2 + stroke)); //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" y2 = (int)System.Math.Round((double)(y2 + stroke)); } return(new Rect(x1, x2, y1, y2)); } }
//UPGRADE_TODO: Interface 'java.awt.Shape' was converted to 'System.Drawing.Drawing2D.GraphicsPath' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" public DefineShapeBuilder(System.Drawing.Drawing2D.GraphicsPath shape, Point origin, FillStyle fs, LineStyle ls, bool fill) : this() { sws = new ShapeWithStyleBuilder(shape, origin, fs, ls, fill); }