Example #1
0
 public McgDecoder(IBinaryStream input, McgMetaData info, byte key)
 {
     m_file   = input;
     m_info   = info;
     m_width  = (int)info.Width;
     m_height = (int)info.Height;
     m_pixels = m_width * m_height;
     m_key    = key;
     Stride   = m_width * m_info.BPP / 8;
     if (101 == m_info.Version)
     {
         Stride = (Stride + 3) & -4;
     }
     if (24 == m_info.BPP)
     {
         Format = PixelFormats.Bgr24;
     }
     else if (16 == m_info.BPP)
     {
         Format = PixelFormats.Bgr555;
     }
     else if (8 == m_info.BPP)
     {
         Format = PixelFormats.Indexed8;
     }
     else
     {
         throw new InvalidFormatException();
     }
 }
Example #2
0
 public McgDecoder(Stream input, McgMetaData info, byte key)
 {
     input.Position = info.DataOffset;
     m_input        = new byte[info.PackedSize];
     if (m_input.Length != input.Read(m_input, 0, m_input.Length))
     {
         throw new InvalidFormatException("Unexpected end of file");
     }
     m_width   = (int)info.Width;
     m_height  = (int)info.Height;
     m_pixels  = m_width * m_height;
     m_key     = key;
     m_version = info.Version;
     Stride    = 3 * m_width;
     if (101 == m_version)
     {
         Stride = (Stride + 3) & -4;
     }
 }