Пример #1
0
        /// <summary>Initializes a new instance of the <see cref="SlcWithColorIndex"/> class.</summary>
        /// <param name="type">The type.</param>
        /// <param name="colorIndex">Index of the color.</param>
        /// <exception cref="NotSupportedException"></exception>
        public SlcWithColorIndex(SynchronizedLyricsCommandType type, byte colorIndex)
            : base(type)
        {
            switch (type)
            {
            case SynchronizedLyricsCommandType.SetTransparentColor:
            case SynchronizedLyricsCommandType.ClearScreen: break;

            default: throw new NotSupportedException();
            }
            ColorIndex = colorIndex;
        }
Пример #2
0
        /// <summary>Initializes a new instance of the <see cref="SlcSetSprite2Colors"/> class.</summary>
        /// <param name="type">The type.</param>
        /// <param name="reader">The reader.</param>
        /// <exception cref="NotSupportedException"></exception>
        public SlcSetSprite2Colors(SynchronizedLyricsCommandType type, DataReader reader)
            : base(type)
        {
            switch (type)
            {
            case SynchronizedLyricsCommandType.SetSprite2Colors:
            case SynchronizedLyricsCommandType.SetSprite2ColorsXOR: break;

            default: throw new NotSupportedException();
            }
            Width    = reader.Read7BitEncodedInt32();
            Height   = reader.Read7BitEncodedInt32();
            X        = reader.Read7BitEncodedInt32();
            Y        = reader.Read7BitEncodedInt32();
            Color0   = reader.ReadByte();
            Color1   = reader.ReadByte();
            BitArray = reader.ReadBytes((Width + 7) / 8 * Height);
        }
Пример #3
0
        void ParseTileBlock(SynchronizedLyricsItemBuilder sl, CdgPacket packet, bool xor)
        {
            byte color0 = (byte)(packet.Data[0] & 0x0F);
            byte color1 = (byte)(packet.Data[1] & 0x0F);
            int  y      = (packet.Data[2] & 0x1F) * 12;
            int  x      = (packet.Data[3] & 0x3F) * 6;
            int  w      = 6;
            int  h      = 12;

            if (x + w > BufferWidth || y + h > BufferHeight)
            {
                Trace.TraceError(string.Format("Subchannel decode error x={0} y={1}", x, y));
                return;
            }
            byte[] data = new byte[12];
            Array.Copy(packet.Data, 4, data, 0, 12);
            SynchronizedLyricsCommandType cmd = xor ? SynchronizedLyricsCommandType.SetSprite2ColorsXOR : SynchronizedLyricsCommandType.SetSprite2Colors;

            sl.Commands.Add(new SlcSetSprite2Colors(cmd, w, h, x, y, color0, color1, data));
        }
Пример #4
0
        /// <summary>Initializes a new instance of the <see cref="SlcSetSprite2Colors"/> class.</summary>
        /// <param name="type">The type.</param>
        /// <param name="w">The width.</param>
        /// <param name="h">The height.</param>
        /// <param name="x">The x position.</param>
        /// <param name="y">The y position.</param>
        /// <param name="color0">The color0.</param>
        /// <param name="color1">The color1.</param>
        /// <param name="data">The data.</param>
        /// <exception cref="NotSupportedException"></exception>
        /// <exception cref="Exception">Data length invalid!.</exception>
        public SlcSetSprite2Colors(SynchronizedLyricsCommandType type, int w, int h, int x, int y, byte color0, byte color1, byte[] data)
            : base(type)
        {
            switch (type)
            {
            case SynchronizedLyricsCommandType.SetSprite2Colors:
            case SynchronizedLyricsCommandType.SetSprite2ColorsXOR: break;

            default: throw new NotSupportedException();
            }
            if (data.Length != (w + 7) / 8 * h)
            {
                throw new Exception("Data length invalid!");
            }

            Width    = w;
            Height   = h;
            X        = x;
            Y        = y;
            Color0   = color0;
            Color1   = color1;
            BitArray = data;
        }
 /// <summary>Initializes a new instance of the <see cref="SynchronizedLyricsCommand"/> class.</summary>
 /// <param name="type">The type.</param>
 protected SynchronizedLyricsCommand(SynchronizedLyricsCommandType type)
 {
     Type = type;
 }
Пример #6
0
 /// <summary>Initializes a new instance of the <see cref="SlcWithColorIndex"/> class.</summary>
 /// <param name="type">The type.</param>
 /// <param name="reader">The reader.</param>
 public SlcWithColorIndex(SynchronizedLyricsCommandType type, DataReader reader)
     : base(type)
 {
     ColorIndex = reader.ReadByte();
 }