Exemplo n.º 1
0
            public Reader(Stream stream, EpaMetaData info)
            {
                m_input = stream;
                switch (info.ColorType)
                {
                case 0: m_pixel_size = 1; Format = PixelFormats.Indexed8; break;

                case 1: m_pixel_size = 3; Format = PixelFormats.Bgr24; break;

                case 2: m_pixel_size = 4; Format = PixelFormats.Bgra32; break;

                case 3: m_pixel_size = 2; Format = PixelFormats.Bgr555; break;

                case 4: m_pixel_size = 1; Format = PixelFormats.Indexed8; break;

                default: throw new NotSupportedException("Not supported EPA color depth");
                }
                m_width  = (int)info.Width;
                m_height = (int)info.Height;
                m_output = new byte[info.Width * info.Height * m_pixel_size];
                if (8 == info.BPP)
                {
                    Palette = ImageFormat.ReadPalette(m_input, 0x100, PaletteFormat.Bgr);
                }
            }
Exemplo n.º 2
0
        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            var info = new EpaMetaData();

            info.Mode      = file.ReadInt32() >> 24;
            info.ColorType = file.ReadInt32() & 0xff;
            switch (info.ColorType)
            {
            case 0: info.BPP = 8; break;

            case 1: info.BPP = 24; break;

            case 2: info.BPP = 32; break;

            case 3: info.BPP = 15; break;

            case 4: info.BPP = 8; break;

            default: return(null);
            }
            info.Width  = file.ReadUInt32();
            info.Height = file.ReadUInt32();
            if (2 == info.Mode)
            {
                info.OffsetX = file.ReadInt32();
                info.OffsetY = file.ReadInt32();
            }
            return(info);
        }
Exemplo n.º 3
0
        public override ImageMetaData ReadMetaData(Stream stream)
        {
            using (var header = new ArcView.Reader(stream))
            {
                var info = new EpaMetaData();
                info.Mode      = header.ReadInt32() >> 24;
                info.ColorType = header.ReadInt32() & 0xff;
                switch (info.ColorType)
                {
                case 0: info.BPP = 8; break;

                case 1: info.BPP = 24; break;

                case 2: info.BPP = 32; break;

                case 3: info.BPP = 15; break;

                case 4: info.BPP = 8; break;

                default: return(null);
                }
                info.Width  = header.ReadUInt32();
                info.Height = header.ReadUInt32();
                if (2 == info.Mode)
                {
                    info.OffsetX = header.ReadInt32();
                    info.OffsetY = header.ReadInt32();
                }
                return(info);
            }
        }
Exemplo n.º 4
0
        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            var header = file.ReadHeader(16);
            var info   = new EpaMetaData {
                Width     = header.ToUInt32(8),
                Height    = header.ToUInt32(12),
                Mode      = header[3],
                ColorType = header[4],
            };

            switch (info.ColorType)
            {
            case 0: info.BPP = 8; break;

            case 1: info.BPP = 24; break;

            case 2: info.BPP = 32; break;

            case 3: info.BPP = 16; break;

            case 4: info.BPP = 8; break;

            default: return(null);
            }
            if (2 == info.Mode)
            {
                info.OffsetX = file.ReadInt32();
                info.OffsetY = file.ReadInt32();
            }
            return(info);
        }
Exemplo n.º 5
0
            public Reader(IBinaryStream stream, EpaMetaData info)
            {
                m_input = stream;
                switch (info.ColorType)
                {
                case 0: m_pixel_size = 1; Format = PixelFormats.Indexed8; break;

                case 1: m_pixel_size = 3; Format = PixelFormats.Bgr24; break;

                case 2: m_pixel_size = 4; Format = PixelFormats.Bgra32; break;

                case 3: m_pixel_size = 2; Format = PixelFormats.Bgr555; break;

                case 4: m_pixel_size = 1; Format = PixelFormats.Bgra32; m_has_alpha = true; break;

                default: throw new NotSupportedException("Not supported EPA color depth");
                }
                m_width     = (int)info.Width;
                m_height    = (int)info.Height;
                m_output    = new byte[info.Width * info.Height * m_pixel_size];
                m_start_pos = 2 == info.Mode ? 0x18 : 0x10;
            }
Exemplo n.º 6
0
 public override ImageMetaData ReadMetaData(Stream stream)
 {
     using (var header = new ArcView.Reader (stream))
     {
         var info = new EpaMetaData();
         info.Mode = header.ReadInt32() >> 24;
         info.ColorType = header.ReadInt32() & 0xff;
         switch (info.ColorType)
         {
         case 0: info.BPP = 8; break;
         case 1: info.BPP = 24; break;
         case 2: info.BPP = 32; break;
         case 3: info.BPP = 15; break;
         case 4: info.BPP = 8; break;
         default: return null;
         }
         info.Width = header.ReadUInt32();
         info.Height = header.ReadUInt32();
         if (2 == info.Mode)
         {
             info.OffsetX = header.ReadInt32();
             info.OffsetY = header.ReadInt32();
         }
         return info;
     }
 }
Exemplo n.º 7
0
 public Reader(Stream stream, EpaMetaData info)
 {
     m_input = stream;
     switch (info.ColorType)
     {
     case 0: m_pixel_size = 1; Format = PixelFormats.Indexed8; break;
     case 1: m_pixel_size = 3; Format = PixelFormats.Bgr24; break;
     case 2: m_pixel_size = 4; Format = PixelFormats.Bgra32; break;
     case 3: m_pixel_size = 2; Format = PixelFormats.Bgr555; break;
     case 4: m_pixel_size = 1; Format = PixelFormats.Indexed8; break;
     default: throw new NotSupportedException ("Not supported EPA color depth");
     }
     m_width = (int)info.Width;
     m_height = (int)info.Height;
     m_output = new byte[info.Width*info.Height*m_pixel_size];
     if (8 == info.BPP)
         ReadPalette();
 }