Ejemplo n.º 1
0
        /// <summary>
        /// Function to read the brush elements in from a chunked file.
        /// </summary>
        /// <param name="chunk">Chunk reader used to read the data.</param>
        internal override void Read(GorgonChunkReader chunk)
        {
            Points.Clear();
            BlendPositions.Clear();
            BlendFactors.Clear();
            Interpolation.Clear();
            SurroundColors.Clear();

            WrapMode = chunk.Read <WrapMode>();
            int counter = chunk.ReadInt32();

            for (int i = 0; i < counter; i++)
            {
                Points.Add(chunk.Read <Vector2>());
            }

            counter = chunk.ReadInt32();

            for (int i = 0; i < counter; i++)
            {
                BlendFactors.Add(chunk.ReadFloat());
            }

            counter = chunk.ReadInt32();

            for (int i = 0; i < counter; i++)
            {
                BlendPositions.Add(chunk.ReadFloat());
            }

            CenterColor = chunk.Read <GorgonColor>();
            CenterPoint = chunk.Read <Vector2>();
            FocusScales = chunk.Read <Vector2>();

            counter = chunk.ReadInt32();

            for (int i = 0; i < counter; i++)
            {
                Interpolation.Add(new GorgonGlyphBrushInterpolator(chunk));
            }

            counter = chunk.ReadInt32();

            for (int i = 0; i < counter; i++)
            {
                SurroundColors.Add(chunk.Read <GorgonColor>());
            }
        }
Ejemplo n.º 2
0
        /// <summary>Function to read back the specifics of the font brush data from a file reader.</summary>
        /// <param name="reader">The reader used to read the brush data.</param>
        internal override void ReadBrushData(GorgonBinaryReader reader)
        {
            WrapMode = (GlyphBrushWrapMode)reader.ReadInt32();
            int count = reader.ReadInt32();

            Points.Clear();
            for (int i = 0; i < count; ++i)
            {
                Points.Add(reader.ReadValue <DX.Vector2>());
            }

            BlendFactors.Clear();
            count = reader.ReadInt32();
            for (int i = 0; i < count; ++i)
            {
                BlendFactors.Add(reader.ReadSingle());
            }

            BlendPositions.Clear();
            count = reader.ReadInt32();
            for (int i = 0; i < count; ++i)
            {
                BlendPositions.Add(reader.ReadSingle());
            }

            CenterColor = new GorgonColor(reader.ReadInt32());
            CenterPoint = reader.ReadValue <DX.Vector2>();
            FocusScales = reader.ReadValue <DX.Vector2>();

            count = reader.ReadInt32();
            Interpolation.Clear();

            for (int i = 0; i < count; ++i)
            {
                Interpolation.Add(new GorgonGlyphBrushInterpolator(reader.ReadSingle(), new GorgonColor(reader.ReadInt32())));
            }

            count = reader.ReadInt32();
            SurroundColors.Clear();

            for (int i = 0; i < count; ++i)
            {
                SurroundColors.Add(new GorgonColor(reader.ReadInt32()));
            }
        }