예제 #1
0
파일: Pltt.cs 프로젝트: MikeG621/LfdReader
 /// <summary>Blank constructor</summary>
 /// <remarks>Defaults to a single color, set to <see cref="Color.Black"/>. Unused colors are initialized to <see cref="Color.Transparent"/>.</remarks>
 public Pltt()
 {
     _type = ResourceType.Pltt;
     _entries[0] = Color.Black;
     for (int i = 1; i < 256; i++) _entries[i] = Color.Transparent;
     _colorIndexer = new ColorIndexer(this);
 }
예제 #2
0
파일: Pltt.cs 프로젝트: gtraines/LfdReader
        /// <summary>Processes raw data to populate the resource</summary>
        /// <param name="raw">Raw byte data</param>
        /// <param name="containsHeader">Whether or not <i>raw</i> contains the resource Header information</param>
        /// <exception cref="ArgumentException">Header-defined <see cref="Type"/> is not <see cref="Resource.ResourceType.Pltt"/></exception>
        /// <remarks>Unused entries are initialized to <see cref="Color.Transparent"/>.</remarks>
        public override void DecodeResource(byte[] raw, bool containsHeader)
        {
            _decodeResource(raw, containsHeader);
            if (_type != ResourceType.Pltt)
            {
                throw new ArgumentException("Raw header is not for a Pltt resource");
            }
            int offset = 0;

            _startIndex = _rawData[offset++];
            _endIndex   = _rawData[offset++];
            for (int i = 0; i < _startIndex; i++)
            {
                _entries[i] = Color.Transparent;
            }
            for (int i = _startIndex; i <= _endIndex; i++, offset += 3)
            {
                _entries[i] = Color.FromArgb(_rawData[offset], _rawData[offset + 1], _rawData[offset + 2]);
            }
            for (int i = _endIndex + 1; i < 256; i++)
            {
                _entries[i] = Color.Transparent;
            }
            _colorIndexer = new ColorIndexer(this);
        }
예제 #3
0
파일: Pltt.cs 프로젝트: gtraines/LfdReader
 /// <summary>Blank constructor</summary>
 /// <remarks>Defaults to a single color, set to <see cref="Color.Black"/>. Unused colors are initialized to <see cref="Color.Transparent"/>.</remarks>
 public Pltt()
 {
     _type       = ResourceType.Pltt;
     _entries[0] = Color.Black;
     for (int i = 1; i < 256; i++)
     {
         _entries[i] = Color.Transparent;
     }
     _colorIndexer = new ColorIndexer(this);
 }
예제 #4
0
파일: Pltt.cs 프로젝트: MikeG621/LfdReader
 /// <summary>Processes raw data to populate the resource</summary>
 /// <param name="raw">Raw byte data</param>
 /// <param name="containsHeader">Whether or not <i>raw</i> contains the resource Header information</param>
 /// <exception cref="ArgumentException">Header-defined <see cref="Type"/> is not <see cref="ResourceType.Pltt"/></exception>
 /// <remarks>Unused entries are initialized to <see cref="Color.Transparent"/>.</remarks>
 public override void DecodeResource(byte[] raw, bool containsHeader)
 {
     _decodeResource(raw, containsHeader);
     if (_type != ResourceType.Pltt) throw new ArgumentException("Raw header is not for a Pltt resource");
     int offset = 0;
     _startIndex = _rawData[offset++];
     _endIndex = _rawData[offset++];
     for (int i = 0; i < _startIndex; i++) _entries[i] = Color.Transparent;
     for (int i = _startIndex; i <= _endIndex; i++, offset += 3) _entries[i] = Color.FromArgb(_rawData[offset], _rawData[offset + 1], _rawData[offset + 2]);
     for (int i = _endIndex + 1; i < 256; i++) _entries[i] = Color.Transparent;
     _colorIndexer = new ColorIndexer(this);
 }