22 lines
3.6 KiB
Go
Raw Normal View History

2020-08-27 21:45:09 +00:00
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
2022-07-13 21:28:43 +00:00
package decoder ;import (_be "github.com/unidoc/unipdf/v3/internal/bitwise";_e "github.com/unidoc/unipdf/v3/internal/jbig2/bitmap";_ed "github.com/unidoc/unipdf/v3/internal/jbig2/document";_f "github.com/unidoc/unipdf/v3/internal/jbig2/errors";_d "image";
);func (_fbe *Decoder )PageNumber ()(int ,error ){const _fbb ="\u0044e\u0063o\u0064\u0065\u0072\u002e\u0050a\u0067\u0065N\u0075\u006d\u0062\u0065\u0072";if _fbe ._c ==nil {return 0,_f .Error (_fbb ,"d\u0065\u0063\u006f\u0064\u0065\u0072 \u006e\u006f\u0074\u0020\u0069\u006e\u0069\u0074\u0069a\u006c\u0069\u007ae\u0064 \u0079\u0065\u0074");
};return int (_fbe ._c .NumberOfPages ),nil ;};func Decode (input []byte ,parameters Parameters ,globals *_ed .Globals )(*Decoder ,error ){_dba :=_be .NewReader (input );_dec ,_gg :=_ed .DecodeDocument (_dba ,globals );if _gg !=nil {return nil ,_gg ;};
return &Decoder {_dd :_dba ,_c :_dec ,_ddc :parameters },nil ;};func (_a *Decoder )DecodePageImage (pageNumber int )(_d .Image ,error ){const _ff ="\u0064\u0065\u0063od\u0065\u0072\u002e\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0067\u0065\u0049\u006d\u0061\u0067\u0065";
_bf ,_g :=_a .decodePageImage (pageNumber );if _g !=nil {return nil ,_f .Wrap (_g ,_ff ,"");};return _bf ,nil ;};func (_bg *Decoder )decodePageImage (_beg int )(_d .Image ,error ){const _db ="\u0064e\u0063o\u0064\u0065\u0050\u0061\u0067\u0065\u0049\u006d\u0061\u0067\u0065";
if _beg < 0{return nil ,_f .Errorf (_db ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0067\u0065 \u006eu\u006db\u0065\u0072\u003a\u0020\u0027\u0025\u0064'",_beg );};if _beg > int (_bg ._c .NumberOfPages ){return nil ,_f .Errorf (_db ,"p\u0061\u0067\u0065\u003a\u0020\u0027%\u0064\u0027\u0020\u006e\u006f\u0074 \u0066\u006f\u0075\u006e\u0064\u0020\u0069n\u0020\u0074\u0068\u0065\u0020\u0064\u0065\u0063\u006f\u0064e\u0072",_beg );
};_bed ,_ag :=_bg ._c .GetPage (_beg );if _ag !=nil {return nil ,_f .Wrap (_ag ,_db ,"");};_ec ,_ag :=_bed .GetBitmap ();if _ag !=nil {return nil ,_f .Wrap (_ag ,_db ,"");};_ec .InverseData ();return _ec .ToImage (),nil ;};type Parameters struct{UnpaddedData bool ;
Color _e .Color ;};func (_gd *Decoder )DecodeNextPage ()([]byte ,error ){_gd ._fb ++;_bfd :=_gd ._fb ;return _gd .decodePage (_bfd );};func (_de *Decoder )DecodePage (pageNumber int )([]byte ,error ){return _de .decodePage (pageNumber )};func (_ge *Decoder )decodePage (_ffg int )([]byte ,error ){const _dg ="\u0064\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0067\u0065";
if _ffg < 0{return nil ,_f .Errorf (_dg ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0067\u0065 \u006eu\u006db\u0065\u0072\u003a\u0020\u0027\u0025\u0064'",_ffg );};if _ffg > int (_ge ._c .NumberOfPages ){return nil ,_f .Errorf (_dg ,"p\u0061\u0067\u0065\u003a\u0020\u0027%\u0064\u0027\u0020\u006e\u006f\u0074 \u0066\u006f\u0075\u006e\u0064\u0020\u0069n\u0020\u0074\u0068\u0065\u0020\u0064\u0065\u0063\u006f\u0064e\u0072",_ffg );
};_ad ,_da :=_ge ._c .GetPage (_ffg );if _da !=nil {return nil ,_f .Wrap (_da ,_dg ,"");};_bd ,_da :=_ad .GetBitmap ();if _da !=nil {return nil ,_f .Wrap (_da ,_dg ,"");};_bd .InverseData ();if !_ge ._ddc .UnpaddedData {return _bd .Data ,nil ;};return _bd .GetUnpaddedData ();
};type Decoder struct{_dd _be .StreamReader ;_c *_ed .Document ;_fb int ;_ddc Parameters ;};