2020-12-06 13:03:03 +00:00

12 lines
3.6 KiB
Go

//
// 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 (_a "github.com/unidoc/unipdf/v3/internal/bitwise";_c "github.com/unidoc/unipdf/v3/internal/jbig2/bitmap";_e "github.com/unidoc/unipdf/v3/internal/jbig2/document";_d "github.com/unidoc/unipdf/v3/internal/jbig2/errors";_f "image";);func Decode (input []byte ,parameters Parameters ,globals *_e .Globals )(*Decoder ,error ){_ebc :=_a .NewReader (input );_be ,_cde :=_e .DecodeDocument (_ebc ,globals );if _cde !=nil {return nil ,_cde ;};return &Decoder {_gg :_ebc ,_ab :_be ,_cc :parameters },nil ;};func (_fg *Decoder )DecodeNextPage ()([]byte ,error ){_fg ._gb ++;_ebb :=_fg ._gb ;return _fg .decodePage (_ebb );};type Decoder struct{_gg _a .StreamReader ;_ab *_e .Document ;_gb int ;_cc Parameters ;};func (_abb *Decoder )decodePage (_ff int )([]byte ,error ){const _bf ="\u0064\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0067\u0065";if _ff < 0{return nil ,_d .Errorf (_bf ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0067\u0065 \u006eu\u006db\u0065\u0072\u003a\u0020\u0027\u0025\u0064'",_ff );};if _ff > int (_abb ._ab .NumberOfPages ){return nil ,_d .Errorf (_bf ,"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",_ff );};_cf ,_cga :=_abb ._ab .GetPage (_ff );if _cga !=nil {return nil ,_d .Wrap (_cga ,_bf ,"");};_bd ,_cga :=_cf .GetBitmap ();if _cga !=nil {return nil ,_d .Wrap (_cga ,_bf ,"");};_bd .InverseData ();if !_abb ._cc .UnpaddedData {return _bd .Data ,nil ;};return _bd .GetUnpaddedData ();};func (_b *Decoder )PageNumber ()(int ,error ){const _cb ="\u0044e\u0063o\u0064\u0065\u0072\u002e\u0050a\u0067\u0065N\u0075\u006d\u0062\u0065\u0072";if _b ._ab ==nil {return 0,_d .Error (_cb ,"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 (_b ._ab .NumberOfPages ),nil ;};func (_cbe *Decoder )decodePageImage (_ffb int )(_f .Image ,error ){const _ga ="\u0064e\u0063o\u0064\u0065\u0050\u0061\u0067\u0065\u0049\u006d\u0061\u0067\u0065";if _ffb < 0{return nil ,_d .Errorf (_ga ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0067\u0065 \u006eu\u006db\u0065\u0072\u003a\u0020\u0027\u0025\u0064'",_ffb );};if _ffb > int (_cbe ._ab .NumberOfPages ){return nil ,_d .Errorf (_ga ,"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",_ffb );};_ed ,_ffc :=_cbe ._ab .GetPage (_ffb );if _ffc !=nil {return nil ,_d .Wrap (_ffc ,_ga ,"");};_fe ,_ffc :=_ed .GetBitmap ();if _ffc !=nil {return nil ,_d .Wrap (_ffc ,_ga ,"");};return _fe .ToImage (),nil ;};func (_eb *Decoder )DecodePage (pageNumber int )([]byte ,error ){return _eb .decodePage (pageNumber )};type Parameters struct{UnpaddedData bool ;Color _c .Color ;};func (_ca *Decoder )DecodePageImage (pageNumber int )(_f .Image ,error ){const _cd ="\u0064\u0065\u0063od\u0065\u0072\u002e\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0067\u0065\u0049\u006d\u0061\u0067\u0065";_cg ,_ad :=_ca .decodePageImage (pageNumber );if _ad !=nil {return nil ,_d .Wrap (_ad ,_cd ,"");};return _cg ,nil ;};