public static DefineSprite buildSprite(System.String name, JPEGImage image) { TagList taglist = new TagList(); try { DefineBits defineBits = build(image); taglist.defineBitsJPEG2(defineBits); DefineShape ds3 = ImageShapeBuilder.buildImage(defineBits, image.Width, image.Height); taglist.defineShape3(ds3); PlaceObject po2 = new PlaceObject(ds3, 1); po2.Matrix = new Matrix(); // po2.setName(name); taglist.placeObject2(po2); } catch (System.IO.IOException ex) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" throw new System.SystemException("Error reading JPEG image " + image.Location + ". " + ex.Message); } finally { image.dispose(); } return(defineSprite(name, taglist)); }
public static DefineShape buildImage(DefineBits tag, int width, int height) { // Create Fill Style Matrix matrix = new Matrix(); //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'" matrix.scaleX = (int)System.Math.Round((double)(flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL * flash.swf.SwfConstants_Fields.FIXED_POINT_MULTIPLE)); //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'" matrix.scaleY = (int)System.Math.Round((double)(flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL * flash.swf.SwfConstants_Fields.FIXED_POINT_MULTIPLE)); matrix.hasScale = true; //Apply runtime scale of 20 (for twips) FillStyle fs = new FillStyle(FillStyle.FILL_BITS | FillStyle.FILL_BITS_CLIP, matrix, tag); // Apply Fill Styles ShapeWithStyle sws = new ShapeWithStyle(); sws.fillstyles = new System.Collections.ArrayList(); //UPGRADE_TODO: The equivalent in .NET for method 'java.util.ArrayList.add' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" int fsIndex = sws.fillstyles.Add(fs) >= 0?sws.fillstyles.LastIndexOf(fs) + 1:0; sws.linestyles = new System.Collections.ArrayList(); // Build Raw SWF Shape ShapeBuilder builder = new ShapeBuilder(new Point()); builder.UseFillStyle0 = true; builder.CurrentFillStyle0 = fsIndex; builder.move(0, 0); builder.straight(width, 0); builder.straight(width, height); builder.straight(0, height); builder.straight(0, 0); builder.correctRoundingErrors(); sws.shapeRecords = builder.build().shapeRecords; // Wrap up into a SWF DefineShape Tag DefineShape defineShape = new DefineShape(flash.swf.TagValues_Fields.stagDefineShape3); defineShape.bounds = new Rect(width * flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL, height * flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL); defineShape.shapeWithStyle = sws; return(defineShape); }
public static DefineTag buildSprite(System.String name, LosslessImage image) { TagList taglist = new TagList(); DefineBitsLossless defineBits = build(image); taglist.defineBitsLossless2(defineBits); DefineShape ds3 = ImageShapeBuilder.buildImage(defineBits, defineBits.width, defineBits.height); taglist.defineShape3(ds3); PlaceObject po2 = new PlaceObject(ds3, 1); po2.Matrix = new Matrix(); //Ahipo2.setName(name); taglist.placeObject2(po2); return(defineSprite(name, taglist)); }
public static DefineShape buildImage(DefineBits tag, int width, int height) { // Create Fill Style Matrix matrix = new Matrix(); //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'" matrix.scaleX = (int) System.Math.Round((double) (flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL * flash.swf.SwfConstants_Fields.FIXED_POINT_MULTIPLE)); //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'" matrix.scaleY = (int) System.Math.Round((double) (flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL * flash.swf.SwfConstants_Fields.FIXED_POINT_MULTIPLE)); matrix.hasScale = true; //Apply runtime scale of 20 (for twips) FillStyle fs = new FillStyle(FillStyle.FILL_BITS | FillStyle.FILL_BITS_CLIP, matrix, tag); // Apply Fill Styles ShapeWithStyle sws = new ShapeWithStyle(); sws.fillstyles = new System.Collections.ArrayList(); //UPGRADE_TODO: The equivalent in .NET for method 'java.util.ArrayList.add' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" int fsIndex = sws.fillstyles.Add(fs) >= 0?sws.fillstyles.LastIndexOf(fs) + 1:0; sws.linestyles = new System.Collections.ArrayList(); // Build Raw SWF Shape ShapeBuilder builder = new ShapeBuilder(new Point()); builder.UseFillStyle0 = true; builder.CurrentFillStyle0 = fsIndex; builder.move(0, 0); builder.straight(width, 0); builder.straight(width, height); builder.straight(0, height); builder.straight(0, 0); builder.correctRoundingErrors(); sws.shapeRecords = builder.build().shapeRecords; // Wrap up into a SWF DefineShape Tag DefineShape defineShape = new DefineShape(flash.swf.TagValues_Fields.stagDefineShape3); defineShape.bounds = new Rect(width * flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL, height * flash.swf.SwfConstants_Fields.TWIPS_PER_PIXEL); defineShape.shapeWithStyle = sws; return defineShape; }
public virtual void DefineShape3(SaxAttributesSupport attributes) { DefineShape tag = new DefineShape(flash.swf.TagValues_Fields.stagDefineShape3); int id = parseInt(getAttribute(attributes, "id")); createCharacter(id, tag); tag.bounds = parseRect(getAttribute(attributes, "bounds")); tag.shapeWithStyle = new ShapeWithStyle(); tag.shapeWithStyle.fillstyles = new System.Collections.ArrayList(); tag.shapeWithStyle.linestyles = new System.Collections.ArrayList(); tag.shapeWithStyle.shapeRecords = new System.Collections.ArrayList(); stack.Add(tag); fillstyles = tag.shapeWithStyle.fillstyles; linestyles = tag.shapeWithStyle.linestyles; }
private DefineShapeBuilder() { tag = new DefineShape(flash.swf.TagValues_Fields.stagDefineShape3); }