public ButtonRecord(SwfStream stream, Type defButtonType, out bool ok) { mFlags = stream.ReadByte(); ok = (mFlags != 0); if (!ok) return; bool hasBlend = (mFlags & 0x20) != 0; bool hasFilters = (mFlags & 0x10) != 0; CharacterID = stream.ReadUShort(); CharacterDepth = stream.ReadUShort(); CharacterMatrix = stream.ReadMatrix(); if (defButtonType == typeof(Tags.DefineButton2Tag)) { CxForm = stream.ReadCxForm(true); Filters = hasFilters ? Filter.ReadFilterList(stream) : new Filter[0]; Blending = hasBlend ? (BlendMode)stream.ReadByte() : BlendMode.Normal; } else { CxForm = VGCxForm.Identity; Filters = new Filter[0]; Blending = BlendMode.Normal; } }
public static Filter[] ReadFilterList(SwfStream stream) { byte count = stream.ReadByte(); var filters = new Filter[count]; for (; count > 0; count--) filters[filters.Length - count] = Read(stream); return filters; }