feat(横线渲染): 修复横线渲染

This commit is contained in:
2026-06-25 14:54:50 +08:00
parent f00f320429
commit ffcf2262b2
2 changed files with 47 additions and 6 deletions
+17 -1
View File
@@ -15,10 +15,10 @@
package ofdgo
import (
"github.com/tdewolff/canvas"
"image/color"
"strconv"
"strings"
"github.com/tdewolff/canvas"
)
// parseColor 解析颜色字符串
@@ -88,6 +88,22 @@ func parseStrokeColor(strokeColor *StrokeColor) color.Color {
return parseAxialShdColor(strokeColor.AxialShd, strokeColor.Alpha)
}
// parseStrokePaint 解析勾边画刷
// 入参: strokeColor 勾边颜色节点, x X坐标, y Y坐标, pageH 页面高度, originX 原点X坐标, originY 原点Y坐标
// 返回: any 勾边画刷
func parseStrokePaint(strokeColor *StrokeColor, x, y, pageH, originX, originY float64) any {
if strokeColor == nil {
return nil
}
if strings.TrimSpace(strokeColor.Value) != "" {
return parseColorWithAlpha(strokeColor.Value, strokeColor.Alpha)
}
if gradient := parseAxialShdGradient(strokeColor.AxialShd, strokeColor.Alpha, x, y, pageH, originX, originY); gradient != nil {
return gradient
}
return parseAxialShdColor(strokeColor.AxialShd, strokeColor.Alpha)
}
// parseAxialShdColor 解析轴向渐变颜色
// 入参: axialShd 轴向渐变节点, alpha 透明度
// 返回: color.Color 颜色对象