// // 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/ package decoder ;import (_eg "github.com/unidoc/unipdf/v3/internal/bitwise";_b "github.com/unidoc/unipdf/v3/internal/jbig2/bitmap";_eb "github.com/unidoc/unipdf/v3/internal/jbig2/document";_d "github.com/unidoc/unipdf/v3/internal/jbig2/errors";_e "image"; );func (_f *Decoder )DecodePageImage (pageNumber int )(_e .Image ,error ){const _ef ="\u0064\u0065\u0063od\u0065\u0072\u002e\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0067\u0065\u0049\u006d\u0061\u0067\u0065";_bd ,_fg :=_f .decodePageImage (pageNumber ); if _fg !=nil {return nil ,_d .Wrap (_fg ,_ef ,"");};return _bd ,nil ;};func (_g *Decoder )PageNumber ()(int ,error ){const _fb ="\u0044e\u0063o\u0064\u0065\u0072\u002e\u0050a\u0067\u0065N\u0075\u006d\u0062\u0065\u0072";if _g ._bf ==nil {return 0,_d .Error (_fb ,"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 (_g ._bf .NumberOfPages ),nil ;};func Decode (input []byte ,parameters Parameters ,globals *_eb .Globals )(*Decoder ,error ){_fbc :=_eg .NewReader (input );_ae ,_fa :=_eb .DecodeDocument (_fbc ,globals );if _fa !=nil {return nil ,_fa ;};return &Decoder {_af :_fbc ,_bf :_ae ,_bb :parameters },nil ; };func (_ee *Decoder )decodePageImage (_cdb int )(_e .Image ,error ){const _ce ="\u0064e\u0063o\u0064\u0065\u0050\u0061\u0067\u0065\u0049\u006d\u0061\u0067\u0065";if _cdb < 0{return nil ,_d .Errorf (_ce ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0067\u0065 \u006eu\u006db\u0065\u0072\u003a\u0020\u0027\u0025\u0064'",_cdb ); };if _cdb > int (_ee ._bf .NumberOfPages ){return nil ,_d .Errorf (_ce ,"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",_cdb ); };_de ,_fe :=_ee ._bf .GetPage (_cdb );if _fe !=nil {return nil ,_d .Wrap (_fe ,_ce ,"");};_adb ,_fe :=_de .GetBitmap ();if _fe !=nil {return nil ,_d .Wrap (_fe ,_ce ,"");};_adb .InverseData ();return _adb .ToImage (),nil ;};type Parameters struct{UnpaddedData bool ; Color _b .Color ;};type Decoder struct{_af *_eg .Reader ;_bf *_eb .Document ;_dg int ;_bb Parameters ;};func (_ag *Decoder )DecodePage (pageNumber int )([]byte ,error ){return _ag .decodePage (pageNumber )};func (_ad *Decoder )DecodeNextPage ()([]byte ,error ){_ad ._dg ++; _agc :=_ad ._dg ;return _ad .decodePage (_agc );};func (_c *Decoder )decodePage (_dd int )([]byte ,error ){const _ac ="\u0064\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0067\u0065";if _dd < 0{return nil ,_d .Errorf (_ac ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0067\u0065 \u006eu\u006db\u0065\u0072\u003a\u0020\u0027\u0025\u0064'",_dd ); };if _dd > int (_c ._bf .NumberOfPages ){return nil ,_d .Errorf (_ac ,"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",_dd ); };_cg ,_cd :=_c ._bf .GetPage (_dd );if _cd !=nil {return nil ,_d .Wrap (_cd ,_ac ,"");};_fc ,_cd :=_cg .GetBitmap ();if _cd !=nil {return nil ,_d .Wrap (_cd ,_ac ,"");};_fc .InverseData ();if !_c ._bb .UnpaddedData {return _fc .Data ,nil ;};return _fc .GetUnpaddedData (); };