Inheritance: CodecWithPredictor
Exemplo n.º 1
0
        public override bool SetField(Tiff tif, TiffTag tag, FieldValue[] ap)
        {
            DeflateCodec sp = tif.m_currentCodec as DeflateCodec;

            Debug.Assert(sp != null);

            const string module = "ZIPVSetField";

            switch (tag)
            {
            case TiffTag.ZIPQUALITY:
                sp.m_zipquality = ap[0].ToInt();
                if ((sp.m_state & DeflateCodec.ZSTATE_INIT_ENCODE) != 0)
                {
                    if (sp.m_stream.deflateParams(sp.m_zipquality, zlibConst.Z_DEFAULT_STRATEGY) != zlibConst.Z_OK)
                    {
                        Tiff.ErrorExt(tif, tif.m_clientdata, module,
                                      "{0}: zlib error: {0}", tif.m_name, sp.m_stream.msg);
                        return(false);
                    }
                }

                return(true);
            }

            return(base.SetField(tif, tag, ap));
        }
Exemplo n.º 2
0
        public override FieldValue[] GetField(Tiff tif, TiffTag tag)
        {
            DeflateCodec sp = tif.m_currentCodec as DeflateCodec;

            Debug.Assert(sp != null);

            switch (tag)
            {
            case TiffTag.ZIPQUALITY:
                FieldValue[] result = new FieldValue[1];
                result[0].Set(sp.m_zipquality);
                return(result);
            }

            return(base.GetField(tif, tag));
        }