public FillStyleRGBA Read(ISwfStreamReader reader, FillStyleType type) { var fillStyle = _factory.CreateRGBA(type); fillStyle.AcceptVisitor(this, reader); return(fillStyle); }
private static string GetNodeName(FillStyleType type) { switch (type) { case FillStyleType.RepeatingBitmap: return(REPEATING_BITMAP); case FillStyleType.ClippedBitmap: return(CLIPPED_BITMAP); case FillStyleType.NonSmoothedRepeatingBitmap: return(NON_SMOOTHED_REPEATING_BITMAP); case FillStyleType.NonSmoothedClippedBitmap: return(NON_SMOOTHED_CLIPPED_BITMAP); default: throw new NotSupportedException(); } }
public FillStyleRGBA CreateRGBA(FillStyleType type) { switch (type) { case FillStyleType.SolidColor: return(new SolidFillStyleRGBA()); case FillStyleType.LinearGradient: return(new LinearGradientFillStyleRGBA()); case FillStyleType.RadialGradient: return(new RadialGradientFillStyleRGBA()); case FillStyleType.FocalGradient: return(new FocalGradientFillStyleRGBA()); case FillStyleType.RepeatingBitmap: return(new BitmapFillStyleRGBA { Smoothing = true, Mode = BitmapMode.Repeat }); case FillStyleType.ClippedBitmap: return(new BitmapFillStyleRGBA { Smoothing = true, Mode = BitmapMode.Clip }); case FillStyleType.NonSmoothedRepeatingBitmap: return(new BitmapFillStyleRGBA { Smoothing = false, Mode = BitmapMode.Repeat }); case FillStyleType.NonSmoothedClippedBitmap: return(new BitmapFillStyleRGBA { Smoothing = false, Mode = BitmapMode.Clip }); default: throw new NotSupportedException(); } }
public FillStyleRGB CreateRGB(FillStyleType type) { switch (type) { case FillStyleType.SolidColor: return new SolidFillStyleRGB(); case FillStyleType.LinearGradient: return new LinearGradientFillStyleRGB(); case FillStyleType.RadialGradient: return new RadialGradientFillStyleRGB(); case FillStyleType.FocalGradient: return new FocalGradientFillStyleRGB(); case FillStyleType.RepeatingBitmap: return new BitmapFillStyleRGB { Smoothing = true, Mode = BitmapMode.Repeat}; case FillStyleType.ClippedBitmap: return new BitmapFillStyleRGB { Smoothing = true, Mode = BitmapMode.Clip}; case FillStyleType.NonSmoothedRepeatingBitmap: return new BitmapFillStyleRGB { Smoothing = false, Mode = BitmapMode.Repeat }; case FillStyleType.NonSmoothedClippedBitmap: return new BitmapFillStyleRGB { Smoothing = false, Mode = BitmapMode.Clip}; default: throw new NotSupportedException(); } }
private static string GetNodeName(FillStyleType type) { switch (type) { case FillStyleType.RepeatingBitmap: return REPEATING_BITMAP; case FillStyleType.ClippedBitmap: return CLIPPED_BITMAP; case FillStyleType.NonSmoothedRepeatingBitmap: return NON_SMOOTHED_REPEATING_BITMAP; case FillStyleType.NonSmoothedClippedBitmap: return NON_SMOOTHED_CLIPPED_BITMAP; default: throw new NotSupportedException(); } }
public FillStyle(Character ImageFill, BitmapFill bitmapFill) { this._ImageFill = ImageFill; this._Type = (FillStyleType) bitmapFill; }
public FillStyle(Gradient FillGradient) { this._Gradient = FillGradient; this._Type = (FillStyleType) FillGradient.Type; }
public FillStyle(RGB SolidFillColor) { this._SolidColor = SolidFillColor; this._Type = FillStyleType.Solid; }
/// <summary> /// Creates a new <see cref="GradientFill"/> instance. /// </summary> /// <param name="fillStyleType">Fill style type.</param> /// <param name="gradientTransform">Gradient transform.</param> /// <param name="gradients">Gradients.</param> public GradientFill(FillStyleType fillStyleType, Matrix gradientTransform, GradientRecordCollection gradients) { this.gradientMatrix = gradientTransform; this.gradient = gradients; this.fillStyleType = (byte)fillStyleType; }
/// <summary> /// Creates a new <see cref="GradientFill"/> instance. /// </summary> public GradientFill(FillStyleType fillStyleType) { this.fillStyleType = (byte)fillStyleType; }
public FillStyle(Character ImageFill, BitmapFill bitmapFill) { this._ImageFill = ImageFill; this._Type = (FillStyleType)bitmapFill; }
public FillStyle(Gradient FillGradient) { this._Gradient = FillGradient; this._Type = (FillStyleType)FillGradient.Type; }
/// <summary> /// Creates a new <see cref="BitmapFill"/> instance. /// </summary> /// <param name="fillStyleType">Fill style type.</param> /// <param name="bitmapId">Bitmap id.</param> /// <param name="bitmapTransform">Bitmap transform.</param> public BitmapFill(FillStyleType fillStyleType, ushort bitmapId, Matrix bitmapTransform) { this.fillStyleType = (byte)fillStyleType; this.bitmapId = bitmapId; this.bitmapMatrix = bitmapTransform; }
/// <summary> /// Creates a new <see cref="BitmapFill"/> instance. /// </summary> /// <param name="fillStyleType">Fill style type.</param> public BitmapFill(FillStyleType fillStyleType) { this.fillStyleType = (byte)fillStyleType; }
/// <summary> /// /// </summary> /// <param name="input"></param> /// <param name="caller"></param> public void Parse(Stream input, TagTypes caller) { BinaryReader br = new BinaryReader(input); this._caller = caller; this._fillStyleType = (FillStyleType)br.ReadByte(); if (this._fillStyleType.Equals(FillStyleType.SolidFill)) { if (caller.Equals(TagTypes.DefineShape3) ) { this._color = new Rgba(this._SwfVersion); try { this._color.Parse(input); //Log.InfoFormat("Valid fill style type. FillstyleType: 0x{0:X2} at address: 0x{1:X2} in {2}", (Int32)this._fillStyleType, ((Int32)input.Position) - 1, caller); } catch (SwfFormatException e) { throw e; } } else if (caller.Equals(TagTypes.DefineShape4)) { this._color = new Rgba(this._SwfVersion); try { this._color.Parse(input); } catch (SwfFormatException e) { throw e; } } else { this._color = new Rgb(this._SwfVersion); try { this._color.Parse(input); } catch (SwfFormatException e) { throw e; } } } else if (this._fillStyleType.Equals(FillStyleType.LinearGradientFill) || this._fillStyleType.Equals(FillStyleType.RadialGradientFill)) { this._gradientMatrix = new Matrix(this._SwfVersion); try { this._gradientMatrix.Parse(input); } catch (SwfFormatException e) { throw e; } this._gradient = new Gradient(this._SwfVersion); try { this._gradient.Parse(input, caller); //Log.InfoFormat("Valid fill style type. FillstyleType: 0x{0:X2} at address: 0x{1:X4} in {2}", (Int32)this._fillStyleType, ((Int32)input.Position) - 1, caller); } catch (SwfFormatException e) { throw e; } } else if (this._fillStyleType.Equals(FillStyleType.FocalRadialGradientFill)) { if (this._SwfVersion >= 8) { this._gradientMatrix = new Matrix(this._SwfVersion); try { this._gradientMatrix.Parse(input); } catch(SwfFormatException e) { throw e; } this._gradient = new FocalGradient(this._SwfVersion); try { this._gradient.Parse(input, caller); //Log.InfoFormat("Valid fill style type. FillstyleType: 0x{0:X2} at address: 0x{1:X4} in {2}", (Int32)this._fillStyleType, ((Int32)input.Position) - 1, caller); } catch (SwfFormatException e) { throw e; } } else { SwfFormatException e = new SwfFormatException("Focal gradients are supported by Swf 8 and later only. This version is: " + this._SwfVersion.ToString()); Log.Error(this, e); } } else if (this._fillStyleType.Equals(FillStyleType.RepeatingBitmapFill) || this._fillStyleType.Equals(FillStyleType.ClippedBitmapFill) || this._fillStyleType.Equals(FillStyleType.NonSmoothedRepeatingBitmap) || this._fillStyleType.Equals(FillStyleType.NonSmoothedClippedBitmap)) { this._bitmapID = br.ReadUInt16(); this._bitmapMatrix = new Matrix(this._SwfVersion); try { this._bitmapMatrix.Parse(input); //Log.InfoFormat("Valid fill style type. FillstyleType: 0x{0:X2} at address: 0x{1:X4} in {2}", (Int32)this._fillStyleType, ((Int32)input.Position) - 1, caller); } catch (SwfFormatException e) { throw e; } } else { SwfFormatException e = new SwfFormatException("Invalid fill style type! (" + this._fillStyleType +")" +" caller: " + caller.ToString()); Log.Error(this, e); throw e; } }