Beispiel #1
0
            public Reader(IBinaryStream file, PicMetaData info)
            {
                m_mode        = info.Mode;
                m_key         = info.Key;
                Stride        = (int)info.Width * 3;
                file.Position = 0x12;
                if (6 == info.Mode)
                {
                    uint out_len = info.Width * info.Height * 3;
                    m_output = new byte[out_len];
                    if (m_output.Length != file.Read(m_output, 0, m_output.Length))
                    {
                        throw new InvalidFormatException("Unexpected end of file");
                    }
                }
                else
                {
                    m_comp0 = new byte[info.CompSize1];
                    if (m_comp0.Length != file.Read(m_comp0, 0, m_comp0.Length))
                    {
                        throw new InvalidFormatException("Unexpected end of file");
                    }

                    m_comp1 = new byte[info.CompSize2];
                    if (m_comp1.Length != file.Read(m_comp1, 0, m_comp1.Length))
                    {
                        throw new InvalidFormatException("Unexpected end of file");
                    }

                    m_comp2 = new byte[info.CompSize3];
                    if (m_comp2.Length != file.Read(m_comp2, 0, m_comp2.Length))
                    {
                        throw new InvalidFormatException("Unexpected end of file");
                    }

                    uint out_len = (info.Width * info.Height + 96) * 3;
                    m_output = new byte[out_len];
                }
            }
Beispiel #2
0
            public Reader(Stream file, PicMetaData info)
            {
                m_mode = info.Mode;
                m_key = info.Key;
                if (6 == info.Mode)
                {
                    uint out_len = info.Width * info.Height * 3;
                    m_output = new byte[out_len];
                    if (m_output.Length != file.Read (m_output, 0, m_output.Length))
                        throw new InvalidFormatException ("Unexpected end of file");
                }
                else
                {
                    m_comp0 = new byte[info.CompSize1];
                    if (m_comp0.Length != file.Read (m_comp0, 0, m_comp0.Length))
                        throw new InvalidFormatException ("Unexpected end of file");

                    m_comp1 = new byte[info.CompSize2];
                    if (m_comp1.Length != file.Read (m_comp1, 0, m_comp1.Length))
                        throw new InvalidFormatException ("Unexpected end of file");

                    m_comp2 = new byte[info.CompSize3];
                    if (m_comp2.Length != file.Read (m_comp2, 0, m_comp2.Length))
                        throw new InvalidFormatException ("Unexpected end of file");

                    uint out_len = (info.Width * info.Height + 96) * 3;
                    m_output = new byte[out_len];
                }
            }