1 Star 0 Fork 1

coodder/unipdf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
globals.go 746 Bytes
一键复制 编辑 原始数据 按行查看 历史
jhonm 提交于 2023-08-07 15:31 . init
package jbig2
import (
"sort"
"gitee.com/coodder/unipdf/internal/jbig2/document"
"gitee.com/coodder/unipdf/internal/jbig2/document/segments"
)
// Globals is the v3 mapping of the jbig2 segments to header mapping.
type Globals map[int]*segments.Header
// ToDocumentGlobals converts 'jbig2.Globals' into '*document.Globals'
func (g Globals) ToDocumentGlobals() *document.Globals {
if g == nil {
return nil
}
headers := []*segments.Header{}
// add all segments to the slice.
for _, segment := range g {
headers = append(headers, segment)
}
// sort by the segment number value
sort.Slice(headers, func(i, j int) bool {
return headers[i].SegmentNumber < headers[j].SegmentNumber
})
return &document.Globals{Segments: headers}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/coodder/unipdf.git
git@gitee.com:coodder/unipdf.git
coodder
unipdf
unipdf
v1.1.0

搜索帮助