public override void Write(SwfWriter writer, SwfTagCode shapeType) { if (DeltaX == 0 && DeltaY == 0) { return; } writer.WriteBit(true); //edge flag writer.WriteBit(true); //strait flag if (DeltaX == 0) //vert { WriteCoord(writer, DeltaY, true); } else if (DeltaY == 0) //horz { WriteCoord(writer, DeltaX, false); } else { int x = DeltaX.ToTwips(); int y = DeltaY.ToTwips(); int bits = _bits; if (!_read) { bits = Math.Max(x.GetMinBits(y), 2); } writer.WriteUB((uint)(bits - 2), 4); writer.WriteBit(true); //gl writer.WriteSB(x, bits); writer.WriteSB(y, bits); } }
protected override void WriteData(SwfWriter writer) { Debug.Assert(SampleSize == 8 || SampleSize == 16); writer.WriteUB((uint)Format, 4); writer.WriteUB((uint)Rate, 2); writer.WriteBit(SampleSize == 16); writer.WriteBit(SoundType == FlvSoundType.Stereo); writer.Write(SoundData); }
public void Write(SwfWriter writer, SwfTagCode shapeType) { writer.WriteTwipU16(Width); if (shapeType == SwfTagCode.DefineMorphShape) { writer.WriteTwipU16(EndWidth); writer.WriteRGBA(Color); writer.WriteRGBA(EndColor); } else if (shapeType == SwfTagCode.DefineShape4 || shapeType == SwfTagCode.DefineMorphShape2) { bool isMorph = shapeType == SwfTagCode.DefineMorphShape2; if (isMorph) { writer.WriteTwipU16(EndWidth); } writer.WriteUB((uint)StartCapStyle, 2); writer.WriteUB((uint)JoinStyle, 2); writer.WriteBit(Fill != null); //hasFill writer.WriteBit((Flags & SwfLineFlags.NoHScale) != 0); writer.WriteBit((Flags & SwfLineFlags.NoVScale) != 0); writer.WriteBit((Flags & SwfLineFlags.PixelHinting) != 0); writer.WriteUB(0, 5); //reserved writer.WriteBit((Flags & SwfLineFlags.NoClose) != 0); writer.WriteUB((uint)EndCapStyle, 2); if (JoinStyle == SwfJoinStyle.Miter) { writer.WriteFixed16(MiterLimit); } if (Fill != null) { Fill.Write(writer, shapeType); } else { writer.WriteRGBA(Color); if (isMorph) { writer.WriteRGBA(EndColor); } } } else if (shapeType == SwfTagCode.DefineShape3) { writer.WriteRGBA(Color); } else { writer.WriteRGB(Color); } }
public override void Write(SwfWriter writer) { writer.WriteRGBA(Color); writer.WriteFixed32(BlurX); writer.WriteFixed32(BlurY); writer.WriteFixed16(Strength); writer.WriteBit(Inner); writer.WriteBit(Knockout); writer.WriteBit(CompositeSource); writer.WriteUB((uint)Passes, 5); }
private void WriteCoord(SwfWriter writer, float value, bool vl) { int v = value.ToTwips(); int bits = _bits; if (!_read) { bits = Math.Max(v.GetMinBits(), 2); } writer.WriteUB((uint)(bits - 2), 4); writer.WriteBit(false); //gl writer.WriteBit(vl); //vl writer.WriteSB(v, bits); }
public override void Write(SwfWriter writer) { writer.WriteRGBA(_shadowColor); writer.WriteRGBA(_highlightColor); writer.WriteFixed32(_blurX); writer.WriteFixed32(_blurY); writer.WriteFixed32(_angle); writer.WriteFixed32(_distance); writer.WriteFixed16(_strength); writer.WriteBit(_inner); writer.WriteBit(_knockout); writer.WriteBit(_compositeSource); writer.WriteBit(_onTop); writer.WriteUB((uint)_passes, 4); }
public override void Write(SwfWriter writer, SwfTagCode shapeType) { //auto detect state if (Styles != null) { //TODO: check shape type State |= SwfStyleState.HasNewStyles; } writer.WriteBit(false); //edge flag //writer.WriteBit((_state & SwfStyleState.HasNewStyles) != 0); //writer.WriteBit((_state & SwfStyleState.HasLineStyle) != 0); //writer.WriteBit((_state & SwfStyleState.HasFillStyle1) != 0); //writer.WriteBit((_state & SwfStyleState.HasFillStyle0) != 0); //writer.WriteBit((_state & SwfStyleState.HasMoveTo) != 0); writer.WriteUB((uint)State, 5); if ((State & SwfStyleState.HasMoveTo) != 0) { if (_read) { writer.WriteUB((uint)_bits, 5); writer.WriteTwip(DeltaX, _bits); writer.WriteTwip(DeltaY, _bits); } else { writer.WriteBitwiseTwipPoint(DeltaX, DeltaY, false); } } if ((State & SwfStyleState.HasFillStyle0) != 0) { writer.WriteFillStyle(FillStyle0); } if ((State & SwfStyleState.HasFillStyle1) != 0) { writer.WriteFillStyle(FillStyle1); } if ((State & SwfStyleState.HasLineStyle) != 0) { writer.WriteLineStyle(LineStyle); } if (Styles != null && (State & SwfStyleState.HasNewStyles) != 0) { Styles.Write(writer, shapeType); } }
public override void Write(SwfWriter writer, SwfTagCode shapeType) { writer.WriteBit(true); //edge flag writer.WriteBit(false); //strait flag int cx = ControlDeltaX.ToTwips(); int cy = ControlDeltaY.ToTwips(); int ax = AnchorDeltaX.ToTwips(); int ay = AnchorDeltaY.ToTwips(); int bits = _bits; if (!_read) { bits = Math.Max(cx.GetMinBits(cy, ax, ay), 2); } writer.WriteUB((uint)(bits - 2), 4); writer.WriteSB(cx, bits); writer.WriteSB(cy, bits); writer.WriteSB(ax, bits); writer.WriteSB(ay, bits); }
public override void Write(SwfWriter writer, SwfTagCode shapeType) { writer.WriteBit(false); //TypeFlag writer.WriteBit(false); //StateNewStyles writer.WriteBit(false); //StateLineStyle writer.WriteBit(false); //StateFillStyle1 writer.WriteBit(false); //StateFillStyle0 writer.WriteBit(true); //StateMoveTo int dx = _dx.ToTwips(); int dy = _dy.ToTwips(); int bits = dx.GetMinBits(dy); writer.WriteUB((uint)bits, 5); writer.WriteSB(dx, bits); writer.WriteSB(dy, bits); }