public ImageDecoderDirectColor(byte[] pixelData, int width, int height, ColorCodec decoder, ImageFilter imageFilter = null)
        {
            this.pixelData = pixelData;
            if (imageFilter != null)
            {
                this.pixelData = imageFilter.Defilter(pixelData);
            }

            this.width   = width;
            this.height  = height;
            this.decoder = decoder;
        }
Ejemplo n.º 2
0
        private void Init(IndexCodec codec, IComparer <Color> pixelComparer, ColorCodec encoder, ImageFilter imageFilter, PaletteFilter paletteFilter)
        {
            this.codec        = codec;
            this.colorEncoder = encoder;

            this.imageFilter   = imageFilter;
            this.paletteFilter = paletteFilter;
            colors             = 1 << codec.BitDepth;

            if (pixelComparer != null)
            {
                pixelSorter = pixelComparer;
            }
        }
Ejemplo n.º 3
0
        private ImageEncoderIndexed(IList <Image> images, IndexCodec codec, IComparer <Color> pixelComparer = null, ColorCodec encoder = null, ImageFilter imageFilter = null, PaletteFilter paletteFilter = null)
        {
            fromReference = false;

            if (images.Count == 0)
            {
                throw new ArgumentException("The image list cannot be empty!");
            }

            width  = images.First().Width;
            height = images.First().Height;

            foreach (Image img in images)
            {
                if (img.Width != width || img.Height != height)
                {
                    throw new ArgumentException("The images are not of the same size!");
                }
            }

            this.images = images;

            Init(codec, pixelComparer, encoder, imageFilter, paletteFilter);
        }
Ejemplo n.º 4
0
 public ImageEncoderIndexed(Image image, IndexCodec codec, IComparer <Color> pixelComparer = null, ColorCodec encoder = null, ImageFilter imageFilter = null, PaletteFilter paletteFilter = null)
     : this(new List <Image>() { image }, codec, pixelComparer, encoder, imageFilter, paletteFilter)
 {
 }
Ejemplo n.º 5
0
        public ImageEncoderIndexed(IList <Color[]> palettes, Image referenceImage, IndexCodec codec, ColorCodec encoder = null, ImageFilter imageFilter = null, PaletteFilter paletteFilter = null)
        {
            fromReference       = true;
            Palettes            = palettes;
            this.referenceImage = referenceImage;

            width  = referenceImage.Width;
            height = referenceImage.Height;

            if (!IsGreyScale(referenceImage))
            {
                throw new ArgumentException("The reference image must be in grey scale!");
            }

            Init(codec, null, encoder, imageFilter, paletteFilter);
        }
 public ImageEncoderDirectColor(Image image, ColorCodec codec, ImageFilter filter = null)
 {
     this.image  = image;
     this.codec  = codec;
     this.filter = filter;
 }