Beispiel #1
0
 public void Write(dword value)
 {
     _data.Add((byte)(value >> 24));
     _data.Add((byte)(value >> 16));
     _data.Add((byte)(value >> 8));
     _data.Add((byte)value);
     Position += 4;
 }
Beispiel #2
0
        public void Replace(int offset, dword value)
        {
            if (offset + 4 > Size)
            {
                throw new IndexOutOfRangeException("Index was outside the data writer size.");
            }

            _data[offset + 0] = (byte)(value >> 24);
            _data[offset + 1] = (byte)(value >> 16);
            _data[offset + 2] = (byte)(value >> 8);
            _data[offset + 3] = (byte)value;
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="sPixel"/> struct by deserializing it.
 /// </summary>
 /// <param name="serializationInfo">The serialization info.</param>
 /// <param name="_">The streaming context.</param>
 public sPixel(SerializationInfo serializationInfo, StreamingContext _)
 {
     this._rgbBytes = (dword)serializationInfo.GetValue("value", typeof(dword));
 }
Beispiel #4
0
 /// <summary>
 /// Prevents a default instance of the <see cref="sPixel"/> struct from being created.
 /// </summary>
 /// <param name="rgbData">The RGB data.</param>
 private sPixel(dword rgbData)
 {
     this._rgbBytes = rgbData;
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="sPixel"/> struct by using red, green and blue component.
 /// </summary>
 /// <param name="red">The red-value.</param>
 /// <param name="green">The green-value.</param>
 /// <param name="blue">The blue-value.</param>
 /// <param name="alpha">The alpha-value.</param>
 public sPixel(byte red, byte green, byte blue, byte alpha = 255)
 {
     this._rgbBytes = (uint)alpha << 24 | (uint)red << 16 | (uint)green << 8 | blue;
 }