Beispiel #1
0
        public sBITChunk(byte[] data, PNGImage image)
            : base(data, image)
        {
            IHDRChunk hdr = this.GetAssertIHDRChunk();

            switch (hdr.ColorType)
            {
            case ColorType.Grayscale:
                _sb = new SignificantBits(data[4], 0, 0, 0, 0);
                break;

            case ColorType.Truecolor:
            case ColorType.IndexedColor:
                _sb = new SignificantBits(0, 0, data[4], data[5], data[6]);
                break;

            case ColorType.GrayscaleWithAlpha:
                _sb = new SignificantBits(data[4], data[5], 0, 0, 0);
                break;

            case ColorType.TruecolorWithAlpha:
                _sb = new SignificantBits(0, data[7], data[4], data[5], data[6]);
                break;

            default:
                throw new InvalidChunkDataException("Invalid color type.");
            }
        }
Beispiel #2
0
 public sBITChunk(PNGImage image)
     : base("sBIT", image)
 {
     _sb = new SignificantBits();
 }