Discover Packages
github.com/zc310/ofd
internal
sealimg
package
Version:
v0.2.0
Opens a new window with list of versions in this module.
Published: Nov 17, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 12
Opens a new window with list of imports.
Imported by: 0 modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
Documentation
Documentation
¶
Rendered for
linux/amd64
windows/amd64
darwin/amd64
js/wasm
Package sealimg 生成仅供演示与测试的印章图片。
印章上的文字是固定文案:顶部「OFD 测试专用章」、底部「非正式印章」,五角星下方以小字
「zc310/ofd」标识来源。
用途。这样做不是省事,而是必要的——印章图片会被单独复制传播,一旦长得像真章
就可能脱离本仓库流入真实业务。图片自己带着免责声明,比文档里写多少遍
「仅供测试」都管用。
因此本包不提供自定义文案、不做旧做质感、也不试图逼近真实印章的观感:它要
的是一张能替换占位图、让演示与测试截图像模像样,同时一眼看出是测试件的图。
弧形文字沿椭圆弧排布,字宽按字体度量逐字累加到弧长上,而不是把角度均分——
均分会让字在弧顶挤成一团、在弧两端拉散。椭圆弧长没有初等表达式,用数值积分
求,再二分反解出给定弧长对应的参数。
View Source
var (
TopText = textChinese.top
BottomText = textChinese.bottom
CenterText = textChinese.center
)
默认文案是中文,保留导出名供调用方与测试直接引用。
Render 渲染印章图片,输出透明底的位图。
中文文案需要系统安装覆盖中文的字体;找不到时自动退回英文文案重试,只要求
拉丁字形,让没有中文字体的英文系统也能出图。英文文案同样缺字形时(既没有
中文字体也没有任何拉丁字体)才返回错误并提示用 Options.FontName 指定。
RenderPNG 渲染印章图片并编码为 PNG,供 ofd-seal --generate 与测试 fixture 使用。
Language 是印章文案语言。
const (
LanguageAuto Language = iota
LanguageChinese
LanguageEnglish
)
Shape 是印章外框形状。
const (
ShapeCircle Shape = iota
ShapeEllipse
)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.