feat(渲染引擎): 修复文字渲染并优化图像处理
build.yaml / build (push) Successful in 45s

This commit is contained in:
xiaoqidun committed 2026-10-03 10:51:50 +08:00
1 parent 1945ea355a
commit f2dbf72885
15 files changed
+344 -21

No files matched your search

+11
View File
@@ -16,6 +16,7 @@ package ofdgo
import (
"fmt"
"image"
"github.com/tdewolff/canvas"
"github.com/tdewolff/canvas/renderers/pdf"
@@ -54,6 +55,16 @@ type pdfOutline struct {
Y float64
}
// RenderImage 在图像局部保存状态前同步不透明画笔,避免恢复后的透明度与后端缓存不一致
// 入参: img 图像, matrix 图像变换
func (r *pdfRenderer) RenderImage(img image.Image, matrix canvas.Matrix) {
style := canvas.DefaultStyle
style.Fill = canvas.Paint{Color: canvas.White}
style.Stroke = canvas.Paint{Color: canvas.Black}
r.PDF.RenderPath(&canvas.Path{}, style, canvas.Identity)
r.PDF.RenderImage(img, matrix)
}
// glyphPath 复用相似变换下的PDF字形圆弧转换
// 入参: path 缓存字形路径, matrix 字形变换
// 返回: *canvas.Path PDF字形路径