private void ParseBitmapFill(BitmapFill tag) { if (rects.ContainsKey(tag.CharacterId)) { System.Drawing.Rectangle r = rects[tag.CharacterId]; tag.CharacterId = fullBitmapId;//bitmap id tag.Matrix.TranslateX = r.Left * twips; // x offset tag.Matrix.TranslateY = r.Top * twips; // y offset } else { Console.WriteLine("not found: " + tag.CharacterId); } }
public static IFillStyle ParseFillStyle2(SwfReader r, ShapeType shapeType) { IFillStyle result = null; FillType fsType = (FillType)r.GetByte(); bool useAlpha = shapeType > ShapeType.DefineShape2; switch (fsType) { case FillType.Solid: result = new SolidFill(r, useAlpha); break; case FillType.Linear: result = new Gradient(r, fsType, useAlpha); break; case FillType.Radial: result = new Gradient(r, fsType, useAlpha); break; case FillType.Focal: result = null; //throw new NotSupportedException("Currently FillType.Focal is not supported"); break; case FillType.RepeatingBitmap: case FillType.ClippedBitmap: case FillType.NSRepeatingBitmap: case FillType.NSClippedBitmap: uint charId = r.GetUI16(); Matrix bmpMatrix = new Matrix(r); result = new BitmapFill(charId, bmpMatrix, fsType); break; } return(result); }
public static IFillStyle ParseFillStyle2(SwfReader r, ShapeType shapeType) { IFillStyle result = null; FillType fsType = (FillType)r.GetByte(); bool useAlpha = shapeType > ShapeType.DefineShape2; switch (fsType) { case FillType.Solid: result = new SolidFill(r, useAlpha); break; case FillType.Linear: result = new Gradient(r, fsType, useAlpha); break; case FillType.Radial: result = new Gradient(r, fsType, useAlpha); break; case FillType.Focal: result = null; //throw new NotSupportedException("Currently FillType.Focal is not supported"); break; case FillType.RepeatingBitmap: case FillType.ClippedBitmap: case FillType.NSRepeatingBitmap: case FillType.NSClippedBitmap: uint charId = r.GetUI16(); Matrix bmpMatrix = new Matrix(r); result = new BitmapFill(charId, bmpMatrix, fsType); break; } return result; }
private DDW.Vex.ImageFill ParseBitmapFill(BitmapFill tag) { DDW.Vex.ImageFill bf = new DDW.Vex.ImageFill(); bf.ImagePath = bitmapPaths.ContainsKey(tag.CharacterId) ? bitmapPaths[tag.CharacterId] : ""; Swf.Matrix sm = Utils.ScaleBitmapMatrix(tag.Matrix); bf.Matrix = new DDW.Vex.Matrix( sm.ScaleX, sm.Rotate0, sm.Rotate1, sm.ScaleY, (sm.TranslateX / twips), (sm.TranslateY / twips)); switch (tag.FillType) { case FillType.ClippedBitmap: bf.IsSmooth = true; bf.IsTiled = false; break; case FillType.RepeatingBitmap: bf.IsSmooth = true; bf.IsTiled = true; break; case FillType.NSClippedBitmap: bf.IsSmooth = false; bf.IsTiled = false; break; case FillType.NSRepeatingBitmap: bf.IsSmooth = false; bf.IsTiled = true; break; } return bf; }