2024-03-27 22:34:33 +00:00

21 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 (_g "github.com/unidoc/unipdf/v3/internal/bitwise";_fe "github.com/unidoc/unipdf/v3/internal/jbig2/bitmap";_gd "github.com/unidoc/unipdf/v3/internal/jbig2/document";_fg "github.com/unidoc/unipdf/v3/internal/jbig2/errors";_f "image";
);func (_d *Decoder )DecodeNextPage ()([]byte ,error ){_d ._gab ++;_cc :=_d ._gab ;return _d .decodePage (_cc );};func (_ad *Decoder )PageNumber ()(int ,error ){const _cg ="\u0044e\u0063o\u0064\u0065\u0072\u002e\u0050a\u0067\u0065N\u0075\u006d\u0062\u0065\u0072";
if _ad ._a ==nil {return 0,_fg .Error (_cg ,"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 (_ad ._a .NumberOfPages ),nil ;};func (_ag *Decoder )decodePageImage (_db int )(_f .Image ,error ){const _ca ="\u0064e\u0063o\u0064\u0065\u0050\u0061\u0067\u0065\u0049\u006d\u0061\u0067\u0065";
if _db < 0{return nil ,_fg .Errorf (_ca ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0067\u0065 \u006eu\u006db\u0065\u0072\u003a\u0020\u0027\u0025\u0064'",_db );};if _db > int (_ag ._a .NumberOfPages ){return nil ,_fg .Errorf (_ca ,"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",_db );
};_agc ,_cag :=_ag ._a .GetPage (_db );if _cag !=nil {return nil ,_fg .Wrap (_cag ,_ca ,"");};_af ,_cag :=_agc .GetBitmap ();if _cag !=nil {return nil ,_fg .Wrap (_cag ,_ca ,"");};_af .InverseData ();return _af .ToImage (),nil ;};func (_gdd *Decoder )DecodePageImage (pageNumber int )(_f .Image ,error ){const _fc ="\u0064\u0065\u0063od\u0065\u0072\u002e\u0044\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0067\u0065\u0049\u006d\u0061\u0067\u0065";
_c ,_e :=_gdd .decodePageImage (pageNumber );if _e !=nil {return nil ,_fg .Wrap (_e ,_fc ,"");};return _c ,nil ;};func (_bf *Decoder )DecodePage (pageNumber int )([]byte ,error ){return _bf .decodePage (pageNumber )};func (_gc *Decoder )decodePage (_adc int )([]byte ,error ){const _df ="\u0064\u0065\u0063\u006f\u0064\u0065\u0050\u0061\u0067\u0065";
if _adc < 0{return nil ,_fg .Errorf (_df ,"\u0069n\u0076\u0061\u006c\u0069d\u0020\u0070\u0061\u0067\u0065 \u006eu\u006db\u0065\u0072\u003a\u0020\u0027\u0025\u0064'",_adc );};if _adc > int (_gc ._a .NumberOfPages ){return nil ,_fg .Errorf (_df ,"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",_adc );
};_ab ,_cf :=_gc ._a .GetPage (_adc );if _cf !=nil {return nil ,_fg .Wrap (_cf ,_df ,"");};_adb ,_cf :=_ab .GetBitmap ();if _cf !=nil {return nil ,_fg .Wrap (_cf ,_df ,"");};_adb .InverseData ();if !_gc ._fa .UnpaddedData {return _adb .Data ,nil ;};return _adb .GetUnpaddedData ();
};func Decode (input []byte ,parameters Parameters ,globals *_gd .Globals )(*Decoder ,error ){_fee :=_g .NewReader (input );_agcg ,_bb :=_gd .DecodeDocument (_fee ,globals );if _bb !=nil {return nil ,_bb ;};return &Decoder {_ga :_fee ,_a :_agcg ,_fa :parameters },nil ;
};type Parameters struct{UnpaddedData bool ;Color _fe .Color ;};type Decoder struct{_ga *_g .Reader ;_a *_gd .Document ;_gab int ;_fa Parameters ;};