unioffice/internal/convertutils/convertutils.go

12 lines
41 KiB
Go
Raw Normal View History

2021-08-23 20:44:48 +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/
2023-03-01 18:42:44 +00:00
package convertutils ;import (_g "bytes";_ae "errors";_gf "fmt";_db "github.com/unidoc/unioffice/common/logger";_c "github.com/unidoc/unioffice/measurement";_ed "github.com/unidoc/unioffice/schema/soo/dml";_ac "github.com/unidoc/unioffice/schema/soo/dml/chart";_dd "github.com/unidoc/unioffice/spreadsheet/format";_bd "github.com/unidoc/unipdf/v3/creator";_da "github.com/unidoc/unipdf/v3/model";_ce "github.com/unidoc/unipdf/v3/render";_fbb "github.com/unidoc/unitype";_d "image";_a "math";_e "os";_bae "sort";_ba "strconv";_fg "strings";_fb "sync";_b "unicode";);func TwipsFromPoints (points float64 )float64 {return points /_c .Twips };type Rectangle struct{Top float64 ;Bottom float64 ;Left float64 ;Right float64 ;};func _gcae (_fgfg *_ac .CT_DateAx )(uint32 ,_ac .ST_AxPos ,_ac .ST_TickMark ,_ac .ST_TickLblPos ,*_ac .CT_ChartLines ,uint32 ,*_ed .CT_ShapeProperties ,error ){var _ace ,_gade uint32 ;var _gef _ac .ST_AxPos ;var _egge _ac .ST_TickMark ;var _gbe *_ac .CT_ChartLines ;var _feaa _ac .ST_TickLblPos ;if _fgfg .AxId ==nil {return _ace ,_gef ,_egge ,_feaa ,_gbe ,_gade ,_fgfg .SpPr ,_ae .New ("\u004e\u006f\u0020x\u0020\u0061\u0078\u0069\u0073\u0020\u0049\u0044");}else {_ace =_fgfg .AxId .ValAttr ;};if _fgfg .AxPos ==nil {return _ace ,_gef ,_egge ,_feaa ,_gbe ,_gade ,_fgfg .SpPr ,_ae .New ("\u004eo\u0020x\u0020\u0061\u0078\u0069\u0073 \u0070\u006fs\u0069\u0074\u0069\u006f\u006e");}else {_gef =_fgfg .AxPos .ValAttr ;};if _fgfg .MajorTickMark !=nil {_egge =_fgfg .MajorTickMark .ValAttr ;};if _fgfg .TickLblPos !=nil {_feaa =_fgfg .TickLblPos .ValAttr ;};if _fgfg .CrossAx ==nil {return _ace ,_gef ,_egge ,_feaa ,_gbe ,_gade ,_fgfg .SpPr ,_ae .New ("\u004e\u006f \u0063\u0072\u006fs\u0073\u0020\u0061\u0078\u0069\u0073\u0020\u0049\u0044");}else {_gade =_fgfg .CrossAx .ValAttr ;};_gbe =_fgfg .MajorGridlines ;return _ace ,_gef ,_egge ,_feaa ,_gbe ,_gade ,_fgfg .SpPr ,nil ;};func (_beef *Rectangle )scale (_dee float64 ){_beef .Top *=_dee ;_beef .Bottom *=_dee ;_beef .Left *=_dee ;_beef .Right *=_dee ;};func AdjustColorByShade (colorStr string ,shade float64 )string {var _bdbbf ,_feg ,_acf uint8 ;_fcff ,_ :=_gf .Sscanf (colorStr ,"\u0025\u0030\u0032x\u0025\u0030\u0032\u0078\u0025\u0030\u0032\u0078",&_bdbbf ,&_feg ,&_acf );if _fcff !=3{return "";};return _gaeg (_bdbbf ,shade )+_gaeg (_feg ,shade )+_gaeg (_acf ,shade );};func MakeBlockFromChartSpace (cs *_ac .ChartSpace ,width ,height float64 ,theme *_ed .Theme )(*_bd .Block ,error ){_ggba ,_ceb :=_edfb (cs ,width ,height ,theme ,false );if _ceb !=nil {return nil ,_ceb ;};_gad ,_ceb :=GetPageFromCreator (_ggba );if _ceb !=nil {return nil ,_ceb ;};_beff ,_ceb :=_bd .NewBlockFromPage (_gad );if _ceb !=nil {return nil ,_ceb ;};return _beff ,nil ;};func _dcg (_ffgf _ed .ST_SchemeColorVal ,_bfga *_ed .Theme )string {if _bfgaa :=_bfga .ThemeElements ;_bfgaa !=nil {if _eega :=_bfgaa .ClrScheme ;_eega !=nil {switch _ffgf {case _ed .ST_SchemeColorValLt1 :return GetColorStringFromDmlColor (_eega .Lt1 );case _ed .ST_SchemeColorValDk1 ,_ed .ST_SchemeColorValTx1 :return GetColorStringFromDmlColor (_eega .Dk1 );case _ed .ST_SchemeColorValLt2 :return GetColorStringFromDmlColor (_eega .Lt2 );case _ed .ST_SchemeColorValDk2 :return GetColorStringFromDmlColor (_eega .Dk2 );case _ed .ST_SchemeColorValAccent1 :return GetColorStringFromDmlColor (_eega .Accent1 );case _ed .ST_SchemeColorValAccent2 :return GetColorStringFromDmlColor (_eega .Accent2 );case _ed .ST_SchemeColorValAccent3 :return GetColorStringFromDmlColor (_eega .Accent3 );case _ed .ST_SchemeColorValAccent4 :return GetColorStringFromDmlColor (_eega .Accent4 );case _ed .ST_SchemeColorValAccent5 :return GetColorStringFromDmlColor (_eega .Accent5 );case _ed .ST_SchemeColorValAccent6 :return GetColorStringFromDmlColor (_eega .Accent6 );};};};return "";};func _abg (_gbg ,_ddg ,_bbg uint8 )(float64 ,float64 ,float64 ){_acd ,_fga ,_bdgf :=float64 (_gbg )/255,float64 (_ddg )/255,float64 (_bbg )/255;_cge :=_acd ;if _fga < _cge {_cge =_fga ;};if _bdgf < _cge {_cge =_bdgf ;};var _eca ,_edgd bool ;_gddf :=_acd ;if _fga > _gddf {_gddf =_fga ;_eca =true ;};if