private void curveRecord(int[] delta) { CurvedEdgeRecord cer = new CurvedEdgeRecord(); cer.controlDeltaX = delta[0]; cer.controlDeltaY = delta[1]; cer.anchorDeltaX = delta[2]; cer.anchorDeltaY = delta[3]; shape.shapeRecords.Add(cer); }
public virtual void curve(SaxAttributesSupport attributes) { CurvedEdgeRecord curvedEdge = new CurvedEdgeRecord(); curvedEdge.controlDeltaX = parseInt(getAttribute(attributes, "cdx")); curvedEdge.controlDeltaY = parseInt(getAttribute(attributes, "cdy")); curvedEdge.anchorDeltaX = parseInt(getAttribute(attributes, "dx")); curvedEdge.anchorDeltaY = parseInt(getAttribute(attributes, "dy")); DefineShape defineShape = (DefineShape) stack[stack.Count - 1]; defineShape.shapeWithStyle.shapeRecords.Add(curvedEdge); }
private int calcBits(CurvedEdgeRecord edge) { return SwfEncoder.minBits(SwfEncoder.maxNum(edge.controlDeltaX, edge.controlDeltaY, edge.anchorDeltaX, edge.anchorDeltaY), 1); }
/// <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)); } }