Documentation
¶
Overview ¶
render 包负责把标准化后的二维码请求转换成可缓存的位图、终端预览和导出 字节流。
Index ¶
- func RequiredModules(content string, level core.Level) (int, error)
- type Engine
- type Prepared
- func (p *Prepared) PNG() ([]byte, error)
- func (p *Prepared) Preview() string
- func (p *Prepared) PreviewFit(maxWidth, maxHeight int) string
- func (p *Prepared) PreviewModules() int
- func (p *Prepared) Raster() image.Image
- func (p *Prepared) SVG() ([]byte, error)
- func (p *Prepared) WriteToPath(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine 根据标准化请求准备可复用的渲染产物,并缓存最近一次结果,供预览 和保存流程复用。
type Prepared ¶
type Prepared struct {
// contains filtered or unexported fields
}
Prepared 表示 PNG、SVG、终端预览和文件导出共用的渲染结果,让应用只有 一套视觉真相来源。
func (*Prepared) PreviewFit ¶
PreviewFit 会按当前终端预览画布放大二维码矩阵;当画布不足时保持原始模块 分辨率,不做有损压缩,避免预览看起来完整但实际不可扫码。
func (*Prepared) PreviewModules ¶
PreviewModules 返回包含 quiet zone 在内的预览模块边长,用于让上层判断 当前终端网格是否足够完整呈现二维码。
func (*Prepared) WriteToPath ¶
WriteToPath 会先写入临时文件,确保保存失败时不会留下半写入的图像文件。
Click to show internal directories.
Click to hide internal directories.