Ejemplo n.º 1
0
        public IRenderBlock CreateUsing(FileBlockParameters parameters)
        {
            if (new EgaSpriteBlockSpecification().IsSatisfiedBy(parameters))
                return new EgaSpriteBlock(parameters);

            if (new VgaStrataBlockSpecification().IsSatisfiedBy(parameters))
                return new VgaStrataBlock(parameters);

            if (new VgaSpriteBlockSpecification().IsSatisfiedBy(parameters))
                return new VgaSpriteBlock(parameters);

            if (new VgaMixedBlockSpecification().IsSatisfiedBy(parameters))
                return new VgaMixedBlock(parameters);

            if (new VgaBlockSpecification().IsSatisfiedBy(parameters))
                return new VgaBlock(parameters);

            if (new EgaBlockSpecification().IsSatisfiedBy(parameters))
                return new EgaBlock(parameters);

            if (new MonoBlockSpecification().IsSatisfiedBy(parameters))
                return new MonoBlock(parameters);

            return new UnknownBlock();
        }
Ejemplo n.º 2
0
        public bool IsSatisfiedBy(FileBlockParameters parameters)
        {
            var data = parameters.Data;

            if (data.Length < 20)
                return false;

            int height = data[0];
            int width = data[1];

            var widthPx = width*8;
            var heightPx = height;

            if (widthPx < 1 || heightPx < 1 || widthPx > 320 || heightPx > 200)
                return false;

            var chunkCount = data[6] + (data[7] << 8);
            var chunkSize = (widthPx * heightPx);
            if ((chunkCount * chunkSize) > data.Length)
                return false;

            int clrBase = data[8];
            int clrCount = data[9];
            var clrs = EgaVgaPalette.ExtractPalette(data, clrCount, clrBase, 10);

            return clrs != null;
        }
Ejemplo n.º 3
0
        public bool IsSatisfiedBy(FileBlockParameters parameters)
        {
            var data = parameters.Data;

            if (data.Length < 20)
            {
                return(false);
            }

            int height = data[0];
            int width  = data[1];

            var widthPx  = width * 8;
            var heightPx = height;

            if (widthPx < 1 || heightPx < 1 || widthPx > 320 || heightPx > 200)
            {
                return(false);
            }

            var chunkCount = data[6] + (data[7] << 8);
            var chunkSize  = (widthPx * heightPx);

            if ((chunkCount * chunkSize) > data.Length)
            {
                return(false);
            }

            int clrBase  = data[8];
            int clrCount = data[9];
            var clrs     = EgaVgaPalette.ExtractPalette(data, clrCount, clrBase, 10);

            return(clrs != null);
        }
Ejemplo n.º 4
0
        public IRenderBlock CreateUsing(FileBlockParameters parameters)
        {
            if (new EgaSpriteBlockSpecification().IsSatisfiedBy(parameters))
            {
                return(new EgaSpriteBlock(parameters));
            }

            if (new VgaStrataBlockSpecification().IsSatisfiedBy(parameters))
            {
                return(new VgaStrataBlock(parameters));
            }

            if (new VgaSpriteBlockSpecification().IsSatisfiedBy(parameters))
            {
                return(new VgaSpriteBlock(parameters));
            }

            if (new VgaMixedBlockSpecification().IsSatisfiedBy(parameters))
            {
                return(new VgaMixedBlock(parameters));
            }

            if (new VgaBlockSpecification().IsSatisfiedBy(parameters))
            {
                return(new VgaBlock(parameters));
            }

            if (new EgaBlockSpecification().IsSatisfiedBy(parameters))
            {
                return(new EgaBlock(parameters));
            }

            if (new MonoBlockSpecification().IsSatisfiedBy(parameters))
            {
                return(new MonoBlock(parameters));
            }

            return(new UnknownBlock());
        }