예제 #1
0
        static bool PredictorEncodeRow(TIFF tif, byte[] bp, int cc, ushort s)
        {
            TIFFPredictorState sp = (TIFFPredictorState)tif.tif_data;

            // XXX horizontal differencing alters user's data XXX
            sp.encodepfunc(tif, bp, 0, cc);
            return(sp.encoderow(tif, bp, cc, s));
        }
예제 #2
0
        static bool PredictorEncodeTile(TIFF tif, byte[] bp0, int cc0, ushort s)
        {
            string             module = "PredictorEncodeTile";
            TIFFPredictorState sp     = (TIFFPredictorState)tif.tif_data;
            int cc = cc0;

            byte[] bp = null;
            try
            {
                bp = new byte[cc0];
            }
            catch
            {
                TIFFErrorExt(tif.tif_clientdata, module, "Out of memory allocating {0} byte temp buffer.", cc0);
                return(false);
            }

            bp0.CopyTo(bp, 0);

            int rowsize = sp.rowsize;

#if DEBUG
            if (rowsize <= 0)
            {
                throw new Exception("rowsize<=0");
            }
            if ((cc0 % rowsize) != 0)
            {
                throw new Exception("(cc0%rowsize)!=0");
            }
#endif

            int bp_offset = 0;
            while (cc > 0)
            {
                sp.encodepfunc(tif, bp, bp_offset, rowsize);
                cc        -= rowsize;
                bp_offset += rowsize;
            }

            return(sp.encodetile(tif, bp, cc0, s));
        }