コード例 #1
0
        /// <summary> Constructor. Creates an empty Flash Shape. <code>ShapeRecord</code>s can be added
        /// manually using the process shape method.
        ///
        /// </summary>
        /// <param name="origin">the pen starting point, typically [0.0,0.0]
        /// </param>
        /// <seealso cref="processShape(ShapeIterator)">
        /// </seealso>
        public ShapeBuilder(Point origin)
        {
            shape = new Shape();
            shape.shapeRecords = new System.Collections.ArrayList();             //shape record buffer

            if (origin == null)
            {
                origin = new Point();
            }

            this.start      = new Point(origin.x, origin.y);
            this.lastMoveTo = new Point(origin.x, origin.y);
            this.pen        = new Point(this.lastMoveTo.x, this.lastMoveTo.y);
        }
コード例 #2
0
		public virtual void  encodeShape(Shape s, SwfEncoder w, int shape, int nFillStyles, int nLineStyles)
		{
			int[] numFillBits = new int[]{SwfEncoder.minBits(nFillStyles, 0)};
			int[] numLineBits = new int[]{SwfEncoder.minBits(nLineStyles, 0)};
			
			w.writeUBits(numFillBits[0], 4);
			w.writeUBits(numLineBits[0], 4);
			
			System.Collections.IEnumerator it = s.shapeRecords.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 record = (ShapeRecord) it.Current;
				if (record is StyleChangeRecord)
				{
					// style change
					w.writeBit(false);
					StyleChangeRecord change = (StyleChangeRecord) record;
					encodeStyleChangeRecord(w, change, numFillBits, numLineBits, shape);
				}
				else
				{
					// edge
					w.writeBit(true);
					EdgeRecord e = (EdgeRecord) record;
					bool straight = e is StraightEdgeRecord;
					w.writeBit(straight);
					int nbits = straight?calcBits((StraightEdgeRecord) e):calcBits((CurvedEdgeRecord) e);
					if (nbits < 2)
						nbits = 2;
					w.writeUBits(nbits - 2, 4);
					if (straight)
					{
						// line
						StraightEdgeRecord line = (StraightEdgeRecord) e;
						encodeStraightEdgeRecord(line, w, nbits);
					}
					else
					{
						// curve
						CurvedEdgeRecord curve = (CurvedEdgeRecord) e;
						w.writeSBits(curve.controlDeltaX, nbits);
						w.writeSBits(curve.controlDeltaY, nbits);
						w.writeSBits(curve.anchorDeltaX, nbits);
						w.writeSBits(curve.anchorDeltaY, nbits);
					}
				}
			}
			
			// endshaperecord
			w.writeUBits(0, 6);
			
			w.flushBits();
		}
コード例 #3
0
		private void  printShapeWithTabs(Shape shapes)
		{
			System.Collections.IEnumerator it = shapes.shapeRecords.GetEnumerator();
			int startX = 0;
			int startY = 0;
			
			int x = 0;
			int y = 0;
			
			//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())
			{
				indent();
				//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 shape = (ShapeRecord) it.Current;
				if (shape is StyleChangeRecord)
				{
					StyleChangeRecord styleChange = (StyleChangeRecord) shape;
					out_Renamed.Write("SSCR" + styleChange.nMoveBits() + "\t");
					if (styleChange.stateMoveTo)
					{
						out_Renamed.Write(styleChange.moveDeltaX + "\t" + styleChange.moveDeltaY);
						
						if (startX == 0 && startY == 0)
						{
							startX = styleChange.moveDeltaX;
							startY = styleChange.moveDeltaY;
						}
						
						x = styleChange.moveDeltaX;
						y = styleChange.moveDeltaY;
						
						out_Renamed.Write("\t\t");
					}
				}
				else
				{
					EdgeRecord edge = (EdgeRecord) shape;
					if (edge is StraightEdgeRecord)
					{
						StraightEdgeRecord straightEdge = (StraightEdgeRecord) edge;
						out_Renamed.Write("SER" + "\t");
						out_Renamed.Write(straightEdge.deltaX + "\t" + straightEdge.deltaY);
						x += straightEdge.deltaX;
						y += straightEdge.deltaY;
						out_Renamed.Write("\t\t");
					}
					else
					{
						CurvedEdgeRecord curvedEdge = (CurvedEdgeRecord) edge;
						out_Renamed.Write("CER" + "\t");
						out_Renamed.Write(curvedEdge.controlDeltaX + "\t" + curvedEdge.controlDeltaY + "\t");
						out_Renamed.Write(curvedEdge.anchorDeltaX + "\t" + curvedEdge.anchorDeltaY);
						x += (curvedEdge.controlDeltaX + curvedEdge.anchorDeltaX);
						y += (curvedEdge.controlDeltaY + curvedEdge.anchorDeltaY);
					}
				}
				
				//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
				out_Renamed.WriteLine("\t\t" + x + "\t" + y);
			}
		}
コード例 #4
0
		/// <summary> Constructor. Creates an empty Flash Shape. <code>ShapeRecord</code>s can be added
		/// manually using the process shape method.
		/// 
		/// </summary>
		/// <param name="origin">the pen starting point, typically [0.0,0.0]
		/// </param>
		/// <seealso cref="processShape(ShapeIterator)">
		/// </seealso>
		public ShapeBuilder(Point origin)
		{
			shape = new Shape();
			shape.shapeRecords = new System.Collections.ArrayList(); //shape record buffer
			
			if (origin == null)
				origin = new Point();
			
			this.start = new Point(origin.x, origin.y);
			this.lastMoveTo = new Point(origin.x, origin.y);
			this.pen = new Point(this.lastMoveTo.x, this.lastMoveTo.y);
		}
コード例 #5
0
		private void  printShape(Shape shapes, bool alpha)
		{
			System.Collections.IEnumerator it = shapes.shapeRecords.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())
			{
				indent();
				//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 shape = (ShapeRecord) it.Current;
				if (shape is StyleChangeRecord)
				{
					StyleChangeRecord styleChange = (StyleChangeRecord) shape;
					out_Renamed.Write("<styleChange ");
					if (styleChange.stateMoveTo)
					{
						out_Renamed.Write("dx='" + styleChange.moveDeltaX + "' dy='" + styleChange.moveDeltaY + "' ");
					}
					if (styleChange.stateFillStyle0)
					{
						out_Renamed.Write("fillStyle0='" + styleChange.fillstyle0 + "' ");
					}
					if (styleChange.stateFillStyle1)
					{
						out_Renamed.Write("fillStyle1='" + styleChange.fillstyle1 + "' ");
					}
					if (styleChange.stateLineStyle)
					{
						out_Renamed.Write("lineStyle='" + styleChange.linestyle + "' ");
					}
					if (styleChange.stateNewStyles)
					{
						//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
						out_Renamed.WriteLine(">");
						indent_Renamed_Field++;
						printFillStyles(styleChange.fillstyles, alpha);
						printLineStyles(styleChange.linestyles, alpha);
						indent_Renamed_Field--;
						indent();
						//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
						out_Renamed.WriteLine("</styleChange>");
					}
					else
					{
						//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
						out_Renamed.WriteLine("/>");
					}
				}
				else
				{
					EdgeRecord edge = (EdgeRecord) shape;
					if (edge is StraightEdgeRecord)
					{
						StraightEdgeRecord straightEdge = (StraightEdgeRecord) edge;
						//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
						out_Renamed.WriteLine("<line dx='" + straightEdge.deltaX + "' dy='" + straightEdge.deltaY + "' />");
					}
					else
					{
						CurvedEdgeRecord curvedEdge = (CurvedEdgeRecord) edge;
						out_Renamed.Write("<curve ");
						out_Renamed.Write("cdx='" + curvedEdge.controlDeltaX + "' cdy='" + curvedEdge.controlDeltaY + "' ");
						out_Renamed.Write("dx='" + curvedEdge.anchorDeltaX + "' dy='" + curvedEdge.anchorDeltaY + "' ");
						//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
						out_Renamed.WriteLine("/>");
					}
				}
			}
		}