Beispiel #1
0
        public override ImageMetaData ReadMetaData(IBinaryStream stream)
        {
            var header  = stream.ReadHeader(0x11);
            int version = header[2] - '0';

            if (!header.AsciiEqual("GR") || version < 1 || version > 3)
            {
                return(null);
            }
            var info = new GrpMetaData {
                Width   = header.ToUInt32(5),
                Height  = header.ToUInt32(9),
                BPP     = header.ToUInt16(3),
                Version = version
            };

            if (version > 1)
            {
                info.UnpackedSize = header.ToInt32(0xD);
            }
            else
            {
                info.UnpackedSize = (int)info.Width * (int)info.Height * info.BPP / 8
                                    + (info.BPP == 8 ? 0x300 : 0);
            }
            return(info);
        }
Beispiel #2
0
 public GrpReader(IBinaryStream input, GrpMetaData info)
 {
     m_input  = input;
     m_output = new byte[info.UnpackedSize];
     if (24 == info.BPP)
     {
         Format = PixelFormats.Bgr24;
     }
     else if (32 == info.BPP)
     {
         Format = PixelFormats.Bgr32;
     }
     else
     {
         throw new NotSupportedException("Not supported GRP image color depth");
     }
 }
Beispiel #3
0
        public GrpReader(IBinaryStream input, GrpMetaData info)
        {
            m_input  = input;
            m_output = new byte[info.UnpackedSize];
            m_info   = info;
            switch (info.BPP)
            {
            case 8:  Format = PixelFormats.Indexed8; break;

            case 16: Format = PixelFormats.Bgr555; break;

            case 24: Format = PixelFormats.Bgr24; break;

            case 32: Format = PixelFormats.Bgr32; break;

            default: throw new NotSupportedException("Not supported GRP image color depth");
            }
            m_count_bits = info.Version > 2 ? 3 : 5;
            m_count_mask = ~(-1 << m_count_bits);
        }
Beispiel #4
0
 public GrpReader(Stream input, GrpMetaData info)
 {
     m_input = new ArcView.Reader (input);
     m_output = new byte[info.UnpackedSize];
     if (24 == info.BPP)
         Format = PixelFormats.Bgr24;
     else if (32 == info.BPP)
         Format = PixelFormats.Bgr32;
     else
         throw new NotSupportedException ("Not supported GRP image color depth");
 }