mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 13:56:32 +08:00
1 parent
91aa711dfc
commit
c5867b0948
20 files changed
+541
-54
No files matched your search
@@ -0,0 +1,45 @@
|
||||
// Copyright 2025-2026 肖其顿 (XIAO QI DUN)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package ofdgo
|
||||
|
||||
import "github.com/xiaoqidun/pdfgo"
|
||||
|
||||
// halftone 检查连续色调转换及不可忽略的传递函数,避免将打印网屏误用于屏幕显示
|
||||
// 入参: style 图形状态
|
||||
// 返回: error 严格模式或非恒等传递函数无法表达
|
||||
func (p *pdfImporter) halftone(style pdfgo.Style) error {
|
||||
h := style.Halftone
|
||||
if h == nil {
|
||||
return nil
|
||||
}
|
||||
identity, err := h.IdentityTransfer(p.reader)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !identity {
|
||||
return &pdfgo.UnsupportedError{Feature: "halftone transfer function conversion"}
|
||||
}
|
||||
if p.warning == nil {
|
||||
return &pdfgo.UnsupportedError{Feature: "device halftone conversion"}
|
||||
}
|
||||
if p.halftoneWarnings == nil {
|
||||
p.halftoneWarnings = make(map[*pdfgo.Halftone]bool)
|
||||
}
|
||||
if !p.halftoneWarnings[h] {
|
||||
p.halftoneWarnings[h] = true
|
||||
p.warning(pdfgo.Diagnostic{Message: "PDF continuous-tone appearance retained; device halftone not transferred to OFD"})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user